linux brige中mac地址的比较

1 static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2)
2 {
3     const u16 *a = (const u16 *) addr1;
4     const u16 *b = (const u16 *) addr2;
5 
6     BUILD_BUG_ON(ETH_ALEN != 6);
7     return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0;
8 }

这里直接转换成了3个ushort类型,然后对比

原文地址:https://www.cnblogs.com/souroot/p/4280862.html