gbmc-ip-monitor: Ignore parent interface names

These aren't useful as inputs to the system and so they should be
truncated from the output.

Change-Id: I670d9d427e3ce1270a480252580ff514a141ad48
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 27df056..0e0ee4b 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
@@ -247,7 +247,6 @@
       gbmc_ncsi_br_deprecated_ips_add_neighs "$intf"
     fi
   elif [ "$change" = 'link' -a "$action" = 'add' -a "$carrier" = 'UP' ]; then
-    intf="${intf%%@*}"
     if ip link show "$intf" | grep -q '^ *alias ncsi-usb$'; then
       gbmc_ncsi_br_deprecated_ips_add_neighs "$intf"
     fi
diff --git a/meta-google/recipes-google/ncsi/files/gbmc-ncsi-usb.sh b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-usb.sh
index 784b3fd..2b6a0b8 100644
--- a/meta-google/recipes-google/ncsi/files/gbmc-ncsi-usb.sh
+++ b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-usb.sh
@@ -18,7 +18,6 @@
 gbmc_ncsi_dynamic_hook() {
   # shellcheck disable=SC2154
   if [[ "$change" = 'link' && "$action" = 'add' ]]; then
-    intf="${intf%%@*}"
     ip link show "$intf" | grep -q '^ *alias ncsi-usb$' || return
 
 read -r -d '' contents <<EOF
diff --git a/meta-google/recipes-google/networking/files/gbmc-ip-monitor-test.sh b/meta-google/recipes-google/networking/files/gbmc-ip-monitor-test.sh
index a84bb74..13bec42 100755
--- a/meta-google/recipes-google/networking/files/gbmc-ip-monitor-test.sh
+++ b/meta-google/recipes-google/networking/files/gbmc-ip-monitor-test.sh
@@ -129,7 +129,7 @@
 }
 
 testParseAddrAdd() {
-  expect_err 0 gbmc_ip_monitor_parse_line '[ADDR]2: eno2 inet6 fd01:ff2:5687:4:cf03:45f3:983a:96eb/128 metric 1024 scope global temporary dynamic'
+  expect_err 0 gbmc_ip_monitor_parse_line '[ADDR]2: eno2@extra inet6 fd01:ff2:5687:4:cf03:45f3:983a:96eb/128 metric 1024 scope global temporary dynamic'
   expect_streq "$change" 'addr'
   expect_streq "$action" 'add'
   expect_streq "$intf" 'eno2'
@@ -165,7 +165,7 @@
 }
 
 testParseLinkAdd() {
-  expect_err 0 gbmc_ip_monitor_parse_line "[LINK]2: eno2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000" \
+  expect_err 0 gbmc_ip_monitor_parse_line "[LINK]2: eno2@extra: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000" \
     < <(echo 'link/ether aa:aa:aa:aa:aa:aa brd ff:ff:ff:ff:ff:ff')
   expect_streq "$change" 'link'
   expect_streq "$action" 'add'
diff --git a/meta-google/recipes-google/networking/files/gbmc-ip-monitor.sh b/meta-google/recipes-google/networking/files/gbmc-ip-monitor.sh
index 0134c51..ed8fa8f 100755
--- a/meta-google/recipes-google/networking/files/gbmc-ip-monitor.sh
+++ b/meta-google/recipes-google/networking/files/gbmc-ip-monitor.sh
@@ -81,7 +81,7 @@
     if [ -n "${BASH_REMATCH[1]}" ]; then
       action=del
     fi
-    intf="${BASH_REMATCH[2]}"
+    intf="${BASH_REMATCH[2]%%@*}"
     fam="${BASH_REMATCH[3]}"
     ip="${BASH_REMATCH[4]}"
     scope="${BASH_REMATCH[7]}"
@@ -112,7 +112,7 @@
     if [ -n "${BASH_REMATCH[1]}" ]; then
       action=del
     fi
-    intf="${BASH_REMATCH[2]}"
+    intf="${BASH_REMATCH[2]%%@*}"
     carrier="${BASH_REMATCH[3]}"
     read -ra data || return
     mac="${data[1]}"