diff options
author | William A. Kennington III <wak@google.com> | 2024-02-28 02:42:56 +0300 |
---|---|---|
committer | William A. Kennington III <wak@google.com> | 2024-02-28 03:26:25 +0300 |
commit | 36a6f08bb4a2268ce7bbc672a139fbf582b4b508 (patch) | |
tree | b461a74ac3e42423ffcc322d7bae88a129b02d68 /meta-google/recipes-google | |
parent | d788d9f1187b890cfc8fff2f466adc7d9fdad23b (diff) | |
download | openbmc-36a6f08bb4a2268ce7bbc672a139fbf582b4b508.tar.xz |
meta-google: Fix bash comparison ordering
We were missing some parenthesis where required by bash to perform
bitwise AND prior to comparing equality.
Change-Id: I9b1c2271f70da053321bea9e42e61ad3160ab3a8
Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'meta-google/recipes-google')
4 files changed, 5 insertions, 5 deletions
diff --git a/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-deprecated-ips.sh.in b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-deprecated-ips.sh.in index 5d6411d1c4..b392176483 100644 --- a/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-deprecated-ips.sh.in +++ b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-deprecated-ips.sh.in @@ -116,11 +116,11 @@ gbmc_ncsi_br_deprecated_ips_hook() { local pfx_bytes=() ip_to_bytes pfx_bytes "$ip" || return # No ULA Addresses - if (( pfx_bytes[0] & 0xfe == 0xfc )); then + if (( (pfx_bytes[0] & 0xfe) == 0xfc )); then return fi # We only want to allow a <pfx>::fd0x address, where x>0 - if (( pfx_bytes[8] != 0xfd || pfx_bytes[9] & 0xf == 0 )); then + if (( pfx_bytes[8] != 0xfd || (pfx_bytes[9] & 0xf) == 0 )); then return fi for (( i = 10; i < 16; ++i )); do diff --git a/meta-google/recipes-google/ncsi/files/gbmc-ncsi-ip-from-ra.sh.in b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-ip-from-ra.sh.in index a08935ae84..d0445d3c94 100755 --- a/meta-google/recipes-google/ncsi/files/gbmc-ncsi-ip-from-ra.sh.in +++ b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-ip-from-ra.sh.in @@ -69,7 +69,7 @@ while true; do t_pfx="${BASH_REMATCH[1]}" t_pfx_len="${BASH_REMATCH[2]}" ip_to_bytes t_pfx_b "$t_pfx" || continue - (( t_pfx_len == 76 && t_pfx_b[8] & 0xfd == 0xfd )) || continue + (( t_pfx_len == 76 && (t_pfx_b[8] & 0xfd) == 0xfd )) || continue (( t_pfx_b[9] |= 1 )) hextet="fd$(printf '%02x' "${t_pfx_b[9]}")" pfx="$(ip_bytes_to_str t_pfx_b)" diff --git a/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-dhcp.sh b/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-dhcp.sh index 6557125a9e..4360e11277 100644 --- a/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-dhcp.sh +++ b/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-dhcp.sh @@ -45,7 +45,7 @@ if [ "$1" = bound ]; then pfx_bytes=() ip_to_bytes pfx_bytes "$ipv6" # Ensure we are a BMC and have a suffix nibble, the 0th index is reserved - if (( pfx_bytes[8] != 0xfd || pfx_bytes[9] & 0xf == 0 )); then + if (( pfx_bytes[8] != 0xfd || (pfx_bytes[9] & 0xf) == 0 )); then echo "Invalid address" >&2 exit 1 fi diff --git a/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-gw-src.sh b/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-gw-src.sh index dbf215794a..3c57b66af3 100644 --- a/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-gw-src.sh +++ b/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-gw-src.sh @@ -97,7 +97,7 @@ gbmc_br_gw_src_hook() { if (( (ip_bytes[0] & 0xfe) == 0xfc || ip_bytes[8] != 0xfd )); then return 0 fi - if (( (ip_bytes[9] & 0x0f) != 0 )); then + if (( (ip_bytes[9] & 0xf) != 0 )); then local -n gbmc_br_gw_src_ip=gbmc_br_gw_src_ip_stateful else local -n gbmc_br_gw_src_ip=gbmc_br_gw_src_ip_stateless |