]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r340073, r341359:
authorkp <kp@FreeBSD.org>
Sat, 9 Mar 2019 10:28:36 +0000 (10:28 +0000)
committerkp <kp@FreeBSD.org>
Sat, 9 Mar 2019 10:28:36 +0000 (10:28 +0000)
commitd78f12a5cc35cf8e4b6ae2e431a32a0b4cc93cbf
treeb4860ea7de5fa70a77732d0fb47406c67fde61e4
parent6a835d50d687b4558325e163283ab11abc7ff08b
MFC r340073, r341359:

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.

pf: Fix panic on overlapping interface names

In rare situations[*] it's possible for two different interfaces to have
the same name. This confuses pf, because kifs are indexed by name (which
is assumed to be unique). As a result we can end up trying to
if_rele(NULL), which panics.

Explicitly checking the ifp pointer before if_rele() prevents the panic.
Note pf will likely behave in unexpected ways on the the overlapping
interfaces.

[*] Insert an interface in a vnet jail. Rename it to an interface which
exists on the host. Remove the jail. There are now two interfaces with
the same name in the host.
sys/netpfil/pf/pf_if.c