From 7c5f8839ec3d71a2170b8f3514a16a67c69d1c7c Mon Sep 17 00:00:00 2001 From: "Jason M. Bills" Date: Wed, 27 Jan 2021 11:47:14 -0800 Subject: Update to internal 0.29 Signed-off-by: Jason M. Bills --- .../network/static-mac-addr/mac-check | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check') diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check b/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check index 7e81ad63a..2578785b4 100644 --- a/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check +++ b/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check @@ -18,7 +18,7 @@ SOFS_MACDIR=${SOFS_MNT}/factory-settings/network/mac read_hw_mac() { local iface="$1" - cat /sys/class/net/"$iface"/address 2>/dev/null + cat /sys/class/net/"$iface"/address 2>/dev/null | tr [:upper:] [:lower:] 2>/dev/null } set_hw_mac() { @@ -33,12 +33,12 @@ set_hw_mac() { read_sofs_mac() { local iface="$1" - cat "${SOFS_MACDIR}/${iface}" 2>/dev/null + cat "${SOFS_MACDIR}/${iface}" 2>/dev/null | tr [:upper:] [:lower:] 2>/dev/null } read_fw_env_mac() { local envname="$1" - fw_printenv "$envname" 2>/dev/null | sed "s/^$envname=//" + fw_printenv "$envname" 2>/dev/null | sed "s/^$envname=//" 2>/dev/null | tr [:upper:] [:lower:] 2>/dev/null } set_fw_env_mac() { @@ -97,10 +97,16 @@ error=0 first_error_seen=0 while read IFACE UBDEV; do - mac_check "$IFACE" "$UBDEV" - error=$? - if [ $error -ne 0 ] && [ $first_error_seen -eq 0 ]; then - first_error_seen=$error + # Try to configure the MAC address if the kernel finds the NIC. Blindly + # trying all of the interfaces listed in the DOCSTRING (END_CONF) below + # may result in first_error_seen being set to a non-zero value. If that + # happens the journal log will report the error, which is undesirable. + if [ -h /sys/class/net/$IFACE ]; then + mac_check "$IFACE" "$UBDEV" + error=$? + if [ $error -ne 0 ] && [ $first_error_seen -eq 0 ]; then + first_error_seen=$error + fi fi done <<-END_CONF eth0 eth1addr -- cgit v1.2.3