diff options
-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 |