diff options
author | joerg <joerg@FreeBSD.org> | 2004-06-24 12:31:44 +0000 |
---|---|---|
committer | joerg <joerg@FreeBSD.org> | 2004-06-24 12:31:44 +0000 |
commit | f7a4300d05c1c525586e63fe8474f5d0d4ecfe64 (patch) | |
tree | 5fa6e3b74b8fd2c6743406a224b96c7e3eb38297 /sys | |
parent | 383d0b372c87c375f739406f916f19b16d55c0c6 (diff) | |
download | FreeBSD-src-f7a4300d05c1c525586e63fe8474f5d0d4ecfe64.zip FreeBSD-src-f7a4300d05c1c525586e63fe8474f5d0d4ecfe64.tar.gz |
When considering an ethernet frame that is not destined for us, do not
only allow this to be further processed when bridging is active on
that interface, but also if the current packet has a VLAN tag and
VLANs are active on our interface. This gives the VLAN layers a
chance to also consider the packet (and perhaps drop it instead of the
main dispatcher).
This fixes a situation where bridging was only active on VLAN
interfaces but ether_demux() called on behalf of the main interface
had already thrown the packet away.
MFC after: 4 weeks
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/if_ethersubr.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index c5685bc..85cc240 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -639,18 +639,26 @@ ether_demux(struct ifnet *ifp, struct mbuf *m) KASSERT(ifp != NULL, ("ether_demux: NULL interface pointer")); eh = mtod(m, struct ether_header *); + ether_type = ntohs(eh->ether_type); #if defined(INET) || defined(INET6) if (rule) /* packet was already bridged */ goto post_stats; #endif - if (!(BDG_ACTIVE(ifp))) { + if (!(BDG_ACTIVE(ifp)) && + !(ether_type == ETHERTYPE_VLAN && ifp->if_nvlans > 0)) { /* * Discard packet if upper layers shouldn't see it because it * was unicast to a different Ethernet address. If the driver * is working properly, then this situation can only happen * when the interface is in promiscuous mode. + * + * If VLANs are active, and this packet has a VLAN tag, do + * not drop it here but pass it on to the VLAN layer, to + * give them a chance to consider it as well (e. g. in case + * bridging is only active on a VLAN). They will drop it if + * it's undesired. */ if ((ifp->if_flags & IFF_PROMISC) != 0 && (eh->ether_dhost[0] & 1) == 0 @@ -704,8 +712,6 @@ post_stats: return; } - ether_type = ntohs(eh->ether_type); - /* * Handle protocols that expect to have the Ethernet header * (and possibly FCS) intact. |