Page MenuHomeFreeBSD

D58734.id.diff
No OneTemporary

D58734.id.diff

diff --git a/sys/net/bpf.h b/sys/net/bpf.h
--- a/sys/net/bpf.h
+++ b/sys/net/bpf.h
@@ -426,6 +426,7 @@
const struct bif_methods *, void *);
void bpf_detach(struct bpf_if *);
void bpf_vmove(struct bpf_if *bp);
+struct bpf_if * bpf_dead_if(void);
void bpf_bufheld(struct bpf_d *d);
int bpf_validate(const struct bpf_insn *, int);
void bpf_tap(struct bpf_if *, u_char *, u_int);
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -2724,6 +2724,15 @@
BPF_UNLOCK();
}
+static const struct bpfd_list bpf_dead_if_storage = CK_LIST_HEAD_INITIALIZER();
+
+struct bpf_if *
+bpf_dead_if(void)
+{
+
+ return (__DECONST(struct bpf_if *, &bpf_dead_if_storage));
+}
+
#ifdef VIMAGE
/*
* Move bpf to a different VNET. This KPI is a crutch to support if_vmove
@@ -2733,6 +2742,9 @@
bpf_vmove(struct bpf_if *bp)
{
+ if (bp == bpf_dead_if())
+ return;
+
BPF_LOCK();
LIST_REMOVE(bp, bif_next);
LIST_INSERT_HEAD(&V_bpf_iflist, bp, bif_next);
diff --git a/sys/net/bpf_ifnet.c b/sys/net/bpf_ifnet.c
--- a/sys/net/bpf_ifnet.c
+++ b/sys/net/bpf_ifnet.c
@@ -243,11 +243,10 @@
void
bpfdetach(struct ifnet *ifp)
{
- static const struct bpfd_list dead_bpf_if = CK_LIST_HEAD_INITIALIZER();
struct bpf_if *bif;
bif = ifp->if_bpf;
- ifp->if_bpf = __DECONST(struct bpf_if *, &dead_bpf_if);
+ ifp->if_bpf = bpf_dead_if();
bpf_detach(bif);
if_rele(ifp);
}

File Metadata

Mime Type
text/plain
Expires
Sat, Aug 22, 11:16 AM (5 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37064623
Default Alt Text
D58734.id.diff (1 KB)

Event Timeline