pf: be more robust against interface name conflicts

pf assumes that interface names are unique (and share a namespace with
interface group names).
Unfortunately the FreeBSD network stack has a few edge cases where this
assumption can be violated. Try to be more robust against this: rather
than changing the association between a kif and ifp just ignore the next
interface with the same name.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
This commit is contained in:
Kristof Provost
2026-04-20 11:22:13 +02:00
parent 4cdbcc2b6a
commit ff76ec3e9b
+7
View File
@@ -498,8 +498,15 @@ pfi_attach_ifnet(struct ifnet *ifp, struct pfi_kkif *kif)
V_pfi_update++;
kif = pfi_kkif_attach(kif, ifp->if_xname);
if (kif->pfik_ifp != NULL && kif->pfik_ifp != ifp) {
/* Try to not panic later. */
printf("WARNING: pf: duplicate interface name detected: %s\n",
if_name(ifp));
return;
}
if_ref(ifp);
kif->pfik_ifp = ifp;
MPASS(ifp->if_pf_kif == NULL);
ifp->if_pf_kif = kif;
pfi_kkif_update(kif);
}