diff options
-rw-r--r-- | sys/net/bpf.c | 4 | ||||
-rw-r--r-- | sys/sys/eventhandler.h | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c index d8ed7c2..5bca0eb 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -534,6 +534,8 @@ bpf_attachd(struct bpf_d *d, struct bpf_if *bp) bpf_bpfd_cnt++; BPFIF_UNLOCK(bp); + + EVENTHANDLER_INVOKE(bpf_track, bp->bif_ifp, 1); } /* @@ -561,6 +563,8 @@ bpf_detachd(struct bpf_d *d) BPFD_UNLOCK(d); BPFIF_UNLOCK(bp); + EVENTHANDLER_INVOKE(bpf_track, ifp, 0); + /* * Check if this descriptor had requested promiscuous mode. * If so, turn it off. diff --git a/sys/sys/eventhandler.h b/sys/sys/eventhandler.h index 5013fe8..de787af 100644 --- a/sys/sys/eventhandler.h +++ b/sys/sys/eventhandler.h @@ -182,6 +182,11 @@ typedef void (*vlan_unconfig_fn)(void *, struct ifnet *, uint16_t); EVENTHANDLER_DECLARE(vlan_config, vlan_config_fn); EVENTHANDLER_DECLARE(vlan_unconfig, vlan_unconfig_fn); +/* BPF attach/detach events */ +struct ifnet; +typedef void (*bpf_track_fn)(void *, struct ifnet *, int /* 1 =>'s attach */); +EVENTHANDLER_DECLARE(bpf_track, bpf_track_fn); + /* * Process events * process_fork and exit handlers are called without Giant. |