From 91da5203e3d406de0f8ddfb86dd99ef79959de3d Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Tue, 1 Mar 2022 01:08:28 -0800 Subject: meta-google: gbmc-mac-config: Support same MAC assignment Make it possible to configure two interfaces with identical mac addresses. This can be configured with a line similar to `GBMC_MAC_IF_MAP = "[0]='gbmcbr eth1'"` to assign the same offset 0 mac to gbmcbr and eth1. Change-Id: I33e3edac4c59c5b2338fd3fd58ac655df47ef812 Signed-off-by: William A. Kennington III --- .../recipes-google/networking/files/gbmc-mac-config.sh.in | 11 +++++------ meta-google/recipes-google/networking/gbmc-mac-config.bb | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'meta-google') 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 fa2f4bffe2..d10eb980d4 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 @@ -49,18 +49,17 @@ rc=0 # Pre-Determine if we will miss an allocation due to the number of # addresses the FRU actually supports. -declare -A num_to_if=(@NUM_TO_IF@) -for key in "${!num_to_if[@]}"; do +declare -A num_to_intfs=(@NUM_TO_INTFS@) +for key in "${!num_to_intfs[@]}"; do if (( key >= num )); then - echo "${num_to_if[$key]} at $key is out of range" >&2 + echo "${num_to_intfs[$key]} at $key is out of range" >&2 rc=1 fi done # Write out each MAC override to the runtime networkd configuration for (( i=0; i&2 for override in /run/systemd/network/{00,}-bmc-$intf.network.d; do @@ -71,7 +70,7 @@ for (( i=0; i"$override"/50-mac.conf done - fi + done if (( ++mac[5] > 0xff )); then echo "MAC assignment too large: ${mac[@]}" >&2 rc=2 diff --git a/meta-google/recipes-google/networking/gbmc-mac-config.bb b/meta-google/recipes-google/networking/gbmc-mac-config.bb index 7a3781d1fe..861d0a667c 100644 --- a/meta-google/recipes-google/networking/gbmc-mac-config.bb +++ b/meta-google/recipes-google/networking/gbmc-mac-config.bb @@ -39,7 +39,7 @@ do_install:append() { sed gbmc-mac-config.sh.in \ -e 's#@EEPROM@#${GBMC_MAC_EEPROM_OF_NAME}#' \ - -e 's#@NUM_TO_IF@#${GBMC_MAC_IF_MAP}#' \ + -e "s#@NUM_TO_INTFS@#${GBMC_MAC_IF_MAP}#" \ >gbmc-mac-config.sh install -d -m0755 ${D}${libexecdir} -- cgit v1.2.3