bpf: add a crutch to support if_vmove

Fixes:	0bf42a0a05
This commit is contained in:
Gleb Smirnoff
2025-12-18 08:46:20 -08:00
parent 4f809ffec6
commit a4d766caf7
3 changed files with 18 additions and 0 deletions
+16
View File
@@ -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)
{
+1
View File
@@ -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);
+1
View File
@@ -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();
}