summaryrefslogtreecommitdiffstats
path: root/sys/net
Commit message (Collapse)AuthorAgeFilesLines
* we need if_var.h not if.hluigi2009-02-161-1/+1
|
* remove unnecessary forward declarationluigi2009-02-161-2/+0
|
* IFF_NEEDSGIANT will no longer be supported, so remove compatibility coderwatson2009-02-161-35/+12
| | | | from if_sppp framework for interfaces requiring Giant.
* remove unnecessary #include from vnet.h and vinet.hluigi2009-02-151-6/+0
| | | | Approved by: Marko Zec
* bridge_delete_member is called via the event handler from if_detachthompsa2009-02-131-5/+9
| | | | | | | | after the LLADDR is reclaimed which causes a null pointer deref with inherit_mac enabled. Record the ifnet pointer of the interface and then compare that to find when to re-assign the bridge address. Submitted by: sam
* o In case of the error do not forget to deallocate a cloned device unit.maxim2009-02-131-0/+1
| | | | | | PR: kern/131642 Submitted by: Dmitrij Tejblum MFC after: 1 week
* Remove unused ifaddr local variable in ioctl routine.rwatson2009-02-131-2/+0
| | | | MFC after: 3 days
* Call prison_if from rtm_get_jailed, instead of splitting it out intojamie2009-02-051-90/+63
| | | | | | | prison_check_ip4 and prison_check_ip6. As prison_if includes a jailed() check, remove that check before calling rtm_get_jailed. Approved by: bz (mentor)
* Standardize the various prison_foo_ip[46] functions and prison_if tojamie2009-02-052-16/+16
| | | | | | | | | | | | | | | 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)
* Adds support for SCTP checksum offload. This meansrrs2009-02-031-0/+4
| | | | | | | | | | | | | we, like TCP and UDP, move the checksum calculation into the IP routines when there is no hardware support we call into the normal SCTP checksum routine. The next round of SCTP updates will use this functionality. Of course the IGB driver needs a few updates to support the new intel controller set that actually does SCTP csum offload too. Reviewed by: gnn, rwatson, kmacy
* Like with r185713 make sure to not leak a lock as rtalloc1(9) returnsbz2009-01-311-2/+3
| | | | | | | | | | | | | | 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
* For consistency with prison_{local,remote,check}_ipN renamebz2009-01-251-2/+2
| | | | | | | prison_getipN to prison_get_ipN. Submitted by: jamie (as part of a larger patch) MFC after: 1 week
* Only start the if_slowtimo timer (which drives the if_watchdog methods ofjhb2009-01-231-2/+25
| | | | | | | network interfaces) if we have at least one interface with an if_watchdog routine. MFC after: 2 weeks
* The RTF_LLINFO was revived unconditionally, but within the kernel theqingli2009-01-161-5/+1
| | | | | | | | | check on the sysctl argument value being RTF_LLINFO is conditioned on the COMPAT_ROUTE_FLAGS kernel option. This mismatch caused the L2 table retrieval failure, and the arp/ndp -an command displays empty L2 tables. Reviewed by: pjd
* Revive the RTF_LLINFO flag in route.h. The kernel code is guardedqingli2009-01-122-2/+9
| | | | | | | | 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.
* Do invoke mac_ifnet_check_transmit() and mac_ifnet_create_mbuf()rwatson2009-01-101-0/+18
| | | | | | | | | | | | | | in the loopback and synthetic loopback code so that packets are access control checked and relabeled. Previously, the MAC Framework enforced that packets sent over the loopback weren't relabeled, but this will allow policies to make explicit choices about how and whether to relabel packets on the loopback. Also, for SIMPLEX devices, this produces more consistent behavior for looped back packets to the local MAC address by labeling those packets as coming from the interface. Discussed with: csjp Obtained from: TrustedBSD Project
* Rather than using the cred from curthread, take it from the threadbz2009-01-091-5/+5
| | | | | | | referenced in the sysctl req argument. Reviewed by: rwatson MFC after: 2 weeks
* Restrict arp, ndp and theoretically the FIB listing (if notbz2009-01-091-2/+12
| | | | | | | | | | | | | | | | | 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
* Take the cred from curthread rather than curproc as curproc would needbz2009-01-091-3/+3
| | | | | | | locking but the credential from curthread (usually) never changes. Discussed with: jhb MFC after: 2 weeks
* The log message should terminate with a newline insteadqingli2009-01-021-1/+1
| | | | of a tab character.
* This checkin addresses a couple of issues:qingli2008-12-262-7/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* The "tun?" dev need not be opened at all. One is allowed to performqingli2008-12-251-4/+2
| | | | | | | | | | | | the following operations, e.g.: 1) ifconfig tun0 create 2) ifconfig tun0 10.1.1.1 10.1.1.2 3) route add -net 192.103.54.0/24 -iface tun0 4) ifconfig tun0 destroy If cv wait on the TUN_CLOSED flag, then the last operation (4) will block forever. Revert the previous changes and fix the mtx_unlock() leak.
* - Close a race during which the open flag could be cleared but the tun_softc ↵kmacy2008-12-251-2/+6
| | | | | | | | | would still be referenced by adding a separate TUN_CLOSED flag that is set after tunclose is done referencing it. - drop the tun_mtx after the flag check to avoid holding it across if_detach which can recurse in to if_tun.c
* Provide a condition variable to delay the cloned interfaceqingli2008-12-221-3/+12
| | | | | | | | destroy operation until the referenced clone device has been closed by the process properly. The behavior is now consistently with the previous release. Reviewed by: Kip Macy
* if_rtdel is always called with the RADIX_NODE_HEAD lock heldkmacy2008-12-181-1/+1
|
* add ifnet_byindex_locked to allow for use of IFNET_RLOCKkmacy2008-12-181-8/+17
|
* Add TWINAX (Twin Axial Copper for 10G networking) media types.gnn2008-12-171-0/+12
| | | | | | | | | Add code to the Chelsio driver so that it can recognize different module types which may be plugged into it, including SR, LR lasers and TWINAX copper cables. Obtained from: Chelsio Inc. MFC after: 1 week
* - Protect against sc->sc_primary being nullthompsa2008-12-171-3/+4
| | | | - Initialise speed where its used
* Update the interface baudrate taking into account the max speed for thethompsa2008-12-172-0/+21
| | | | different aggregation protocols.
* Remove the rt argument from nd6_storelladdr() becauseqingli2008-12-175-5/+5
| | | | rt is no longer accessed.
* Keep stats in drbr_enqueuekmacy2008-12-171-3/+16
| | | | Discussed with: ps
* avoid trying to acquire a shared lock while holding an exclusive lockkmacy2008-12-171-4/+4
| | | | by making the ifnet lock acquisition exclusive
* merge in 2 buf_ring helper routines for enqueueing and freeing buf_ringskmacy2008-12-171-0/+27
|
* convert ifnet and afdata locks from mutexes to rwlockskmacy2008-12-172-18/+24
|
* Also propagate the if_hwassist value to the parent so that cksum offload works.thompsa2008-12-161-1/+6
| | | | Submitted by: Tom Hicks (thicks_averesys.com)
* A few locking fixes and cleanups to pfil hook registration,rwatson2008-12-161-32/+10
| | | | | | | | | | | | | | | | | | | | unregistration, and execution: - Add some brackets for clarity and trim a bit of vertical whitespace. - Remove comments that may not contribute to clarity, such as "Lock" before acquiring a lock and "Get memory" before allocating memory. - During hook registration, don't drop pfil_list_lock between checking for a duplicate and registering the hook, as this leaves a race condition by failing to enforce the "no duplicate hooks" invariant. - Don't lock the hook during registration, since it's not yet in use. - Document assumption that hooks will be quiesced before being unregistered. - Don't write-lock hooks during removal because they are assumed quiesced. - Rename "done" label to "locked_error" to be clear that it's an error path on the way out of hook execution. MFC after: pretty soon
* remove assertion checks for now - ipfw uses its own lock for protecting its ↵kmacy2008-12-161-6/+0
| | | | radix tree instance
* style and spelling fixkmacy2008-12-162-2/+2
|
* assert that the radix node head is locked when manipulating the treekmacy2008-12-161-0/+7
|
* add macro for destroying an llentry's rwlockkmacy2008-12-161-1/+2
|
* Add arpv2 management codekmacy2008-12-152-0/+502
|
* This main goals of this project are:qingli2008-12-1512-616/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Dont leak the rnh lock on error.thompsa2008-12-131-3/+3
|
* Second round of putting global variables, which were virtualizedbz2008-12-131-1/+3
| | | | | | | | | | | but formerly missed under VIMAGE_GLOBAL. Put the extern declarations of the virtualized globals under VIMAGE_GLOBAL as the globals themsevles are already. This will help by the time when we are going to remove the globals entirely. Sponsored by: The FreeBSD Foundation
* Line wrap very long line in struct packet_filter_hook definition.rwatson2008-12-131-1/+2
| | | | MFC after: pretty soon
* Consider processes attaching/detaching from tun(4) devices as being linkcsjp2008-12-121-0/+2
| | | | | | | | | | | state changes. This change modifies tunopen and tunclose to call the if_link_state_change() function. Among other things, this will result in devd(8) receiving events from devctl(4) for linkup/link down. This allows us to do several useful things, including initializing tunnel parameters and adding routes. Discussed on: freebsd-net@ MFC after: 2 weeks
* Put a global variables, which were virtualized but formerlybz2008-12-111-0/+2
| | | | | | | | | | | | | missed under VIMAGE_GLOBAL. Start putting the extern declarations of the virtualized globals under VIMAGE_GLOBAL as the globals themsevles are already. This will help by the time when we are going to remove the globals entirely. While there garbage collect a few dead externs from ip6_var.h. Sponsored by: The FreeBSD Foundation
* Whitespace changes only - tabs must have been converted to spacesbz2008-12-111-5/+5
| | | | | | somehow, when moving the code from p4 to svn. Sponsored by: The FreeBSD Foundation
* Conditionally compile out V_ globals while instantiating the appropriatezec2008-12-106-5/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | container structures, depending on VIMAGE_GLOBALS compile time option. Make VIMAGE_GLOBALS a new compile-time option, which by default will not be defined, resulting in instatiations of global variables selected for V_irtualization (enclosed in #ifdef VIMAGE_GLOBALS blocks) to be effectively compiled out. Instantiate new global container structures to hold V_irtualized variables: vnet_net_0, vnet_inet_0, vnet_inet6_0, vnet_ipsec_0, vnet_netgraph_0, and vnet_gif_0. Update the VSYM() macro so that depending on VIMAGE_GLOBALS the V_ macros resolve either to the original globals, or to fields inside container structures, i.e. effectively #ifdef VIMAGE_GLOBALS #define V_rt_tables rt_tables #else #define V_rt_tables vnet_net_0._rt_tables #endif Update SYSCTL_V_*() macros to operate either on globals or on fields inside container structs. Extend the internal kldsym() lookups with the ability to resolve selected fields inside the virtualization container structs. This applies only to the fields which are explicitly registered for kldsym() visibility via VNET_MOD_DECLARE() and vnet_mod_register(), currently this is done only in sys/net/if.c. Fix a few broken instances of MODULE_GLOBAL() macro use in SCTP code, and modify the MODULE_GLOBAL() macro to resolve to V_ macros, which in turn result in proper code being generated depending on VIMAGE_GLOBALS. De-virtualize local static variables in sys/contrib/pf/net/pf_subr.c which were prematurely V_irtualized by automated V_ prepending scripts during earlier merging steps. PF virtualization will be done separately, most probably after next PF import. Convert a few variable initializations at instantiation to initialization in init functions, most notably in ipfw. Also convert TUNABLE_INT() initializers for V_ variables to TUNABLE_FETCH_INT() in initializer functions. Discussed at: devsummit Strassburg Reviewed by: bz, julian Approved by: julian (mentor) Obtained from: //depot/projects/vimage-commit2/... X-MFC after: never Sponsored by: NLnet Foundation, The FreeBSD Foundation
* fix a reported panic when adding a route and one hit here when deleting a routekmacy2008-12-102-4/+12
| | | | | - pass RTF_RNH_LOCKED to rtalloc1_fib in 2 cases where the lock is held - make sure the rnh lock is held across rt_setgate and rt_getifa_fib
OpenPOWER on IntegriCloud