diff options
author | William A. Kennington III <wak@google.com> | 2023-03-01 05:52:44 +0300 |
---|---|---|
committer | William A. Kennington III <wak@google.com> | 2023-10-12 01:29:07 +0300 |
commit | 02e48708a05ea07cce143bdf0a328546d38bbfef (patch) | |
tree | 1b14a3d40a124ba25e5363134549bc95ef679811 /meta-google/recipes-google | |
parent | 540442835f91f841a6e4d5794b5256cc2449a666 (diff) | |
download | openbmc-02e48708a05ea07cce143bdf0a328546d38bbfef.tar.xz |
meta-google: gbmc-mac-config: Allow rollover MAC assignments
This allows for MAC assignments like `0c:c4:13:4d:d4:ff` of `2`,
where the second address requires a rollover to `0c:c4:13:4d:d5:00`
Change-Id: Ief1489e4f99b27c9af7d4b5f1826dccf36863e0f
Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'meta-google/recipes-google')
-rw-r--r-- | meta-google/recipes-google/networking/files/gbmc-mac-config.sh.in | 8 |
1 files changed, 6 insertions, 2 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 dce4611a46..aaa9920c7c 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 @@ -60,13 +60,17 @@ for key in "${!num_to_intfs[@]}"; do done # Write out each MAC override to the runtime networkd configuration +lower=$(((mac[3] << 16) | (mac[4] << 8) | mac[5])) for (( i=0; i<num; i++ )); do - if (( mac[5] > 0xff )); then + if (( lower > 0xffffff )); then echo "MAC assignment too large: ${mac[*]}" >&2 rc=2 break fi for intf in ${num_to_intfs[$i]}; do + mac[3]=$(((lower >> 16) & 0xff)) + mac[4]=$(((lower >> 8) & 0xff)) + mac[5]=$(((lower >> 0) & 0xff)) 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 @@ -85,7 +89,7 @@ for (( i=0; i<num; i++ )); do echo "Setting MAC($macstr) on $intf failed" >&2 fi done - (( ++mac[5] )) + (( ++lower )) done exit $rc |