diff options
author | melifaro <melifaro@FreeBSD.org> | 2012-05-21 22:13:48 +0000 |
---|---|---|
committer | melifaro <melifaro@FreeBSD.org> | 2012-05-21 22:13:48 +0000 |
commit | 1c776bfa6e8c09481f7796562d3b3f95d7f76aa8 (patch) | |
tree | 53dbc7a0d046e471d78c6004e39c002c3b1853de /share | |
parent | 707a97650988798151dc4cbaae0d3576fb7a4879 (diff) | |
download | FreeBSD-src-1c776bfa6e8c09481f7796562d3b3f95d7f76aa8.zip FreeBSD-src-1c776bfa6e8c09481f7796562d3b3f95d7f76aa8.tar.gz |
Fix panic on attaching to non-existent interface (introduced by r233937, pointed by hrs@)
Fix panic on tcpdump being attached to interface being removed (introduced by r233937, pointed by hrs@ and adrian@)
Protect most of bpf_setf() by BPF global lock
Add several forgotten assertions (thanks to adrian@)
Document current locking model inside bpf.c
Document EVENTHANDLER(9) usage inside BPF.
Approved by: kib(mentor)
Tested by: gnn
MFC in: 4 weeks
Diffstat (limited to 'share')
-rw-r--r-- | share/man/man9/EVENTHANDLER.9 | 4 | ||||
-rw-r--r-- | share/man/man9/bpf.9 | 26 |
2 files changed, 27 insertions, 3 deletions
diff --git a/share/man/man9/EVENTHANDLER.9 b/share/man/man9/EVENTHANDLER.9 index ed83018..4a16660 100644 --- a/share/man/man9/EVENTHANDLER.9 +++ b/share/man/man9/EVENTHANDLER.9 @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" $FreeBSD$ .\" -.Dd January 7, 2005 +.Dd May 11, 2012 .Dt EVENTHANDLER 9 .Os .Sh NAME @@ -197,6 +197,8 @@ Callbacks invoked when an interface is cloned. Callbacks invoked when a new network interface appears. .It Vt ifnet_departure_event Callbacks invoked when a network interface is taken down. +.It Vt bpf_track +Callbacks invoked when a BPF listener attaches to/detaches from network interface. .It Vt power_profile_change Callbacks invoked when the power profile of the system changes. .It Vt process_exec diff --git a/share/man/man9/bpf.9 b/share/man/man9/bpf.9 index 5a3ac07..ebf26cb 100644 --- a/share/man/man9/bpf.9 +++ b/share/man/man9/bpf.9 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 13, 2006 +.Dd May 11, 2012 .Dt BPF 9 .Os .\" @@ -246,9 +246,31 @@ The function returns 0 when the program is not a valid filter program. .\" +.Sh EVENT HANDLERS +.Nm +invokes +.Fa bpf_track +.Xr EVENTHANDLER 9 +event each time listener attaches to or detaches from an interface. +Pointer to +.Pq Vt "struct ifnet *" +is passed as the first argument, interface +.Fa dlt +follows. Last argument indicates listener is attached (1) or +detached (0). +Note that handler is invoked with +.Nm +global lock held, which implies restriction on sleeping and calling +.Nm +subsystem inside +.Xr EVENTHANDLER 9 +dispatcher. +Note that handler is not called for write-only listeners. +.\" .Sh SEE ALSO .Xr tcpdump 1 , -.Xr bpf 4 +.Xr bpf 4 , +.Xr EVENTHANDLER 9 .\" .Sh HISTORY The Enet packet filter was created in 1980 by Mike Accetta and |