add bpf_track eventhandler for monitoring bpf taps attached/detached

Reviewed by:	csjp
This commit is contained in:
Sam Leffler 2009-05-18 17:18:40 +00:00
parent 715238635d
commit b743c31009
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=192313
2 changed files with 9 additions and 0 deletions

View File

@ -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.

View File

@ -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.