aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJon Loeliger <jdl@netgate.com>2020-03-09 13:13:35 -0500
committerAndrew Yourtchenko <ayourtch@gmail.com>2020-08-13 10:39:40 +0000
commit8c6b575634d42be734a1c47abf9cecfc59f6a429 (patch)
treeca3bcfe38314dc65af80343f89299303089872d1 /src
parent0088c6875fb6b0f3c8824ff66a1a47dc184e3ac1 (diff)
ethernet: Copy only 6 bytes of mac address into a u64
Rather than leaving 2 bytes of junk in the upper word of a mac address represented as a u64, zero them out. That way later compairsons stand a chance of matching when deleting a bridge's arp termination entries. The volatile qualifier shouldn't be needed here, but without it the compiler removes the clib_memcpy() at -O2. Bad compiler. No biscuit. Type: fix commit: faf22cb303b65e2a6bf8dad959d7f5ee6d031c4f Change-Id: Iebcf35fdd421293dccbcaefadef767f7e139438e Signed-off-by: Jon Loeliger <jdl@netgate.com> (cherry picked from commit 6a32ce326495bfe48ebef74dfbb8a9c1cf37a530)
Diffstat (limited to 'src')
-rw-r--r--src/vnet/ethernet/mac_address.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/vnet/ethernet/mac_address.h b/src/vnet/ethernet/mac_address.h
index 01fb76e002b..046e1cc7245 100644
--- a/src/vnet/ethernet/mac_address.h
+++ b/src/vnet/ethernet/mac_address.h
@@ -111,11 +111,11 @@ mac_address_is_zero (const mac_address_t * mac)
static_always_inline u64
mac_address_as_u64 (const mac_address_t * mac)
{
- u64 *as_u64;
+ volatile u64 as_u64 = 0;
- as_u64 = (u64 *) mac->bytes;
+ clib_memcpy ((void *) &as_u64, mac->bytes, 6);
- return (*as_u64);
+ return as_u64;
}
static_always_inline void