pf: Keep a reference to struct ifnets we're using
Ensure that the struct ifnet we use can't go away until we're done with it.
This commit is contained in:
parent
dde6e1fecb
commit
14624ab582
@ -165,8 +165,10 @@ pfi_cleanup_vnet(void)
|
||||
RB_REMOVE(pfi_ifhead, &V_pfi_ifs, kif);
|
||||
if (kif->pfik_group)
|
||||
kif->pfik_group->ifg_pf_kif = NULL;
|
||||
if (kif->pfik_ifp)
|
||||
if (kif->pfik_ifp) {
|
||||
if_rele(kif->pfik_ifp);
|
||||
kif->pfik_ifp->if_pf_kif = NULL;
|
||||
}
|
||||
free(kif, PFI_MTYPE);
|
||||
}
|
||||
|
||||
@ -322,6 +324,8 @@ pfi_attach_ifnet(struct ifnet *ifp)
|
||||
V_pfi_update++;
|
||||
kif = pfi_kif_attach(kif, ifp->if_xname);
|
||||
|
||||
if_ref(ifp);
|
||||
|
||||
kif->pfik_ifp = ifp;
|
||||
ifp->if_pf_kif = kif;
|
||||
|
||||
@ -849,6 +853,8 @@ pfi_detach_ifnet_event(void *arg __unused, struct ifnet *ifp)
|
||||
V_pfi_update++;
|
||||
pfi_kif_update(kif);
|
||||
|
||||
if_rele(kif->pfik_ifp);
|
||||
|
||||
kif->pfik_ifp = NULL;
|
||||
ifp->if_pf_kif = NULL;
|
||||
#ifdef ALTQ
|
||||
|
Loading…
x
Reference in New Issue
Block a user