summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check')
-rw-r--r--meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check20
1 files changed, 13 insertions, 7 deletions
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