diff options
author | William A. Kennington III <wak@google.com> | 2022-03-01 12:08:28 +0300 |
---|---|---|
committer | William A. Kennington III <wak@google.com> | 2022-03-07 20:52:55 +0300 |
commit | 91da5203e3d406de0f8ddfb86dd99ef79959de3d (patch) | |
tree | 91d1932196753dd4c28d1e02722ccbfdd9f9185f /meta-google/recipes-google/networking | |
parent | d21bfcaac24fb225c33ace6828b3d81db89c9874 (diff) | |
download | openbmc-91da5203e3d406de0f8ddfb86dd99ef79959de3d.tar.xz |
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 <wak@google.com>
Diffstat (limited to 'meta-google/recipes-google/networking')
-rw-r--r-- | meta-google/recipes-google/networking/files/gbmc-mac-config.sh.in | 11 | ||||
-rw-r--r-- | meta-google/recipes-google/networking/gbmc-mac-config.bb | 2 |
2 files changed, 6 insertions, 7 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 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<num; i++ )); do - intf="${num_to_if[$i]}" - if [ -n "$intf" ]; then + for intf in ${num_to_intfs[$i]}; do macstr=$(printf '%02x:%02x:%02x:%02x:%02x:%02x' "${mac[@]}") echo "Setting $intf to $macstr" >&2 for override in /run/systemd/network/{00,}-bmc-$intf.network.d; do @@ -71,7 +70,7 @@ for (( i=0; i<num; i++ )); do mkdir -p "$override" printf '[NetDev]\nMACAddress=%s\n' "$macstr" >"$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} |