summaryrefslogtreecommitdiffstats
path: root/sys/net/bpf.c
Commit message (Collapse)AuthorAgeFilesLines
* /* -> /*- for license, minor formatting changesimp2005-01-071-1/+1
|
* Fix mbuf leak.pjd2004-12-271-1/+3
| | | | | Submitted by: Johnny Eriksson <bygg@cafax.se> MFC after: 5 days
* Include fcntl.hphk2004-12-221-3/+3
| | | | | | | Check O_NONBLOCK instead of IO_NDELAY Include uio.h Don't include vnode.h Don't include filedesc.h
* don't try to recurse on the bpf lock.. kqueue already locks the bpf lockjmg2004-12-171-2/+1
| | | | | | | now... Submitted by: Ed Maste of Sandvine Inc. MFC after: 1 week
* Don't require a device to be marked up when issuing BIOCSETIF.sam2004-12-081-4/+3
|
* Don't recurse the BPF descriptor lock during the BIOCSDLT operationgreen2004-10-061-1/+1
| | | | | | | | | (and panic). To try to finish making BPF safe, at the very least, the BPF descriptor lock really needs to change into a reader/writer lock that controls access to "settings," and a mutex that controls access to the selinfo/knote/callout. Also, use of callout_drain() instead of callout_stop() (which is really a much more widespread issue).
* Reformulate bpf_dettachd() to acquire the BIF_LOCK() as well asrwatson2004-09-091-11/+20
| | | | | | | | | | | | | BPFD_LOCK() when removing a descriptor from an interface descriptor list. Hold both over the operation, and do a better job at maintaining the invariant that you can't find partially connected descriptors on an active interface descriptor list. This appears to close a race that resulted in the kernel performing a NULL pointer dereference when BPF sessions are detached during heavy network activity on SMP systems. RELENG_5 candidate.
* Reformulate use of linked lists in 'struct bpf_d' and 'struct bpf_if'rwatson2004-09-091-35/+20
| | | | | | | | | | | | to use queue(3) list macros rather than hand-crafted lists. While here, move to doubly linked lists to eliminate iterating lists in order to remove entries. This change simplifies and clarifies the list logic in the BPF descriptor code as a first step towards revising the locking strategy. RELENG_5 candidate. Reviewed by: fenner
* Compare/set pointers using NULL not 0.rwatson2004-09-091-3/+3
|
* Add locking to the kqueue subsystem. This also makes the kqueue subsystemjmg2004-08-151-7/+5
| | | | | | | | | | | | | a more complete subsystem, and removes the knowlege of how things are implemented from the drivers. Include locking around filter ops, so a module like aio will know when not to be unloaded if there are outstanding knotes using it's filter ops. Currently, it uses the MTX_DUPOK even though it is not always safe to aquire duplicate locks. Witness currently doesn't support the ability to discover if a dup lock is ok (in some cases). Reviewed by: green, rwatson (both earlier versions)
* Do a lockless read of the BPF interface structure descriptor list headrwatson2004-08-051-0/+21
| | | | | | before grabbing BPF locks to see if there are any entries in order to avoid the cost of locking if there aren't any. Avoids a mutex lock/ unlock for each packet received if there are no BPF listeners.
* Prefer NULL to '0' when checking a pointer value.rwatson2004-07-241-37/+37
|
* In the BPF and ethernet bridging code, don't allow callouts to executerwatson2004-07-051-1/+1
| | | | without Giant if we're not debug.mpsafenet=1.
* Second half of the dev_t cleanup.phk2004-06-171-1/+1
| | | | | | | | | | | The big lines are: NODEV -> NULL NOUDEV -> NODEV udev_t -> dev_t udev2dev() -> findcdev() Various minor adjustments including handling of userland access to kernel space struct cdev etc.
* Do the dreaded s/dev_t/struct cdev */phk2004-06-161-9/+9
| | | | Bump __FreeBSD_version accordingly.
* Switch to conditionally acquiring and dropping Giant around calls intorwatson2004-06-111-2/+2
| | | | | | ifp->if_output() basedd on debug.mpsafenet. That way once bpfwrite() can be called without Giant, it will acquire Giant (if desired) before entering the network stack.
* Un-staticize 'dst' sockaddr in the stack of bpfwrite() to preventrwatson2004-06-111-1/+2
| | | | | | | the need to synchronize access to the structure. I believe this should fit into the stack under the necessary circumstances, but if not we can either add synchronization or use a thread-local malloc for the duration.
* 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
* Grab Giant after MAC processing on outgoing packets being sent viarwatson2004-02-291-1/+3
| | | | | | | | BPF. Grab the BPF descriptor lock before entering MAC since the MAC Framework references BPF descriptor fields, including the BPF descriptor label. Submitted by: sam
* Device megapatch 4/6:phk2004-02-211-0/+2
| | | | | | | | Introduce d_version field in struct cdevsw, this must always be initialized to D_VERSION. Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing four D_NOGIANT flags and adding 145 D_NEEDGIANT flags.
* Device megapatch 1/6:phk2004-02-211-3/+1
| | | | | | | Free approx 86 major numbers with a mostly automatically generated patch. A number of strategic drivers have been left behind by caution, and a few because they still (ab)use their major number.
* Random style fixes and a comment update. No functional changes.des2004-02-161-4/+4
|
* Unbreak build of bpf-free kernels.tjr2003-12-291-1/+1
|
* o eliminate widespread on-stack mbuf use for bpf by introducingsam2003-12-281-0/+53
| | | | | | | | | | | | | a new bpf_mtap2 routine that does the right thing for an mbuf and a variable-length chunk of data that should be prepended. o while we're sweeping the drivers, use u_int32_t uniformly when when prepending the address family (several places were assuming sizeof(int) was 4) o return M_ASSERTVALID to BPF_MTAP* now that all stack-allocated mbufs have been eliminated; this may better be moved to the bpf routines Reviewed by: arch@ and several others
* - Implement selwakeuppri() which allows raising the priority of atanimura2003-11-091-1/+1
| | | | | | | | | | | | | thread being waken up. The thread waken up can run at a priority as high as after tsleep(). - Replace selwakeup()s with selwakeuppri()s and pass appropriate priorities. - Add cv_broadcastpri() which raises the priority of the broadcast threads. Used by selwakeuppri() if collision occurs. Not objected in: -arch, -current
* Replace the if_name and if_unit members of struct ifnet with new membersbrooks2003-10-311-4/+3
| | | | | | | | | | | | | if_xname, if_dname, and if_dunit. if_xname is the name of the interface and if_dname/unit are the driver name and instance. This change paves the way for interface renaming and enhanced pseudo device creation and configuration symantics. Approved By: re (in principle) Reviewed By: njl, imp Tested On: i386, amd64, sparc64 Obtained From: NetBSD (if_xname)
* add a stub for bpfattach2 so bpf is not required with the 802.11sam2003-10-041-0/+8
| | | | | | module or related drivers Spotted by: Dan Lukes <dan@obluda.cz>
* Reduce window during which a race can occur when detachingsam2003-09-041-2/+3
| | | | | an interface from each descriptor that references it. This is just a bandaid; the locking here needs to be redone.
* Change instances of callout_init that specify MPSAFE behaviour tosam2003-08-191-1/+1
| | | | | use CALLOUT_MPSAFE instead of "1" for the second parameter. This does not change the behaviour; it just makes the intent more clear.
* add support for using kqueue to watch bpf sockets.jmg2003-08-051-9/+71
| | | | | Submitted by: Brian Buchanan of nCircle, Inc. Tested on: i386 and sparc64
* Assignment could be NULL, check.mdodd2003-03-211-1/+1
|
* Gigacommit to improve device-driver source compatibility betweenphk2003-03-031-13/+8
| | | | | | | | | | | | | branches: Initialize struct cdevsw using C99 sparse initializtion and remove all initializations to default values. This patch is automatically generated and has been tested by compiling LINT with all the fields in struct cdevsw in reverse order on alpha, sparc64 and i386. Approved by: re(scottl)
* sizeof(struct llc) -> LLC_SNAPFRAMELENmdodd2003-03-031-1/+1
| | | | | sizeof(struct ether_header) -> ETHER_HDR_LEN sizeof(struct fddi_header) -> FDDI_HDR_LEN
* More low-hanging fruit: kill caddr_t in calls to wakeup(9) / [mt]sleep(9).des2003-03-021-2/+2
|
* Clean up whitespace, s/register //, refrain from strong urge to ANSIfy.des2003-03-021-34/+34
|
* uiomove-related caddr_t -> void * (just the low-hanging fruit)des2003-03-021-2/+2
|
* Back out M_* changes, per decision of the TRB.imp2003-02-191-6/+6
| | | | Approved by: trb
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-6/+6
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* o add BIOCGDLTLIST and BIOCSDLT ioctls to get the data link type listsam2003-01-201-4/+101
| | | | | | | | | | | | and set the link type for use by libpcap and tcpdump o move mtx unlock in bpfdetach up; it doesn't need to be held so long o change printf in bpf_detach to distinguish it from the same one in bpfsetdlt Note there are locking issues here related to ioctl processing; they have not been addressed here. Submitted by: Guy Harris <guy@alum.mit.edu> Obtained from: NetBSD (w/ locking modifications)
* Remove cdevw_add() calls, they are deprecated.phk2002-12-281-1/+0
|
* correct function declarations of stubs used for building w/o device bpfsam2002-11-191-4/+4
|
* o add support for multiple link types per interface (e.g. 802.11 and Ethernet)sam2002-11-141-24/+38
| | | | | | | | | | o introduce BPF_TAP and BPF_MTAP macros to hide implementation details and ease code portability o use m_getcl where appropriate Reviewed by: many Approved by: re Obtained from: NetBSD (multiple link type support)
* Use if_printf(ifp, "blah") instead ofbrooks2002-10-211-2/+1
| | | | printf("%s%d: blah", ifp->if_name, ifp->if_xname).
* In an SMP environment post-Giant it is no longer safe to blindlytruckman2002-10-031-2/+2
| | | | | | | | | dereference the struct sigio pointer without any locking. Change fgetown() to take a reference to the pointer instead of a copy of the pointer and call SIGIO_LOCK() before copying the pointer and dereferencing it. Reviewed by: rwatson
* Be consistent about "static" functions: if the function is markedphk2002-09-281-1/+1
| | | | | | static in its prototype, mark it static at the definition too. Inspired by: FlexeLint warning #512
* Don't return(foo(bla)) when foo returns void.phk2002-09-281-2/+4
|
* Insert a missing call to MAC protection check for delivering anrwatson2002-09-211-1/+5
| | | | | | | | mbuf to a bpf device. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories Submitted by: phk
* Use m_length() instead of home-rolled.phk2002-09-181-4/+3
| | | | | | | In bpf_mtap(), if the entire packet is in one mbuf, call bpf_tap() instead since it is a tad faster. Sponsored by: http://www.babeltech.dk/
* Introduce support for Mandatory Access Control and extensiblerwatson2002-07-311-2/+6
| | | | | | | | | | | | kernel access control. Invoke a MAC framework entry point to authorize reception of an incoming mbuf by the BPF descriptor, permitting MAC policies to limit the visibility of packets delivered to particular BPF descriptors. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* Introduce support for Mandatory Access Control and extensiblerwatson2002-07-311-0/+12
| | | | | | | | | | | | | | kernel access control. Instrument BPF so that MAC labels are properly maintained on BPF descriptors. MAC framework entry points are invoked at BPF instantiation and allocation, permitting the MAC framework to derive the BPF descriptor label from the credential authorizing the device open. Also enter the MAC framework to label mbufs created using the BPF device. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
OpenPOWER on IntegriCloud