ncsid: Prefer fe80::1 gateway
Our labs and production environment normally use this as the gateway
address. We often have noisy lab networks with many bad gateways
advertising their presence. We know we generally prefer fe80::1 so we
switch to it when available.
Tested: On a noisy lab network and verified that the script correctly
locks onto fe80::1 and switches away from other gateways it receives.
Change-Id: I9ed6c5c2df7b1dec8015dcdfc0d320d471b5e7f3
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/subprojects/ncsid/src/update_ra_gw.sh b/subprojects/ncsid/src/update_ra_gw.sh
index 8af94e2..2090f73 100644
--- a/subprojects/ncsid/src/update_ra_gw.sh
+++ b/subprojects/ncsid/src/update_ra_gw.sh
@@ -89,9 +89,10 @@
if (( lifetime > 0 )); then
dl=$((lifetime + SECONDS))
rtrs["$rtr"]="$mac $dl"
- # If we don't have a router, we want to take the first one
- # to speed up acquisition time on boot
- if [ -z "$old_rtr" ]; then
+ # We have some notoriously noisy lab environments with many routers being broadcast
+ # We always prefer "fe80::1" in prod and labs for routing, so prefer that gateway.
+ # We also want to take the first router we find to speed up acquisition on boot.
+ if [ "$rtr" = "fe80::1" -o -z "$old_rtr" ]; then
set_rtr || true
fi
fi