From 0ad886d6243d1cf43dd9f03796d835970a5b047c Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sun, 19 Nov 2017 12:07:30 +0000 Subject: [PATCH] [baseimage]: fix mac address calculation on mellanox and centec platform --- files/image_config/platform/rc.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index f4dd9cb3ad78..c7915db9eb7c 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -84,7 +84,7 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then SYSTEM_MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') # Align last byte of MAC if necessary - if [ "$SONIC_ASIC_TYPE" == "mellanox" -o "$SONIC_ASIC_TYPE" == "centec" ]; then + if [ "$SONIC_ASIC_TYPE" = "mellanox" ] || [ "$SONIC_ASIC_TYPE" = "centec" ]; then last_byte=$(python -c "print '$SYSTEM_MAC_ADDRESS'[-2:]") aligned_last_byte=$(python -c "print format(int(int('$last_byte', 16) & 0b11000000), '02x')") # put mask and take away the 0x prefix SYSTEM_MAC_ADDRESS=$(python -c "print '$SYSTEM_MAC_ADDRESS'[:-2] + '$aligned_last_byte'") # put aligned byte into the end of MAC