MCPcopy Create free account
hub / github.com/F-Stack/f-stack / bpfdetach

Function bpfdetach

freebsd/net/bpf.c:2745–2776  ·  view source on GitHub ↗

* Detach bpf from an interface. This involves detaching each descriptor * associated with the interface. Notify each descriptor as it's detached * so that any sleepers wake up and get ENXIO. */

Source from the content-addressed store, hash-verified

2743 * so that any sleepers wake up and get ENXIO.
2744 */
2745void
2746bpfdetach(struct ifnet *ifp)
2747{
2748 struct bpf_if *bp, *bp_temp;
2749 struct bpf_d *d;
2750
2751 BPF_LOCK();
2752 /* Find all bpf_if struct's which reference ifp and detach them. */
2753 CK_LIST_FOREACH_SAFE(bp, &bpf_iflist, bif_next, bp_temp) {
2754 if (ifp != bp->bif_ifp)
2755 continue;
2756
2757 CK_LIST_REMOVE(bp, bif_next);
2758 *bp->bif_bpf = (struct bpf_if *)&dead_bpf_if;
2759
2760 CTR4(KTR_NET,
2761 "%s: sheduling free for encap %d (%p) for if %p",
2762 __func__, bp->bif_dlt, bp, ifp);
2763
2764 /* Detach common descriptors */
2765 while ((d = CK_LIST_FIRST(&bp->bif_dlist)) != NULL) {
2766 bpf_detachd_locked(d, true);
2767 }
2768
2769 /* Detach writer-only descriptors */
2770 while ((d = CK_LIST_FIRST(&bp->bif_wlist)) != NULL) {
2771 bpf_detachd_locked(d, true);
2772 }
2773 bpfif_rele(bp);
2774 }
2775 BPF_UNLOCK();
2776}
2777
2778/*
2779 * Get a list of available data link type of the interface.

Callers 15

pflog_clone_destroyFunction · 0.85
pfsync_clone_destroyFunction · 0.85
ipfw_clone_destroyFunction · 0.85
ipfw_clone_createFunction · 0.85
ipfwlog_clone_createFunction · 0.85
iflib_pseudo_deregisterFunction · 0.85
stf_clone_destroyFunction · 0.85
gre_clone_destroyFunction · 0.85
ether_ifdetachFunction · 0.85
firewire_ifdetachFunction · 0.85
enc_clone_destroyFunction · 0.85
me_clone_destroyFunction · 0.85

Calls 2

bpf_detachd_lockedFunction · 0.85
bpfif_releFunction · 0.85

Tested by

no test coverage detected