summaryrefslogtreecommitdiffstats
path: root/sys/netinet6
Commit message (Collapse)AuthorAgeFilesLines
* Try to remove/assimilate as much of formerly IPv4/6 specificbz2009-02-083-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (duplicate) code in sys/netipsec/ipsec.c and fold it into common, INET/6 independent functions. The file local functions ipsec4_setspidx_inpcb() and ipsec6_setspidx_inpcb() were 1:1 identical after the change in r186528. Rename to ipsec_setspidx_inpcb() and remove the duplicate. Public functions ipsec[46]_get_policy() were 1:1 identical. Remove one copy and merge in the factored out code from ipsec_get_policy() into the other. The public function left is now called ipsec_get_policy() and callers were adapted. Public functions ipsec[46]_set_policy() were 1:1 identical. Rename file local ipsec_set_policy() function to ipsec_set_policy_internal(). Remove one copy of the public functions, rename the other to ipsec_set_policy() and adapt callers. Public functions ipsec[46]_hdrsiz() were logically identical (ignoring one questionable assert in the v6 version). Rename the file local ipsec_hdrsiz() to ipsec_hdrsiz_internal(), the public function to ipsec_hdrsiz(), remove the duplicate copy and adapt the callers. The v6 version had been unused anyway. Cleanup comments. Public functions ipsec[46]_in_reject() were logically identical apart from statistics. Move the common code into a file local ipsec46_in_reject() leaving vimage+statistics in small AF specific wrapper functions. Note: unfortunately we already have a public ipsec_in_reject(). Reviewed by: sam Discussed with: rwatson (renaming to *_internal) MFC after: 26 days X-MFC: keep wrapper functions for public symbols?
* Don't bother null-checking the thread pointer before the prison checksjamie2009-02-051-27/+22
| | | | | | | | | in udp6_connect (td is already dereferenced elsewhere without such a check). This makes the conversion from a sockaddr to a sockaddr_in6 always happen, so convert once at the beginning of the function rather than twice in the middle. Approved by: bz (mentor)
* Remove redundant calls of prison_local_ip4 in in_pcbbind_setup, and ofjamie2009-02-051-7/+5
| | | | | | prison_local_ip6 in in6_pcbbind. Approved by: bz (mentor)
* Standardize the various prison_foo_ip[46] functions and prison_if tojamie2009-02-055-56/+44
| | | | | | | | | | | | | | | return zero on success and an error code otherwise. The possible errors are EADDRNOTAVAIL if an address being checked for doesn't match the prison, and EAFNOSUPPORT if the prison doesn't have any addresses in that address family. For most callers of these functions, use the returned error code instead of e.g. a hard-coded EADDRNOTAVAIL or EINVAL. Always include a jailed() check in these functions, where a non-jailed cred always returns success (and makes no changes). Remove the explicit jailed() checks that preceded many of the function calls. Approved by: bz (mentor)
* When iterating through the list trying to find a router inbz2009-02-041-1/+3
| | | | | | | | | | | defrouter_select(), NULL the cached llentry after unlocking as we are no longer interested in it and with the second iteration would try to unlock it again resulting in panic: Lock (rw) lle not locked @ ... Reported by: Mark Atkinson <m.atkinson@f5.com> Tested by: Mark Atkinson <m.atkinson@f5.com> PR: kern/128247 (in follow-up, unrelated to original report)
* - Cleanup checksum code.rrs2009-02-031-4/+17
| | | | | | | | | | | | | | | | | - Prepare for CRC offloading, add MIB counters (RS/MT). - Bugfix: Disable CRC computation for IPv6 addresses with local scope (MT). - Bugfix: Handle close() with SO_LINGER correctly when notifications are generated during the close() call(MT). - Bugfix: Generate DRY event when sender is dry during subscription. Only for 1-to-1 style sockets (RS/MT) - Bugfix: Put vtags for the correct amount of time into time-wait (MT). - Bugfix: Clear vtag entries correctly on expiration (MT). - Bugfix: shutdown() indicates ENOTCONN when called for unconnected 1-to-1 style sockets (MT). - Bugfix: In sctp Auth code (PL). - Add support for devices that support SCTP csum offload (igb). - Add missing sctp_associd to mib sysctl xsctp_tcb structure (RS) Obtained from: With help from Peter Lei and Michael Tuexen
* Remove the single global unlocked route cache ip6_forward_rtbz2009-02-015-134/+71
| | | | | | | | | | | | | | | | | | from the inet6 stack along with statistics and make sure we properly free the rt in all cases. While the current situation is not better performance wise it prevents panics seen more often these days. After more inet6 and ipsec cleanup we should be able to improve the situation again passing the rt to ip6_forward directly. Leave the ip6_forward_rt entry in struct vinet6 but mark it for removal. PR: kern/128247, kern/131038 MFC after: 25 days Committed from: Bugathon #6 Tested by: Denis Ahrens <denis@h3q.com> (different initial version)
* Remove unused local MACROs.bz2009-01-312-3/+0
| | | | | Submitted by: Christoph Mallon christoph.mallon@gmx.de MFC after: 2 weeks
* Coalesce two consecutive #ifdef IPSEC blocks.bz2009-01-311-4/+1
| | | | | | | Move the skip_ipsec: label below the goto as we can never have ipsecrt set if we get to that label so there is no need to check. MFC after: 2 weeks
* Remove dead code from #if 0:bz2009-01-311-4/+0
| | | | | | we do not have an ipsrcchk_rt anywhere else. MFC after: 2 weeks
* Like with r185713 make sure to not leak a lock as rtalloc1(9) returnsbz2009-01-314-7/+7
| | | | | | | | | | | | | | a locked route. Thus we have to use RTFREE_LOCKED(9) to get it unlocked and rtfree(9)d rather than just rtfree(9)d. Since the PR was filed, new places with the same problem were added with new code. Also check that the rt is valid before freeing it either way there. PR: kern/129793 Submitted by: Dheeraj Reddy <dheeraj@ece.gatech.edu> MFC after: 2 weeks Committed from: Bugathon #6
* Remove 4 entirely unsued ip6 variables.bz2009-01-303-16/+4
| | | | | | | | Leave then in struct vinet6 to not break the ABI with kernel modules but mark them for removal so we can do it in one batch when the time is right. MFC after: 1 month
* For consistency with prison_{local,remote,check}_ipN renamebz2009-01-251-1/+1
| | | | | | | prison_getipN to prison_get_ipN. Submitted by: jamie (as part of a larger patch) MFC after: 1 week
* remove too noisy DIAGNOSTIC codesam2009-01-181-4/+0
| | | | Reviewed by: qingli
* Revive the RTF_LLINFO flag in route.h. The kernel code is guardedqingli2009-01-121-0/+4
| | | | | | | | by the new kernel option COMPAT_ROUTE_FLAGS for binary backward compatibility. The RTF_LLDATA flag maps to the same value as RTF_LLINFO. RTF_LLDATA is used by the arp and ndp utilities. The RTF_LLDATA flag is always returned to the userland regardless whether the COMPAT_ROUTE_FLAGS is defined.
* Restrict arp, ndp and theoretically the FIB listing (if notbz2009-01-091-0/+4
| | | | | | | | | | | | | | | | | read with libkvm) to the addresses of a prison, when inside a jail. [1] As the patch from the PR was pre-'new-arp', add checks to the llt_dump handlers as well. While touching RTM_GET in route_output(), consistently use curthread credentials rather than the creds from the socket there. [2] PR: kern/68189 Submitted by: Mark Delany <sxcg2-fuwxj@qmda.emu.st> [1] Discussed with: rwatson [2] Reviewed by: rwatson MFC after: 4 weeks
* Make SIOCGIFADDR and related, as well as SIOCGIFADDR_IN6 and relatedbz2009-01-091-0/+4
| | | | | | | | | | | | | | | | jail-aware. Up to now we returned the first address of the interface for SIOCGIFADDR w/o an ifr_addr in the query. This caused problems for programs querying for an address but running inside a jail, as the address returned usually did not belong to the jail. Like for v6, if there was an ifr_addr given on v4, you could probe for more addresses on the interfaces that you were not allowed to see from inside a jail. Return an error (EADDRNOTAVAIL) in that case now unless the address is on the given interface and valid for the jail. PR: kern/114325 Reviewed by: rwatson MFC after: 4 weeks
* Addresses Roberts comments on comments. Also addsrrs2009-01-061-7/+3
| | | | | | | the KASSERT and checks suggested. Reviewed by: The udp tunneling was discussed on net@ under the thread entitled "Heads up -- Thinking about UDP and tunneling"
* Add the ability of an alternate transport protocolrrs2009-01-061-2/+44
| | | | | | to easily tunnel over udp by providing a hook function that will be called instead of appending to the socket buffer.
* Switch the last protosw* structs to C99 initializers.bz2009-01-051-5/+9
| | | | | Reviewed by: ed, julian, Christoph Mallon <christoph.mallon@gmx.de> MFC after: 2 weeks
* Unlike with struct protosw, several instances of struct ip6protoswrwatson2009-01-041-1/+0
| | | | | | | did not use C99-style sparse structure initialization, so remove NULL assignments for now-removed pr_usrreq function pointers. Reported by: Chris Ruiz <yr.retarded at gmail.com>
* struct ip6protosw is a copy of struct protosw, so remove pr_usrreq thererwatson2009-01-041-5/+0
| | | | | | to reflect removal from struct protosw. Spotted by: ed
* Some modules such as SCTP supplies a valid route entry as an input argumentqingli2009-01-031-36/+15
| | | | | | | | | | | | | | | to ip_output(). The destionation is represented in a sockaddr{} object that may contain other pieces of information, e.g., port number. This same destination sockaddr{} object may be passed into L2 code, which could be used to create a L2 entry. Since there exists a L2 table per address family, the L2 lookup function can make address family specific comparison instead of the generic bcmp() operation over the entire sockaddr{} structure. Note in the IPv6 case the sin6_scope_id is not compared because the address is currently stored in the embedded form inside the kernel. The in6_lltable_lookup() has to account for the scope-id if this storage format were to change in the future.
* This checkin addresses a couple of issues:qingli2008-12-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. The "route" command allows route insertion through the interface-direct option "-iface". During if_attach(), an sockaddr_dl{} entry is created for the interface and is part of the interface address list. This sockaddr_dl{} entry describes the interface in detail. The "route" command selects this entry as the "gateway" object when the "-iface" option is present. The "arp" and "ndp" commands also interact with the kernel through the routing socket when adding and removing static L2 entries. The static L2 information is also provided through the "gateway" object with an AF_LINK family type, similar to what is provided by the "route" command. In order to differentiate between these two types of operations, a RTF_LLDATA flag is introduced. This flag is set by the "arp" and "ndp" commands when issuing the add and delete commands. This flag is also set in each L2 entry returned by the kernel. The "arp" and "ndp" command follows a convention where a RTM_GET is issued first followed by a RTM_ADD/DELETE. This RTM_GET request fills in the fields for a "rtm" object, which is reinjected into the kernel by a subsequent RTM_ADD/DELETE command. The entry returend from RTM_GET is a prefix route, so the RTF_LLDATA flag must be specified when issuing the RTM_ADD/DELETE messages. 2. Enforce the convention that NET_RT_FLAGS with a 0 w_arg is the specification for retrieving L2 information. Also optimized the code logic. Reviewed by: julian
* avoid lock recursion by deferring the link check until after LLE lock is droppedkmacy2008-12-241-1/+5
|
* Correct variable name in comment.bz2008-12-221-1/+1
| | | | MFC after: 4 weeks
* Similar to the INET case, do not destroy the nd6 entries forqingli2008-12-221-4/+6
| | | | | | interface addresses until those addresses are removed. I already made the patch in INET but forgot to bring the code over for INET6.
* Only unlock the llentry if it is actually valid.bz2008-12-181-1/+2
| | | | Reported by: ed
* Another step assimilating IPv[46] PCB code:bz2008-12-174-15/+15
| | | | | | | | | normalize IN6P_* compat flags usage to their equialent INP_* counterpart. Discussed with: rwatson Reviewed by: rwatson MFC after: 4 weeks
* Use inc_flags instead of the inc_isipv6 alias which so farbz2008-12-172-2/+2
| | | | | | | | | | | | | | had been the only flag with random usage patterns. Switch inc_flags to be used as a real bit field by using INC_ISIPV6 with bitops to check for the 'isipv6' condition. While here fix a place or two where in case of v4 inc_flags were not properly initialized before.[1] Found by: rwatson during review [1] Discussed with: rwatson Reviewed by: rwatson MFC after: 4 weeks
* Remove the rt argument from nd6_storelladdr() becauseqingli2008-12-171-2/+0
| | | | rt is no longer accessed.
* A couple of files were not meant to be committed.qingli2008-12-172-23/+0
|
* in6_clsroute() was applied to prefix routes causing someqingli2008-12-175-39/+35
| | | | | | of them to expire. in6_clsroute() was only applied to cloned routes that are no longer applicable after the arp-v2 commit.
* * Compare pointer with NULLkmacy2008-12-161-6/+5
| | | | | | | * Remove trailing whitespace (added in r186162) * Reduce indentation by rephrasing test Submitted by: Christopher Mallon (christoph dot mallon at gmx dot de)
* - Simplify handling of the deferring of mbuf transmit until after lle lock dropkmacy2008-12-161-12/+28
| | | | - add a couple of comments to clarify intent
* check pointers against NULLkmacy2008-12-161-3/+3
|
* convert more pointer validation checks to checking against NULLkmacy2008-12-163-6/+6
|
* simplify locking in find_pfxlist_reachable_routerkmacy2008-12-161-8/+9
|
* explicitly check return of lla_lookup against NULLkmacy2008-12-162-8/+8
|
* advance tail pointer in nd6_output_lle and check lla_output return against NULLkmacy2008-12-161-4/+8
|
* check return from lla_lookup against NULL not zerokmacy2008-12-162-2/+2
|
* make sure redirect doesn't return without dropping the lockkmacy2008-12-161-6/+7
|
* need to check that lle is not null before unlock if the break condition is ↵kmacy2008-12-161-3/+4
| | | | | | not met also fix the break condition to explicitly check against NULL
* unlock the llentry after use in find_pfxlist_reachable_routerkmacy2008-12-161-1/+2
|
* Initialize the variable "router", and apply "static_route" flagqingli2008-12-161-4/+7
| | | | across the entire nd6_cache_lladdr() function.
* unlock and destroy an llentry's lock before freeingkmacy2008-12-161-0/+2
| | | | Found by: sam
* unlock looked up llentrys in defrouter_selectkmacy2008-12-161-0/+4
|
* fix two use after frees in nd6_cache_lladdr caused by last minute unlock ↵kmacy2008-12-161-2/+6
| | | | shuffling
* Another step assimilating IPv[46] PCB code - directly usebz2008-12-157-68/+68
| | | | | | | | | | | | | | the inpcb names rather than the following IPv6 compat macros: in6pcb,in6p_sp, in6p_ip6_nxt,in6p_flowinfo,in6p_vflag, in6p_flags,in6p_socket,in6p_lport,in6p_fport,in6p_ppcb and sotoin6pcb(). Apart from removing duplicate code in netipsec, this is a pure whitespace, not a functional change. Discussed with: rwatson Reviewed by: rwatson (version before review requested changes) MFC after: 4 weeks (set the timer and see then)
* This main goals of this project are:qingli2008-12-1513-1000/+846
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. separating L2 tables (ARP, NDP) from the L3 routing tables 2. removing as much locking dependencies among these layers as possible to allow for some parallelism in the search operations 3. simplify the logic in the routing code, The most notable end result is the obsolescent of the route cloning (RTF_CLONING) concept, which translated into code reduction in both IPv4 ARP and IPv6 NDP related modules, and size reduction in struct rtentry{}. The change in design obsoletes the semantics of RTF_CLONING, RTF_WASCLONE and RTF_LLINFO routing flags. The userland applications such as "arp" and "ndp" have been modified to reflect those changes. The output from "netstat -r" shows only the routing entries. Quite a few developers have contributed to this project in the past: Glebius Smirnoff, Luigi Rizzo, Alessandro Cerri, and Andre Oppermann. And most recently: - Kip Macy revised the locking code completely, thus completing the last piece of the puzzle, Kip has also been conducting active functional testing - Sam Leffler has helped me improving/refactoring the code, and provided valuable reviews - Julian Elischer setup the perforce tree for me and has helped me maintaining that branch before the svn conversion
OpenPOWER on IntegriCloud