summaryrefslogtreecommitdiff
path: root/meta-google
diff options
context:
space:
mode:
authorKyle Nieman <kyle.nieman@fii-na.com>2023-05-30 18:56:46 +0300
committerWilliam A. Kennington III <wak@google.com>2023-05-31 23:40:26 +0300
commitcabc5aa43856c57778cb07a05b24952463ae4fc1 (patch)
treea89b16725d428ae8ce8414928f293b7520aa5131 /meta-google
parent108bc12b57eba2dc7d2f261d96c0e4f9ec9333e0 (diff)
downloadopenbmc-cabc5aa43856c57778cb07a05b24952463ae4fc1.tar.xz
meta-google: gbmc-mac-config: Fix setting MAC address
The gbmc-mac-config service is used to change the address to match the value stored in the FRU by creating a config file for the interface. However in commit 93433c165b38b1bbce6a679e43cf0188311551be of phosphor-networkd, the default files for the interfaces are consolidated into a single file for creating them. As a result, the config generated by the service for eth1 isn't applied, and the randomly generated MAC is used to obtain an IP address. Eventually, all IP addresses are allocated to the randomly generated MAC addresses, and the unit is unable to get a valid IP address. The MAC address is now set using a different method. Tested: Offline flashed a unit without the changes. Checked that MAC address didn't match what is stored in the FRU. Flashed with the changes and verified the MAC address matched the FRU. Change-Id: Iaca14e86c93b5392def60d666b8b1aa6b03fd716 Signed-off-by: Kyle Nieman <kyle.nieman@fii-na.com>
Diffstat (limited to 'meta-google')
-rw-r--r--meta-google/recipes-google/networking/files/gbmc-mac-config.sh.in7
1 files changed, 7 insertions, 0 deletions
diff --git a/meta-google/recipes-google/networking/files/gbmc-mac-config.sh.in b/meta-google/recipes-google/networking/files/gbmc-mac-config.sh.in
index 398445e822..0466d0d2cd 100644
--- a/meta-google/recipes-google/networking/files/gbmc-mac-config.sh.in
+++ b/meta-google/recipes-google/networking/files/gbmc-mac-config.sh.in
@@ -75,6 +75,13 @@ for (( i=0; i<num; i++ )); do
mkdir -p "$override"
printf '[NetDev]\nMACAddress=%s\n' "$macstr" >"$override"/50-mac.conf
done
+ # In case we don't have any interface configs, set the MAC directly
+ # This is safe to apply, as systemd-networkd will always override this
+ # value based on written configs.
+ if ip link show $intf >/dev/null 2>&1 && \
+ ! ip link set dev $intf address $macstr; then
+ echo "Setting MAC($macstr) on $intf failed" >&2
+ fi
done
(( ++mac[5] ))
done