diff options
author | thompsa <thompsa@FreeBSD.org> | 2007-10-18 21:22:15 +0000 |
---|---|---|
committer | thompsa <thompsa@FreeBSD.org> | 2007-10-18 21:22:15 +0000 |
commit | 8b39a1522c63f12ff9988be210b762ecc4329b2a (patch) | |
tree | 5b7095247627b13df1aa1b8f90b31a0c91b5b994 /sys/net/if_bridge.c | |
parent | efafc844b62072341308ddebfc66a3e112f7a2b9 (diff) | |
download | FreeBSD-src-8b39a1522c63f12ff9988be210b762ecc4329b2a.zip FreeBSD-src-8b39a1522c63f12ff9988be210b762ecc4329b2a.tar.gz |
The bridging output function puts the mbuf directly on the interfaces send
queue so the output network card must support the same tagging mechanism as
how the frame was input (prepended Ethernet header tag or stripped HW mflag).
Now the vlan Ethernet header is _always_ stripped in ether_input and the mbuf
flagged, only only network cards with VLAN_HWTAGGING enabled would properly
re-tag any outgoing vlan frames.
If the outgoing interface does not support hardware tagging then readd the vlan
header to the front of the frame. Move the common vlan encapsulation in to
ether_vlanencap().
Reported by: Erik Osterholm, Jon Otterholm
MFC after: 1 week
Diffstat (limited to 'sys/net/if_bridge.c')
-rw-r--r-- | sys/net/if_bridge.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index e464d96..f29063d 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1653,7 +1653,23 @@ bridge_enqueue(struct bridge_softc *sc, struct ifnet *dst_ifp, struct mbuf *m) for (; m; m = m0) { m0 = m->m_nextpkt; m->m_nextpkt = NULL; - + + /* + * If underlying interface can not do VLAN tag insertion itself + * then attach a packet tag that holds it. + */ + if ((m->m_flags & M_VLANTAG) && + (dst_ifp->if_capenable & IFCAP_VLAN_HWTAGGING) == 0) { + m = ether_vlanencap(m, m->m_pkthdr.ether_vtag); + if (m == NULL) { + if_printf(dst_ifp, + "unable to prepend VLAN header\n"); + dst_ifp->if_oerrors++; + continue; + } + m->m_flags &= ~M_VLANTAG; + } + if (err == 0) IFQ_ENQUEUE(&dst_ifp->if_snd, m, err); } |