diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 27eb43e74bf2370b0c815d6da3a2c8db8aefae47..6f14763e70996699c4f7fcab17aad73b4c4eac02 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1326,6 +1326,7 @@ virMacAddrCompare; virMacAddrFormat; virMacAddrGenerate; virMacAddrGetRaw; +virMacAddrIsBroadcastRaw; virMacAddrIsMulticast; virMacAddrIsUnicast; virMacAddrParse; diff --git a/src/util/virmacaddr.c b/src/util/virmacaddr.c index e20792711299cd3c5b92a7e1584486e47daea63d..671ba98d5204d4ac02ee3c0516d7135ad0be1573 100644 --- a/src/util/virmacaddr.c +++ b/src/util/virmacaddr.c @@ -30,6 +30,9 @@ #include "virmacaddr.h" #include "virrandom.h" +static const unsigned char virMacAddrBroadcastAddrRaw[VIR_MAC_BUFLEN] = + { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + /* Compare two MAC addresses, ignoring differences in case, * as well as leading zeros. */ @@ -218,3 +221,9 @@ virMacAddrIsUnicast(const virMacAddrPtr mac) { return !(mac->addr[0] & 1); } + +bool +virMacAddrIsBroadcastRaw(const unsigned char s[VIR_MAC_BUFLEN]) +{ + return memcmp(virMacAddrBroadcastAddrRaw, s, sizeof(*s)) == 0; +} diff --git a/src/util/virmacaddr.h b/src/util/virmacaddr.h index 4c5074ce3c60dc007bd21839437560a6e66d7b3b..1a2ff74da0aec3aade92b66d9c73c79e03266f8b 100644 --- a/src/util/virmacaddr.h +++ b/src/util/virmacaddr.h @@ -52,4 +52,6 @@ int virMacAddrParse(const char* str, virMacAddrPtr addr) ATTRIBUTE_RETURN_CHECK; bool virMacAddrIsUnicast(const virMacAddrPtr addr); bool virMacAddrIsMulticast(const virMacAddrPtr addr); +bool virMacAddrIsBroadcastRaw(const unsigned char s[VIR_MAC_BUFLEN]); + #endif /* __VIR_MACADDR_H__ */