diff options
| author | Gleb Smirnoff <glebius@FreeBSD.org> | 2025-12-18 16:46:20 +0000 |
|---|---|---|
| committer | Gleb Smirnoff <glebius@FreeBSD.org> | 2025-12-18 16:46:20 +0000 |
| commit | a4d766caf7114392b80793c8306d5a712f31557c (patch) | |
| tree | f5a1331f928460843153a40f07f4f3eb62d30e1f /sys/net | |
| parent | 4f809ffec69cd6ede3e7be9a5bc876b2e5931028 (diff) | |
Diffstat (limited to 'sys/net')
| -rw-r--r-- | sys/net/bpf.c | 16 | ||||
| -rw-r--r-- | sys/net/bpf.h | 1 | ||||
| -rw-r--r-- | sys/net/if.c | 1 |
3 files changed, 18 insertions, 0 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 54da49f3d656..9f0b57728e88 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -2722,6 +2722,22 @@ bpf_detach(struct bpf_if *bp) BPF_UNLOCK(); } +#ifdef VIMAGE +/* + * Move bpf to a different VNET. This KPI is a crutch to support if_vmove + * and is not supposed to be used anywhere else. + */ +void +bpf_vmove(struct bpf_if *bp) +{ + + BPF_LOCK(); + LIST_REMOVE(bp, bif_next); + LIST_INSERT_HEAD(&V_bpf_iflist, bp, bif_next); + BPF_UNLOCK(); +} +#endif + bool bpf_peers_present_if(struct ifnet *ifp) { diff --git a/sys/net/bpf.h b/sys/net/bpf.h index f6bcb0e34ed4..6d2ecd985225 100644 --- a/sys/net/bpf.h +++ b/sys/net/bpf.h @@ -425,6 +425,7 @@ CK_LIST_HEAD(bpfd_list, bpf_d); struct bpf_if * bpf_attach(const char *, u_int, u_int, const struct bif_methods *, void *); void bpf_detach(struct bpf_if *); +void bpf_vmove(struct bpf_if *bp); 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/if.c b/sys/net/if.c index f5006781541c..d7c6b22821e2 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1285,6 +1285,7 @@ if_vmove(struct ifnet *ifp, struct vnet *new_vnet) */ CURVNET_SET_QUIET(new_vnet); if_attach_internal(ifp, true); + bpf_vmove(ifp->if_bpf); CURVNET_RESTORE(); } |
