diff options
author | kp <kp@FreeBSD.org> | 2016-03-30 18:45:18 +0000 |
---|---|---|
committer | kp <kp@FreeBSD.org> | 2016-03-30 18:45:18 +0000 |
commit | 93dab7adee59aeaf658465bfe685c35454611b28 (patch) | |
tree | 22192bd29a0be1f77ff0df57dff20306f1ba6018 /sys/netpfil | |
parent | f08e8e5dd415880269fb4ce4cb2fd7bccefe336d (diff) | |
download | FreeBSD-src-93dab7adee59aeaf658465bfe685c35454611b28.zip FreeBSD-src-93dab7adee59aeaf658465bfe685c35454611b28.tar.gz |
MFC 296932:
pf: Improve forwarding detection
When we guess the nature of the outbound packet (output vs. forwarding) we need
to take bridges into account. When bridging the input interface does not match
the output interface, but we're not forwarding. Similarly, it's possible for the
interface to actually be the bridge interface itself (and not a member interface).
Diffstat (limited to 'sys/netpfil')
-rw-r--r-- | sys/netpfil/pf/pf.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 48da880..36a7be4 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -6145,11 +6145,13 @@ pf_test6(int dir, struct ifnet *ifp, struct mbuf **m0, struct inpcb *inp) * We do need to be careful about bridges. If the * net.link.bridge.pfil_bridge sysctl is set we can be filtering on a * bridge, so if the input interface is a bridge member and the output - * interface is its bridge we're not actually forwarding but bridging. + * interface is its bridge or a member of the same bridge we're not + * actually forwarding but bridging. */ - if (dir == PF_OUT && m->m_pkthdr.rcvif && ifp != m->m_pkthdr.rcvif - && (m->m_pkthdr.rcvif->if_bridge == NULL - || m->m_pkthdr.rcvif->if_bridge != ifp->if_softc)) + if (dir == PF_OUT && m->m_pkthdr.rcvif && ifp != m->m_pkthdr.rcvif && + (m->m_pkthdr.rcvif->if_bridge == NULL || + (m->m_pkthdr.rcvif->if_bridge != ifp->if_softc && + m->m_pkthdr.rcvif->if_bridge != ifp->if_bridge))) fwdir = PF_FWD; if (!V_pf_status.running) |