summaryrefslogtreecommitdiffstats
path: root/sys/netinet6/ip6_output.c
Commit message (Collapse)AuthorAgeFilesLines
* With exception of the if_name() macro, all definitions in net_osdep.hbrooks2006-08-041-2/+0
| | | | | | | | were unused or already in if_var.h so add if_name() to if_var.h and remove net_osdep.h along with all references to it. Longer term we may want to kill off if_name() entierly since all modern BSDs have if_xname variables rendering it unnecessicary.
* Remove ip6fw. Since ipfw has full functional IPv6 support now and - inmlaier2006-05-121-58/+0
| | | | contrast to ip6fw - is properly lockes, it is time to retire ip6fw.
* Somewhat re-factor the read/write locking mechanism associated with the packetcsjp2006-02-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | filtering mechanisms to use the new rwlock(9) locking API: - Drop the variables stored in the phil_head structure which were specific to conditions and the home rolled read/write locking mechanism. - Drop some includes which were used for condition variables - Drop the inline functions, and convert them to macros. Also, move these macros into pfil.h - Move pfil list locking macros intp phil.h as well - Rename ph_busy_count to ph_nhooks. This variable will represent the number of IN/OUT hooks registered with the pfil head structure - Define PFIL_HOOKED macro which evaluates to true if there are any hooks to be ran by pfil_run_hooks - In the IP/IP6 stacks, change the ph_busy_count comparison to use the new PFIL_HOOKED macro. - Drop optimization in pfil_run_hooks which checks to see if there are any hooks to be ran, and returns if not. This check is already performed by the IP stacks when they call: if (!PFIL_HOOKED(ph)) goto skip_hooks; - Drop in assertion which makes sure that the number of hooks never drops below 0 for good measure. This in theory should never happen, and if it does than there are problems somewhere - Drop special logic around PFIL_WAITOK because rw_wlock(9) does not sleep - Drop variables which support home rolled read/write locking mechanism from the IPFW firewall chain structure. - Swap out the read/write firewall chain lock internal to use the rwlock(9) API instead of our home rolled version - Convert the inlined functions to macros Reviewed by: mlaier, andre, glebius Thanks to: jhb for the new locking API
* When storing the results of malloc() in a pointer to a pointer, checkrwatson2006-01-141-1/+1
| | | | | | | the pointer to a pointer for NULL, not the pointer for NULL. Noticed by: Coverity Prevent analysis tool MFC after: 3 days
* sync with KAME regarding NDPsuz2005-10-211-13/+14
| | | | | | | | | | | | - introduced fine-grain-timer to manage ND-caches and IPv6 Multicast-Listeners - supports Router-Preference <draft-ietf-ipv6-router-selection-07.txt> - better prefix lifetime management - more spec-comformant DAD advertisement - updated RFC/internet-draft revisions Obtained from: KAME Reviewed by: ume, gnn MFC after: 2 month
* sync with KAME (renamed a macro IPV6_DADOUTPUT to IPV6_UNSPECSRC)suz2005-10-211-1/+1
| | | | Obtained from: KAME
* IPv6 was improperly defining its malloc type the same as IPv4 (M_IPMADDR,obrien2005-09-071-8/+8
| | | | | M_IPMOPTS, M_MRTABLE). Thus we had conflicting instantiations. Create an IPv6-specific type to overcome this.
* Use the correct mbuf type for MGET().andre2005-08-301-1/+1
|
* simplied the fix to FreeBSD-SA-04:06.ipv6. The previous one worriedume2005-07-281-35/+9
| | | | | | | | | | too much even though we actually validate the parameters. This code also is more compatible with other *BSDs, which do copyin within setsockopt(). Submitted by: Keiichi SHIMA <keiichi__at__iijlab.net> Reviewed by: security-officer (nectar) Obtained from: KAME
* scope cleanup. with this changeume2005-07-251-242/+212
| | | | | | | | | | | | | | | | | | | - most of the kernel code will not care about the actual encoding of scope zone IDs and won't touch "s6_addr16[1]" directly. - similarly, most of the kernel code will not care about link-local scoped addresses as a special case. - scope boundary check will be stricter. For example, the current *BSD code allows a packet with src=::1 and dst=(some global IPv6 address) to be sent outside of the node, if the application do: s = socket(AF_INET6); bind(s, "::1"); sendto(s, some_global_IPv6_addr); This is clearly wrong, since ::1 is only meaningful within a single node, but the current implementation of the *BSD kernel cannot reject this attempt. Submitted by: JINMEI Tatuya <jinmei__at__isl.rdc.toshiba.co.jp> Obtained from: KAME
* always copy ip6_pktopt. remove needcopy and needfreeume2005-07-211-70/+64
| | | | | | | argument/structure member accordingly. Submitted by: Keiichi SHIMA <keiichi__at__iijlab.net> Obtained from: KAME
* be consistent on naming advanced API functions; use ip6_XXXpktopt(s).ume2005-07-211-10/+10
| | | | | Submitted by: Keiichi SHIMA <keiichi__at__iijlab.net> Obtained from: KAME
* NULL is not zero.ume2005-07-211-1/+1
| | | | | Submitted by: Keiichi SHIMA <keiichi__at__iijlab.net> Obtained from: KAME
* update comments:ume2005-07-201-11/+11
| | | | | | | | - RFC2292bis -> RFC3542 - typo fixes Submitted by: Keiichi SHIMA <keiichi__at__iijlab.net> Obtained from: KAME
* Stop embedding struct ifnet at the top of driver softcs. Instead thebrooks2005-06-101-1/+1
| | | | | | | | | | | | | | | | | | | | struct ifnet or the layer 2 common structure it was embedded in have been replaced with a struct ifnet pointer to be filled by a call to the new function, if_alloc(). The layer 2 common structure is also allocated via if_alloc() based on the interface type. It is hung off the new struct ifnet member, if_l2com. This change removes the size of these structures from the kernel ABI and will allow us to better manage them as interfaces come and go. Other changes of note: - Struct arpcom is no longer referenced in normal interface code. Instead the Ethernet address is accessed via the IFP2ENADDR() macro. To enforce this ac_enaddr has been renamed to _ac_enaddr. - The second argument to ether_ifattach is now always the mac address from driver private storage rather than sometimes being ac_enaddr. Reviewed by: sobomax, sam
* Fixes for various nits found by the Coverity tool.gnn2005-05-151-1/+1
| | | | | | | | | In particular 2 missed return values and an inappropriate bcopy from a possibly NULL pointer. Reviewed by: jake Approved by: rwatson MFC after: 1 week
* Add IPv6 support to IPFW and Dummynet.brooks2005-04-181-0/+26
| | | | Submitted by: Mariano Tortoriello and Raffaele De Lorenzo (via luigi)
* initialized the last arg to ip6_process_hopopts(), because the recentume2005-02-271-3/+3
| | | | | | | | | code requires it to be 0 when a jumbo payload option is contained. PR: kern/77934 Submitted by: Gerd Rausch <gerd@juniper.net> Obtained from: KAME MFC after: 2 days
* /* -> /*- for license, minor formatting changes, separate for KAMEimp2005-01-071-2/+2
|
* Disable MTU feedback in IPv6 if the sender writes data that must be fragmented.dwhite2004-10-021-0/+14
| | | | | | | | | | | Discussed extensively with KAME. The API author's intent isn't clear at this point, so rather than remove the code entirely, #if 0 out and put a big comment in for now. The IPV6_RECVPATHMTU sockopt is available if the application wants to be notified of the path MTU to optimize packet sizes. Thanks to JINMEI Tatuya <jinmei@isl.rdc.toshiba.co.jp> for putting up with my incessant badgering on this issue, and fenner for pointing out the API issue and suggesting solutions.
* Add an additional struct inpcb * argument to pfil(9) in order to enablemlaier2004-09-291-1/+1
| | | | | | | | | | | | | | | | | | | passing along socket information. This is required to work around a LOR with the socket code which results in an easy reproducible hard lockup with debug.mpsafenet=1. This commit does *not* fix the LOR, but enables us to do so later. The missing piece is to turn the filter locking into a leaf lock and will follow in a seperate (later) commit. This will hopefully be MT5'ed in order to fix the problem for RELENG_5 in forseeable future. Suggested by: rwatson A lot of work by: csjp (he'd be even more helpful w/o mentor-reviews ;) Reviewed by: rwatson, csjp Tested by: -pf, -ipfw, LINT, csjp and myself MFC after: 3 days LOR IDs: 14 - 17 (not fixed yet)
* Always compile PFIL_HOOKS into the kernel and remove the associated kernelandre2004-08-271-8/+6
| | | | | | | | | | | compile option. All FreeBSD packet filters now use the PFIL_HOOKS API and thus it becomes a standard part of the network stack. If no hooks are connected the entire packet filter hooks section and related activities are jumped over. This removes any performance impact if no hooks are active. Both OpenBSD and DragonFlyBSD have integrated PFIL_HOOKS permanently as well.
* Get rid of the RANDOM_IP_ID option and make it a sysctl. NetBSDdwmalone2004-08-141-5/+0
| | | | | | | | | | | | | | | | | | | | | have already done this, so I have styled the patch on their work: 1) introduce a ip_newid() static inline function that checks the sysctl and then decides if it should return a sequential or random IP ID. 2) named the sysctl net.inet.ip.random_id 3) IPv6 flow IDs and fragment IDs are now always random. Flow IDs and frag IDs are significantly less common in the IPv6 world (ie. rarely generated per-packet), so there should be smaller performance concerns. The sysctl defaults to 0 (sequential IP IDs). Reviewed by: andre, silby, mlaier, ume Based on: NetBSD MFC after: 2 months
* Fix a bug which I discovered recently while doing IPv6 testing atwpaul2004-05-141-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | Wind River. In the IPv4 output path, one of the tests in ip_output() checks how many slots are actually available in the interface output queue before attempting to send a packet. If, for example, we need to transmit a packet of 32K bytes over an interface with an MTU of 1500, we know it's going to take about 21 fragments to do it. If there's less than 21 slots left in the output queue, there's no point in transmitting anything at all: IP does not do retransmission, so sending only some of the fragments would just be a waste of bandwidth. (In an extreme case, if you're sending a heavy stream of fragmented packets, you might find yourself sending nothing by the first fragment of all your packets.) So if ip_output() notices there's not enough room in the output queue to send the frame, it just dumps the packet and returns ENOBUFS to the app. It turns out ip6_output() lacks this code. Consequently, this caused the netperf UDPIPV6_STREAM test to produce very poor results with large write sizes. This commit adds code to check the remaining space in the output queue and junk fragmented packets if they're too big to be sent, just like with IPv4. (I can't imagine anyone's running an NFS server using UDP over IPv6, but if they are, this will likely make them a lot happier. :)
* Remove advertising clause from University of California Regent'simp2004-04-071-4/+0
| | | | | | | license, per letter dated July 22, 1999 and email from Peter Wemm, Alan Cox and Robert Watson. Approved by: core, peter, alc, rwatson
* Validate IPv6 socket options more carefully to avoid a panic.ume2004-03-261-1/+37
| | | | | PR: kern/61513 Reviewed by: cperciva, nectar
* IPSEC and FAST_IPSEC have the same internal API now;ume2004-02-171-6/+2
| | | | | | so merge these (IPSEC has an extra ipsecstat) Submitted by: "Bjoern A. Zeeb" <bzeeb+freebsd@zabbadoz.net>
* - obey ip6po_minmtu.ume2004-02-081-3/+30
| | | | | | - notify a proper path MTU to applications. Obtained from: KAME
* pass pcb rather than so. it is expected that per socket policyume2004-02-031-7/+2
| | | | works again.
* Catch a few places where NULL (pointer) was used where 0 (integer) wasume2003-12-231-2/+2
| | | | expected (fix build).
* Catch a few places where NULL (pointer) was used where 0 (integer) waspeter2003-12-231-3/+3
| | | | expected.
* fixed a bug that IPv6 routing header does not work properly if specified ↵suz2003-12-221-1/+1
| | | | | | from userland application reviewed by: ume
* fixed an IPv6 path MTU discovery failure owing to a lack of initializationsuz2003-12-171-1/+1
| | | | | | Reviewed by: ume Approved by: re (scottl) MFC after: 1 day
* pktopt may be null.ume2003-11-241-0/+3
| | | | Approved by: re (rwatson)
* Introduce tcp_hostcache and remove the tcp specific metrics fromandre2003-11-201-7/+20
| | | | | | | | | | | | | | | | | | | | | | | the routing table. Move all usage and references in the tcp stack from the routing table metrics to the tcp hostcache. It caches measured parameters of past tcp sessions to provide better initial start values for following connections from or to the same source or destination. Depending on the network parameters to/from the remote host this can lead to significant speedups for new tcp connections after the first one because they inherit and shortcut the learning curve. tcp_hostcache is designed for multiple concurrent access in SMP environments with high contention and is hash indexed by remote ip address. It removes significant locking requirements from the tcp stack with regard to the routing table. Reviewed by: sam (mentor), bms Reviewed by: -net, -current, core@kame.net (IPv6 parts) Approved by: re (scottl)
* correct to look right interface.ume2003-11-171-1/+1
|
* replace explicit changes to rt_refcnt by RT_ADDREF and RT_REMREFsam2003-11-081-1/+1
| | | | | | | macros that expand to include assertions when the system is built with INVARIANTS Supported by: FreeBSD Foundation
* correct behavior when ipv6mr_interface is 0. Matthias Drochnerume2003-11-061-4/+4
| | | | | Notified by: itojun Obtained from: NetBSD
* - cleanup SP refcnt issue.ume2003-11-041-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - share policy-on-socket for listening socket. - don't copy policy-on-socket at all. secpolicy no longer contain spidx, which saves a lot of memory. - deep-copy pcb policy if it is an ipsec policy. assign ID field to all SPD entries. make it possible for racoon to grab SPD entry on pcb. - fixed the order of searching SA table for packets. - fixed to get a security association header. a mode is always needed to compare them. - fixed that the incorrect time was set to sadb_comb_{hard|soft}_usetime. - disallow port spec for tunnel mode policy (as we don't reassemble). - an user can define a policy-id. - clear enc/auth key before freeing. - fixed that the kernel crashed when key_spdacquire() was called because key_spdacquire() had been implemented imcopletely. - preparation for 64bit sequence number. - maintain ordered list of SA, based on SA id. - cleanup secasvar management; refcnt is key.c responsibility; alloc/free is keydb.c responsibility. - cleanup, avoid double-loop. - use hash for spi-based lookup. - mark persistent SP "persistent". XXX in theory refcnt should do the right thing, however, we have "spdflush" which would touch all SPs. another solution would be to de-register persistent SPs from sptree. - u_short -> u_int16_t - reduce kernel stack usage by auto variable secasindex. - clarify function name confusion. ipsec_*_policy -> ipsec_*_pcbpolicy. - avoid variable name confusion. (struct inpcbpolicy *)pcb_sp, spp (struct secpolicy **), sp (struct secpolicy *) - count number of ipsec encapsulations on ipsec4_output, so that we can tell ip_output() how to handle the packet further. - When the value of the ul_proto is ICMP or ICMPV6, the port field in "src" of the spidx specifies ICMP type, and the port field in "dst" of the spidx specifies ICMP code. - avoid from applying IPsec transport mode to the packets when the kernel forwards the packets. Tested by: nork Obtained from: KAME
* do not insert a dest option header (even specified by a user) thatume2003-10-311-1/+13
| | | | | | | should be placed before a routing header, unless a routing header really exists. Obtained from: KAME
* re-add wrongly disappered IPV6_CHECKSUM stuff by introducingume2003-10-261-0/+76
| | | | | | ip6_raw_ctloutput(). Obtained from: KAME
* remove the ip6r0_addr and ip6r0_slmap members from ip6_rthdr0{}ume2003-10-241-4/+6
| | | | | | according to rfc2292bis. Obtained from: KAME
* Switch Advanced Sockets API for IPv6 from RFC2292 to RFC3542ume2003-10-241-248/+987
| | | | | | | | | | (aka RFC2292bis). Though I believe this commit doesn't break backward compatibility againt existing binaries, it breaks backward compatibility of API. Now, the applications which use Advanced Sockets API such as telnet, ping6, mld6query and traceroute6 use RFC3542 API. Obtained from: KAME
* - change scope to zone.ume2003-10-211-5/+5
| | | | | | | | - change node-local to interface-local. - better error handling of address-to-scope mapping. - use in6_clearscope(). Obtained from: KAME
* correct linkmtu handling.ume2003-10-201-45/+68
| | | | Obtained from: KAME
* - add dom_if{attach,detach} framework.ume2003-10-171-2/+2
| | | | | | - transition to use ifp->if_afdata. Obtained from: KAME
* nuke SCOPEDROUTING. Though it was there for a long time,ume2003-10-101-9/+0
| | | | it was never enabled.
* - fix typo in comments.ume2003-10-081-63/+60
| | | | | | | | | | - style. - NULL is not 0. - some variables were renamed. - nuke unused logic. (there is no functional change.) Obtained from: KAME
* must lock route when the caller provided a route but notsam2003-10-071-2/+4
| | | | | | | an interface; otherwise the subsequent unlock blows up Suffered by: Marcel Moolenaar <marcel@xcllnt.net> Supported by: FreeBSD Foundation
* return(code) -> return (code)ume2003-10-061-52/+52
| | | | (reduce diffs against KAME)
OpenPOWER on IntegriCloud