New function to test for multicast addresses that must not be forwarded.
authorBen Pfaff <blp@nicira.com>
Mon, 5 Jan 2009 23:59:40 +0000 (15:59 -0800)
committerBen Pfaff <blp@nicira.com>
Mon, 5 Jan 2009 23:59:40 +0000 (15:59 -0800)
lib/packets.h

index adda6bdd6a568e3557630337bb8be8eeda418881..7f6bd42f6074e72637a4ab856dedbb0a811a11f1 100644 (file)
@@ -89,6 +89,17 @@ static inline void eth_addr_random(uint8_t ea[ETH_ADDR_LEN])
     ea[0] &= ~1;                /* Unicast. */
     ea[0] |= 2;                 /* Private. */
 }
+/* Returns true if 'ea' is a reserved multicast address, that a bridge must
+ * never forward, false otherwise. */
+static inline bool eth_addr_is_reserved(const uint8_t ea[ETH_ADDR_LEN])
+{
+    return (ea[0] == 0x01
+            && ea[1] == 0x80
+            && ea[2] == 0xc2
+            && ea[3] == 0x00
+            && ea[4] == 0x00
+            && (ea[5] & 0xf0) == 0x00);
+}
 
 #define ETH_ADDR_FMT                                                    \
     "%02"PRIx8":%02"PRIx8":%02"PRIx8":%02"PRIx8":%02"PRIx8":%02"PRIx8