summaryrefslogtreecommitdiffstats
path: root/sys/net
Commit message (Collapse)AuthorAgeFilesLines
* Disable zerocopy by default for now. It's causing some problems in pcapcsjp2009-03-101-1/+1
| | | | | | | | | | | | | | consumers which fork after the shared pages have been setup. pflogd(8) is an example. The problem is understood and there is a fix coming in shortly. Folks who want to continue using it can do so by setting net.bpf.zerocopy_enable to 1. Discussed with: rwatson
* When resetting a BPF descriptor, properly check that zero-copy buffersrwatson2009-03-071-5/+11
| | | | | | | | | | | | | | | | | | | | | | | are not currently owned by userspace before clearing or rotating them. Otherwise we may not play by the rules of the shared memory protocol, potentially corrupting packet data or causing userspace applications that are playing by the rules to spin due to being notified that a buffer is complete but the shared memory header not reflecting that. This behavior was seen with pflogd by a number of reporters; note that this fix is not sufficient to get pflogd properly working with zero-copy BPF, due to pflogd opening the BPF device before forking, leading to the shared memory buffer not being propery inherited in the privilege-separated child. We're still deciding how to fix that problem. This change exposes buffer-model specific strategy information in reset_d(), which will be fixed at a later date once we've decided how best to improve the BPF buffer abstraction. Reviewed by: csjp Reported by: keramida
* On architectures with strict alignment requirements compensatemarius2009-03-071-0/+2
| | | | | | | | the misalignment of the IP header that prepending the EtherIP header might have caused. PR: 131921 MFC after: 1 week
* Mark the bpf stats sysctl as being mpsafe. We do not requirecsjp2009-03-071-1/+1
| | | | Giant here.
* Clarify some comments, fix some types, and rename ZBUF_FLAG_IMMUTABLE torwatson2009-03-071-18/+18
| | | | | ZBUF_FLAG_ASSIGNED to make it clear why the buffer can't be written to: it is assigned to userspace.
* Reserve a netisr slot for the IGMPv3 output queue.bms2009-03-041-0/+1
|
* Switch the default buffer mode in bpf(4) to zero-copy buffers.csjp2009-03-021-1/+1
| | | | Discussed with: rwatson
* Do a bit of struct ifnet cleanup in preparation for 8.0: group functionrwatson2009-03-011-7/+12
| | | | | | | | | | | pointers together, move padding to the bottom of the structure, and add two new integer spares due to attrition over time. Remove unused spare "flags" field, we can use one of the spare ints if we need it later. This change requires a rebuild of device driver modules that depend on the layout of ifnet for binary compatibility reasons. Discussed with: kmacy
* Add size-guards evaluated at compile-time to the main struct vnet_*bz2009-03-011-0/+3
| | | | | | | | | | which are not in a module of their own like gif. Single kernel compiles and universe will fail if the size of the struct changes. Th expected values are given in sys/vimage.h. See the comments where how to handle this. Requested by: peter
* For all files including net/vnet.h directly include opt_route.h andbz2009-02-2710-3/+18
| | | | | | | | | | | | | | net/route.h. Remove the hidden include of opt_route.h and net/route.h from net/vnet.h. We need to make sure that both opt_route.h and net/route.h are included before net/vnet.h because of the way MRT figures out the number of FIBs from the kernel option. If we do not, we end up with the default number of 1 when including net/vnet.h and array sizes are wrong. This does not change the list of files which depend on opt_route.h but we can identify them now more easily.
* 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
|
OpenPOWER on IntegriCloud