summaryrefslogtreecommitdiff
path: root/sys/net/bpf.c
AgeCommit message (Collapse)Author
2007-03-24Kill the horrible hack of storing the pid in struct selinfo.Artur Grabowski
Instead, keep the proc pointer in it and put the selinfo on a list in struct proc in selrecord. Then clean up the list when leaving sys_select and sys_poll. miod@ ok, testing by many, including Bobs spamd boxes.
2007-03-04Make sure a bpf device can only be opened once.Can Erkin Acar
Previously the descriptor was locked only after an interface is set, leading to a race condition. Reported by Jon Steel < jon.steel at esentire com > tested by otto@, looks correct deraadt@
2006-07-18get rid of arc network support. we have no users of it so this is deadDavid Gwynne
code. however, it is still cluttering up the kernel namespace a bit. it is better gone. ok claudio@
2006-03-25allow bpf(4) to ignore packets based on their direction (inbound orDamien Miller
outbound), using a new BIOCSDIRFILT ioctl; guidance, feedback and ok canacar@
2006-03-04With the exception of two other small uncommited diffs this movesBrad Smith
the remainder of the network stack from splimp to splnet. ok miod@
2005-11-03re-implement the bpf "filter drop" option that it actually works. theReyk Floeter
bpf FILDROP interface exists for about one year but the required interface to the drivers was missing - so it was useless. this new approach based on a design by henning@ uses a new mbuf flag to mark filtered packets and to drop them in the generic network stack input routines (like ether_input). for example; after some additional testing, this could be used by dhclient to filter everything except DHCP packets (track tech@ for a corresponding dhclient diff). the "filter dropped" packets won't reach the network stack. so it's probably some kind of a very basic application layer packet filter ;). ok canacar@, discussed with henning@ and others
2005-07-31Introduce bpf_mtap_af and bpf_mtap_hdr to be used when passing a mbuf chainChristopher Pascoe
to bpf with either an address family or other header added. These helpers only allocate a much smaller struct m_hdr on the stack when needed, rather than leaving 256 byte struct mbufs on the stack in deep call paths. Also removes a fair bit of duplicated code. commit now, tune after deraadt@
2005-04-20send raw 802.11 frames with bpf(4) using the IEEE802_11 orReyk Floeter
IEEE802_11_RADIO data link types. ok canacar@ damien@
2005-04-20the linktype (DLT) should always be of type u_int.Reyk Floeter
fine deraadt@
2005-01-07add support for BIOCGDLTLIST and BIOCSDLT, see bpf(4)Reyk Floeter
ok canacar@, fgsch@, tested by some other people
2004-12-17knf cleanup, convert old k&r-style functions to ansi-style for aReyk Floeter
consistent style in sys/net/bpf.c. ok henning@, "looks fine" canacar@
2004-10-09sizeof(struct ether_header) -> ETHER_HDR_LENBrad Smith
ok mcbride@
2004-09-23- remove EVFILT_WRITE in bpfkqfilter() switch case, handledBrad Smith
by default label. - fill in kn_data with the number of bytes available, same behavior as FreeBSD/NetBSD. ok tedu@
2004-09-12Return the most common data link type instead of the first match for anClaudio Jeker
interface. Where the most common DLT is the one with the smallest id. This fixes tcpdump for atw(4) that attaches multiple bpf hooks. Tested: millert@, Sigfred Haversen, otto@, mcbride@, sturm@, krw@, Steve Shockley OK millert@ deraadt@
2004-06-22Unbreak previous commit ok markus@Can Erkin Acar
2004-06-22Add a new "filter drop" flag to bpf and related ioclts.Can Erkin Acar
When enabled, it notifies the calling interface that the packet matches a bpf filter and should be dropped. ok henning@ markus@ frantzen@
2004-06-21move the IFF_UP check to bpfwrite; ok canacar@Markus Friedl
2004-05-31remove the broken auto-append-'0' code; ok canacar, deraadt, thierryMarkus Friedl
2004-05-28bpf device cloning.Alexander Yurchenko
Now to have more bpf devices just add device nodes in /dev, no need to recompile kernel anymore. Code from form@pdp-11.org.ru, some help from markus@. ok markus@ canacar@ deraadt@
2004-05-25Return buffered packets when reading from a bpf descriptor and theCan Erkin Acar
interface is detached, and wakeup any polling processes when the bpf descriptor is closed. ok henning@, tedu@
2004-05-08reference count bpf descriptors to protect against disappearing interfacesCan Erkin Acar
while asleep in read. ok deraadt@
2004-02-24sysctl knob for bpf tunables. some tips from canacar@Ted Unangst
ok canacar@ deraadt@ mcbride@
2004-02-06as seen in netbsd. crank bpf sizes to adapt to faster networks.Ted Unangst
max size goes to 2MB, default goes to 32k. ok canacar@ mcbride@
2003-12-10de-register. deraadt okJun-ichiro itojun Hagino
2003-10-24Fix write filter blocking when no filter was set. FixesCan Erkin Acar
problems with dhcp. ok frantzen@ krw@ deraadt@
2003-10-22Add locking and write filtering to bpf descriptors.Can Erkin Acar
Locking prevents dangerous ioctls such as changing the interface and sending signals to be executed by an unprivileged process. A filter can also be applied to packets injected through a bpf descriptor. These features allow programs using bpf descriptors to safely drop/seperate privileges. ok frantzen@ henning@ mcbride@
2003-10-04bpf support for atm cards; from jason@ackley.netTheo de Raadt
none of us can test this, but that does not mean it has to sit in the pr database
2003-09-23Replace select backends with poll backends. selscan() and pollscan()Todd C. Miller
now call the poll backend. With this change we implement greater poll(2) functionality instead of emulating it via the select backend. Adapted from NetBSD and including some changes from FreeBSD. Tested by many, deraadt@ OK
2003-07-29avoid stack smash on FDDI case. found by kernel propolice.Jun-ichiro itojun Hagino
markus ok. miod/paul confirmed
2003-06-18Do not panic on no memory available when allocating bufs, pass ENOBUFSHenning Brauer
to userland instead. fixes PRs 2235, 2236 and 2640 from Otto Moerbeek <otto@drijf.net> ok frantzen@, tedu@, deraadt@
2003-06-02Remove the advertising clause in the UCB license which BerkeleyTodd C. Miller
rescinded 22 July 1999. Proofed by myself and Theo.
2003-04-01When using bpf(4) in immediate mode, and using kevent(2) to receiveArtur Grabowski
notification of packet arrival, the usermode application isn't notified until a second packet arrives. This is because KNOTE() calls filt_bpfread() before bd_slen has been updated with the newly arrived packet length, so it looks like there is no data there. Moving the bpf_wakeup() call for immediate mode to after bd_slen is set fixes it. From: wayne@epipe.com.au in pr 3175
2002-06-06kqueue support for bpf; okay markus@Niels Provos
2002-03-14Final __P removal plus some cosmetic fixupsTodd C. Miller
2002-03-14First round of __P removal in sysTodd C. Miller
2001-10-02change timeval to bpf_timeval; 32 bit in size, permitting much greater ↵Theo de Raadt
portability
2001-09-15Revert the sleep priority to something more saneMike Frantzen
(the previous priority didn't help performance in tests on a hacked up BPF and it weighed down the load average)
2001-06-08Move ifpromisc() from bpf.c to if.c, include cleanup.Angelos D. Keromytis
2001-05-28add BIOC[GS]HDRCMPLT ioctl for BPF, to disable overwriting of link level ↵Dug Song
source address in forged frames. from NetBSD. art@ok
2001-05-16No need to check M_WAIT/M_WAITOK malloc return values. (art@ ok)Hakan Olsson
2001-04-04check for return value of ENODEV from ifpromisc(). This will happenJason Wright
at detach time when if_detach_ioctl() has been installed for an outgoing interface and does not represent an error.
2001-03-25Don't set pbp to point to free memory. Thanks to Dawson Engler and teamConstantine Sapuntzakis
2001-03-13allow configuring number of these in ukcMichael Shalayeff
2000-06-19de-#ifdef-izeJason Wright
2000-06-08Add explicit inclusions of signalvar.h to files actually using syms definedNiklas Hallqvist
there but relying on an indirect inclusion
2000-03-23Remove code from the stone age.Artur Grabowski
2000-02-19set interface fields to null when detaching substructuresNiklas Hallqvist
in preparation for softc retainment.
1999-08-10code we do not use, had a typo; sirsyko@temp.ishiboo.comTheo de Raadt
1999-08-08Support detaching of network interfaces. Still work to do in ipf, andNiklas Hallqvist
other families than inet.
1999-05-26Implement DLT_RAW, DLT_{SLIP,PPP}_BSDOS from libpcap 0.4Brad Smith