From a22b4458fe6d64b5dcd60e00acaa0ff083f6f056 Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Thu, 4 Nov 2021 22:57:43 -0700 Subject: meta-google: gbmc-bridge: Restrict network from /72 to /76 We can have multiple gBMC networks within one "machine". This allows us to have multiple address sets. Change-Id: I5b18b7822f50bb0570e1aa5a70ac47036694d922 Signed-off-by: William A. Kennington III --- meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in') diff --git a/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in index 961da5095..b04f2aa8f 100644 --- a/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in +++ b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in @@ -56,7 +56,7 @@ ValidLifetimeSec=60 Route=$ncsi_pfx/80 LifetimeSec=60 [Route] -Destination=$stateless_pfx/72 +Destination=$stateless_pfx/76 Type=unreachable Metric=1024 EOF -- cgit v1.2.3 From 031785343fcf91f53857678970db1f3ba4437ce0 Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Thu, 4 Nov 2021 22:49:39 -0700 Subject: meta-google: gbmc-ncsi-config: Remove override if empty Currently this will make no difference in configuration, but it will be useful once we implement our DHCP process and need to contend with multiple configurations. Change-Id: Ia93530e67cdb88fcbe90ef2b6dfbd5a239469ff7 Signed-off-by: William A. Kennington III --- .../recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in') diff --git a/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in index b04f2aa8f..78af419c5 100644 --- a/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in +++ b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in @@ -36,14 +36,14 @@ gbmc_ncsi_br_pub_addr_update() { done fi - local contents='[Network]'$'\n' + local contents= if (( ${#pfx_bytes[@]} != 0 )); then pfx_bytes[8]=0xfd local stateless_pfx="$(ip_bytes_to_str pfx_bytes)" pfx_bytes[9]=0x01 local ncsi_pfx="$(ip_bytes_to_str pfx_bytes)" - local here= - read -r -d '' here <"$file" + if [ -z "$contents" ]; then + rm -f "$file" + else + printf '%s' "$contents" >"$file" + fi done # Ensure that systemd-networkd performs a reconfiguration as it doesn't -- cgit v1.2.3 From cbd9ef029b2134af941a801715cf3b7281d21e95 Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Thu, 4 Nov 2021 20:52:17 -0700 Subject: meta-google: gbmc-ncsi-config: Ignore deprecated addresses We plan to use deprecated addresses to allow for neighbor discovery, but they will be ignored by networkd and this script as to prevent misconfiguration. Change-Id: Ibc0bee71c19add79f05b5ce58b34d3175e2f6fbd Signed-off-by: William A. Kennington III --- meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in | 3 ++- meta-google/recipes-google/ncsi/files/gbmc-ncsi-nft.sh.in | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in') diff --git a/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in index 78af419c5..ce53b8efb 100644 --- a/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in +++ b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in @@ -87,7 +87,8 @@ gbmc_ncsi_br_pub_addr_hook() { gbmc_ncsi_br_pub_addr_init=1 gbmc_ncsi_br_pub_addr_update elif [ "$change" = 'addr' -a "$intf" = '@NCSI_IF@' ] && - [ "$scope" = 'global' -a "$fam" = 'inet6' ]; then + [ "$scope" = 'global' -a "$fam" = 'inet6' ] && + [[ "$flags" != *deprecated* ]]; then if [ "$action" = 'add' -a "$ip" != "$gbmc_ncsi_br_pub_addr_lastip" ]; then gbmc_ncsi_br_pub_addr_lastip="$ip" gbmc_ncsi_br_pub_addr_update diff --git a/meta-google/recipes-google/ncsi/files/gbmc-ncsi-nft.sh.in b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-nft.sh.in index fc8e8198a..7a630f5fe 100644 --- a/meta-google/recipes-google/ncsi/files/gbmc-ncsi-nft.sh.in +++ b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-nft.sh.in @@ -80,7 +80,8 @@ gbmc_ncsi_nft_hook() { if [ "$change" = 'init' ]; then gbmc_ncsi_nft_init=1 gbmc_ncsi_nft_update - elif [ "$change" = 'addr' -a "$intf" = '@NCSI_IF@' -a "$scope" = 'global' ]; then + elif [ "$change" = 'addr' -a "$intf" = '@NCSI_IF@' -a "$scope" = 'global' ] && + [[ "$flags" != *deprecated* ]]; then if [ "$fam" = 'inet6' ]; then local -n lastip='gbmc_ncsi_nft_lastip6' else -- cgit v1.2.3 From 58ac4343a47e69e6c23f7f3128b6da1b9d922a91 Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Fri, 5 Nov 2021 04:15:36 -0700 Subject: meta-google: gbmc-bridge: Defer address reconfiguration Reconfiguring network interfaces immediately after detecting changes may not allow them enough time to settle. Without waiting, we might pre-emptively assume the configuration is changing even though networkd is just flushing and resetting the interface with the same config. Change-Id: I6a6858578d0499305fe2a3d3592dc73533bb02f1 Signed-off-by: William A. Kennington III --- .../recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in | 9 +++++++-- .../recipes-google/networking/gbmc-bridge/gbmc-br-from-ra.sh | 10 ++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) (limited to 'meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in') diff --git a/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in index ce53b8efb..5adc41328 100644 --- a/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in +++ b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in @@ -16,9 +16,12 @@ gbmc_ncsi_br_pub_addr_init= gbmc_ncsi_br_pub_addr_lastip= +gbmc_ncsi_br_pub_addr_confip= gbmc_ncsi_br_pub_addr_update() { [ -n "$gbmc_ncsi_br_pub_addr_init" ] || return + [ "$gbmc_ncsi_br_pub_addr_confip" != "$gbmc_ncsi_br_pub_addr_lastip" ] || return + gbmc_ncsi_br_pub_addr_confip="$gbmc_ncsi_br_pub_addr_lastip" printf 'gBMC Bridge Pub Addr from NCSI: %s\n' \ "${gbmc_ncsi_br_pub_addr_lastip:-(deleted)}" >&2 @@ -85,17 +88,19 @@ EOF gbmc_ncsi_br_pub_addr_hook() { if [ "$change" = 'init' ]; then gbmc_ncsi_br_pub_addr_init=1 + gbmc_ip_monitor_defer + elif [ "$change" = 'defer' ]; then gbmc_ncsi_br_pub_addr_update elif [ "$change" = 'addr' -a "$intf" = '@NCSI_IF@' ] && [ "$scope" = 'global' -a "$fam" = 'inet6' ] && [[ "$flags" != *deprecated* ]]; then if [ "$action" = 'add' -a "$ip" != "$gbmc_ncsi_br_pub_addr_lastip" ]; then gbmc_ncsi_br_pub_addr_lastip="$ip" - gbmc_ncsi_br_pub_addr_update + gbmc_ip_monitor_defer fi if [ "$action" = 'del' -a "$ip" = "$gbmc_ncsi_br_pub_addr_lastip" ]; then gbmc_ncsi_br_pub_addr_lastip= - gbmc_ncsi_br_pub_addr_update + gbmc_ip_monitor_defer fi fi } 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 18341fefb..a9bfd74af 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 @@ -67,26 +67,28 @@ gbmc_br_from_ra_update() { gbmc_br_from_ra_hook() { if [ "$change" = 'init' ]; then gbmc_br_from_ra_init=1 + gbmc_ip_monitor_defer + elif [ "$change" = 'defer' ]; then gbmc_br_from_ra_update elif [[ "$change" == 'route' && "$route" != *' via '* ]] && [[ "$route" =~ ^(.* dev gbmcbr proto ra .*)( +expires +([^ ]+)sec).*$ ]]; then pfx="${route%% *}" if [ "$action" = 'add' ]; then gbmc_br_from_ra_pfxs["$pfx"]="${BASH_REMATCH[3]}" - gbmc_br_from_ra_update + gbmc_ip_monitor_defer elif [ "$action" = 'del' ]; then gbmc_br_from_ra_pfxs["$pfx"]=0 - gbmc_br_from_ra_update + gbmc_ip_monitor_defer fi elif [ "$change" = 'link' -a "$intf" = 'gbmcbr' ]; then rdisc6 -m gbmcbr -r 1 -w 100 >/dev/null 2>&1 if [ "$action" = 'add' -a "$mac" != "$gbmc_br_from_ra_mac" ]; then gbmc_br_from_ra_mac="$mac" - gbmc_br_from_ra_update + gbmc_ip_monitor_defer fi if [ "$action" = 'del' -a "$mac" = "$gbmc_br_from_ra_mac" ]; then gbmc_br_from_ra_mac= - gbmc_br_from_ra_update + gbmc_ip_monitor_defer fi fi } -- cgit v1.2.3