do not forward 802.1D reserved addresses in bridge(4)

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Paul de Weerd
Date: Thursday, October 28, 2010 - 9:56 am

Currently, our bridge(4) code forwards ethernet frames with
destination MAC address 01:80:C2:00:00:0X, except for X=0 (STP BPDUs).
This is not allowed according to 802.1D-2004, section 7.12.6: these
addresses are reserved (and currently used by eg. LLDP).  In turn,
this causes issues for ports such as net/ladvd.

This will filter out those reserved addresses and not forward them.
Please test and report success or failure directly to me.

Thanks,

Paul 'WEiRD' de Weerd

Index: if_bridge.c
===================================================================
RCS file: /cvs/src/sys/net/if_bridge.c,v
retrieving revision 1.185
diff -u -r1.185 if_bridge.c
--- if_bridge.c	28 Oct 2010 13:49:54 -0000	1.185
+++ if_bridge.c	28 Oct 2010 16:12:36 -0000
@@ -1421,10 +1421,23 @@
 	bridge_span(sc, eh, m);
 
 	if (m->m_flags & (M_BCAST | M_MCAST)) {
-		/* Tap off 802.1D packets, they do not get forwarded */
-		if (bcmp(eh->ether_dhost, bstp_etheraddr, ETHER_ADDR_LEN) == 0) {
-			bstp_input(sc->sc_stp, ifl->bif_stp, eh, m);
-			return (NULL);
+		/*
+	 	 * Reserved destination MAC addresses (01:80:C2:00:00:0x)
+		 * should not be forwarded to bridge members according to
+		 * section 7.12.6 of the 802.1D-2004 specification.  The
+		 * STP destination address (as stored in bstp_etheraddr)
+		 * is the first of these.
+	 	 */
+		if (bcmp(eh->ether_dhost, bstp_etheraddr, ETHER_ADDR_LEN - 1)
+		    == 0) {
+			if (eh->ether_dhost[ETHER_ADDR_LEN - 1] == 0) {
+				/* STP traffic */
+				bstp_input(sc->sc_stp, ifl->bif_stp, eh, m);
+				return (NULL);
+			} else if (eh->ether_dhost[ETHER_ADDR_LEN - 1] <= 0xf) {
+				m_freem(m);
+				return (NULL);
+			}
 		}
 
 		/*

-- 
+++++++++++>-]<.>++[<------------>-]<+.--------------.[-]
                 http://www.undeadly.org
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
do not forward 802.1D reserved addresses in bridge(4), Paul de Weerd, (Thu Oct 28, 9:56 am)