diff options
Diffstat (limited to 'meta-google/recipes-google/networking/gbmc-bridge')
3 files changed, 17 insertions, 8 deletions
diff --git a/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-from-ra.sh b/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-from-ra.sh index 9a5586b8a..18341fefb 100644 --- a/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-from-ra.sh +++ b/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-from-ra.sh @@ -27,7 +27,7 @@ gbmc_br_from_ra_update() { local pfx for pfx in "${!gbmc_br_from_ra_pfxs[@]}"; do local cidr - if ! cidr="$(ipv6_pfx_to_cidr "$pfx")"; then + if ! cidr="$(ip_pfx_to_cidr "$pfx")"; then unset 'gbmc_br_from_ra_pfxs[$pfx]' continue fi @@ -38,8 +38,12 @@ gbmc_br_from_ra_update() { continue fi local addr - addr="$(ipv6_pfx_concat "$pfx" "$sfx")" + if ! addr="$(ip_pfx_concat "$pfx" "$sfx")"; then + unset 'gbmc_br_from_ra_pfxs[$pfx]' + continue + fi else + unset 'gbmc_br_from_ra_pfxs[$pfx]' continue fi local valid="${gbmc_br_from_ra_pfxs["$pfx"]}" diff --git a/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-nft.sh b/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-nft.sh index 185d78b81..19b8f64a1 100644 --- a/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-nft.sh +++ b/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-nft.sh @@ -56,10 +56,14 @@ gbmc_br_nft_hook() { echo "gBMC Bridge NFT Invalid IP: $ip" >&2 return 1 fi - if (( ip_bytes[9] != 0xfd )); then + if (( ip_bytes[8] != 0xfd )); then return 0 fi - pfx="$(printf '%02x%02x:%02x%02x:%02x%02x:%02x%02x:fd00::/72' "${ip_bytes[@]}")" + local i + for (( i=9; i<16; i++ )); do + ip_bytes[$i]=0 + done + pfx="$(ip_bytes_to_str ip_bytes)/72" if [ "$action" = "add" -a "$pfx" != "$gbmc_br_nft_pfx" ]; then gbmc_br_nft_pfx="$pfx" gbmc_br_nft_update diff --git a/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-ula.sh b/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-ula.sh index ac273a395..69897100e 100644 --- a/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-ula.sh +++ b/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-ula.sh @@ -27,10 +27,11 @@ gbmc_br_ula_update() { local addr= contents='[Network]'$'\n' if [ -n "$gbmc_br_ula_mac" ]; then - local eui64 - eui64="$(mac_to_eui64 "$mac")" || return - addr="fdb5:0481:10ce:0:$eui64/64" - contents+="Address=$addr"$'\n' + local sfx + if sfx="$(mac_to_eui64 "$gbmc_br_ula_mac")" && + addr="$(ip_pfx_concat "fdb5:0481:10ce::/64" "$sfx")"; then + contents+="Address=$addr"$'\n' + fi fi local netfile |