From 82fcc31e626b4c7a883d0ed4fd568f8b730c0f11 Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Wed, 4 Jul 2018 02:36:09 +0300 Subject: [PATCH] Use MAC from EEPROM for Interfaces (#329) * Use MAC from EEPROM for Interfaces Signed-off-by: Andriy Moroz * Use platform MAC from DB Signed-off-by: Andriy Moroz --- syncd/scripts/syncd_init_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syncd/scripts/syncd_init_common.sh b/syncd/scripts/syncd_init_common.sh index 75056abbc..37eb1916e 100755 --- a/syncd/scripts/syncd_init_common.sh +++ b/syncd/scripts/syncd_init_common.sh @@ -54,7 +54,7 @@ config_syncd_mlnx() [ -e /dev/sxdevs/sxcdev ] || ( mkdir -p /dev/sxdevs && mknod /dev/sxdevs/sxcdev c 231 193 ) # Read MAC address and align the last 6 bits. - MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') + MAC_ADDRESS=$(sonic-cfggen -d -v DEVICE_METADATA.localhost.mac) last_byte=$(python -c "print '$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 ALIGNED_MAC_ADDRESS=$(python -c "print '$MAC_ADDRESS'[:-2] + '$aligned_last_byte'") # put aligned byte into the end of MAC