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>
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 5d6411d..b392176 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 @@
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 a08935a..d0445d3 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 @@
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)"