diff options
author | Kristof Provost <kp@FreeBSD.org> | 2017-08-16 19:40:07 +0000 |
---|---|---|
committer | Kristof Provost <kp@FreeBSD.org> | 2017-08-16 19:40:07 +0000 |
commit | 9ce40d321dd561ab74fad5881985fd23bb5b3c21 (patch) | |
tree | 0c6375cee16d59d626116551b49282a4ef629335 /sys/net/bpf.c | |
parent | f8de17a11fc77b8d6f5b20216d184c47c815233e (diff) | |
download | src-test2-9ce40d321dd561ab74fad5881985fd23bb5b3c21.tar.gz src-test2-9ce40d321dd561ab74fad5881985fd23bb5b3c21.zip |
Notes
Diffstat (limited to 'sys/net/bpf.c')
-rw-r--r-- | sys/net/bpf.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 2dca1b444a45..b176856cf352 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -106,6 +106,7 @@ struct bpf_if { struct rwlock bif_lock; /* interface lock */ LIST_HEAD(, bpf_d) bif_wlist; /* writer-only list */ int bif_flags; /* Interface flags */ + struct bpf_if **bif_bpf; /* Pointer to pointer to us */ }; CTASSERT(offsetof(struct bpf_if, bif_ext) == 0); @@ -2563,6 +2564,7 @@ bpfattach2(struct ifnet *ifp, u_int dlt, u_int hdrlen, struct bpf_if **driverp) bp->bif_dlt = dlt; rw_init(&bp->bif_lock, "bpf interface lock"); KASSERT(*driverp == NULL, ("bpfattach2: driverp already initialized")); + bp->bif_bpf = driverp; *driverp = bp; BPF_LOCK(); @@ -2633,6 +2635,7 @@ bpfdetach(struct ifnet *ifp) */ BPFIF_WLOCK(bp); bp->bif_flags |= BPFIF_FLAG_DYING; + *bp->bif_bpf = NULL; BPFIF_WUNLOCK(bp); CTR4(KTR_NET, "%s: sheduling free for encap %d (%p) for if %p", @@ -2702,13 +2705,6 @@ bpf_ifdetach(void *arg __unused, struct ifnet *ifp) nmatched++; } BPF_UNLOCK(); - - /* - * Note that we cannot zero other pointers to - * custom DLTs possibly used by given interface. - */ - if (nmatched != 0) - ifp->if_bpf = NULL; } /* |