summaryrefslogtreecommitdiff
path: root/meta-google
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2024-08-09 02:16:02 +0300
committerWilliam A. Kennington III <wak@google.com>2024-08-09 10:00:54 +0300
commit0e61a2039ef6bfcdda9767188871d7bf06d83343 (patch)
treeb85579e89c994dfa7813380cac0cceed8de7cc83 /meta-google
parentb9c0afc76868eabd67639cd6b3b3709f8d4b3a4f (diff)
downloadopenbmc-0e61a2039ef6bfcdda9767188871d7bf06d83343.tar.xz
meta-google: gbmc-bridge: Check router lifetime
We only want to parse RA packets from routers that are serving as the gateway on the network and ignore subordonate adverts. Tested: NCSI router parsing is still working as the router always adds a positive lifetime. Change-Id: I6b36b333f598fe5b36b3e89686a9326b6f5222ea Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'meta-google')
-rwxr-xr-xmeta-google/recipes-google/networking/gbmc-bridge/gbmc-ip-from-ra.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/meta-google/recipes-google/networking/gbmc-bridge/gbmc-ip-from-ra.sh b/meta-google/recipes-google/networking/gbmc-bridge/gbmc-ip-from-ra.sh
index 206f49f467..7a8dfbe9e4 100755
--- a/meta-google/recipes-google/networking/gbmc-bridge/gbmc-ip-from-ra.sh
+++ b/meta-google/recipes-google/networking/gbmc-bridge/gbmc-ip-from-ra.sh
@@ -33,6 +33,7 @@ while true; do
pfx=
host=
domain=
+ lifetime=-1
elif [[ "$line" =~ ^Prefix' '*:' '*(.*)/([0-9]+)$ ]]; then
t_pfx="${BASH_REMATCH[1]}"
t_pfx_len="${BASH_REMATCH[2]}"
@@ -42,6 +43,8 @@ while true; do
(( t_pfx_b[9] |= IP_OFFSET ))
hextet="fd$(printf '%02x' "${t_pfx_b[9]}")"
pfx="$(ip_bytes_to_str t_pfx_b)"
+ elif [[ "$line" =~ ^'Router lifetime'' '*:' '*([0-9]+)' '+ ]]; then
+ lifetime="${BASH_REMATCH[1]}"
elif [[ "$line" =~ ^'DNS search list'' '*:' '*([^.]+)(.*[.]google[.]com)' '*$ ]]; then
# Ideally, we use PCRE and with lookahead and can do this in a single regex
# ^([a-zA-Z0-9-]+(?=-n[a-fA-F0-9]{1,4})|[a-zA-Z0-9-]+(?!-n[a-fA-F0-9]{1,4}))[^.]*[.]((?:[a-zA-Z0-9]*[.])*google[.]com)$
@@ -52,6 +55,8 @@ while true; do
host="${host%"${BASH_REMATCH[1]}"}"
fi
elif [[ "$line" =~ ^from' '(.*)$ ]]; then
+ # We only want to accept info from gateway providing routers
+ (( lifetime > 0 )) || continue
rtr="${BASH_REMATCH[1]}"
if [[ -n $pfx && $pfx != "$old_pfx" ]]; then
echo "Updating PFX($pfx) from $rtr" >&2