From 706fca8a5bab377569046ad1aa7ddfee5b96fa1a Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 5 Jan 2009 15:59:40 -0800 Subject: [PATCH] New function to test for multicast addresses that must not be forwarded. --- lib/packets.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/packets.h b/lib/packets.h index adda6bdd..7f6bd42f 100644 --- a/lib/packets.h +++ b/lib/packets.h @@ -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 -- 2.30.2