From cf4108e0d43c16302d1def8868943ea6482cb92b Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 31 Mar 2009 14:46:27 -0700 Subject: [PATCH] Be more liberal about what constitutes a virtual interface MAC on Xen. The xapi sources indicate that FE:FE:FE:FE:FE:FE can sometimes be used for virtual interfaces, in addition to the usual FE:FF:FF:FF:FF:FF, so accept that (and other similar variants) as well. --- lib/packets.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/packets.h b/lib/packets.h index 9c7ee9ce..2d1e6d49 100644 --- a/lib/packets.h +++ b/lib/packets.h @@ -44,18 +44,19 @@ static const uint8_t eth_addr_broadcast[ETH_ADDR_LEN] UNUSED = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; -/* This is the Ethernet address used by virtual interfaces under Xen. */ -static const uint8_t eth_addr_vif[ETH_ADDR_LEN] UNUSED - = { 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff }; - static inline bool eth_addr_is_broadcast(const uint8_t ea[6]) { return (ea[0] & ea[1] & ea[2] & ea[3] & ea[4] & ea[5]) == 0xff; } + +/* Returns true if 'ea' is an Ethernet address used for virtual interfaces + * under XenServer. Generally the actual Ethernet address is FE:FF:FF:FF:FF:FF + * but it can be FE:FE:FE:FE:FE:FE in some cases. */ static inline bool eth_addr_is_vif(const uint8_t ea[6]) { - return ea[0] == 0xfe && (ea[1] & ea[2] & ea[3] & ea[4] & ea[5]) == 0xff; + return ea[0] == 0xfe && (ea[1] & ea[2] & ea[3] & ea[4] & ea[5]) >= 0xfe; } + static inline bool eth_addr_is_multicast(const uint8_t ea[6]) { return ea[0] & 1; -- 2.30.2