mwan3: Use /128 for ipv6 if no other source address was found
authorAaron Goodman <redacted>
Fri, 29 May 2020 05:04:57 +0000 (01:04 -0400)
committerAaron Goodman <redacted>
Fri, 29 May 2020 13:44:20 +0000 (09:44 -0400)
Signed-off-by: Aaron Goodman <redacted>
net/mwan3/files/usr/sbin/mwan3track

index f42e0ba544805afc4c2bba6d32073306c1312b8a..e112475ce9666c40f58558f41d4d3d4d00ec31d4 100755 (executable)
@@ -140,7 +140,8 @@ main() {
                                                # https://bugs.openwrt.org/index.php?do=details&task_id=2897
                                                # so get the IP address of the interface and use that instead
                                                if echo $track_ip | grep -q ':'; then
-                                                       ADDR=$(ip -6 addr ls dev "$DEVICE" | sed -ne '/\/128/d' -e 's/ *inet6 \([^ \/]*\).* scope global.*/\1/p')
+                                                       ADDR=$(ip -6 addr ls dev "$DEVICE" | sed -ne '/\/128/d' -e 's/ *inet6 \([^ \/]*\).* scope global.*/\1/p' | head -n1)
+                                                       [ -z "$ADDR" ] && ADDR=$(ip -6 addr ls dev "$DEVICE" | sed -ne 's/ *inet6 \([^ \/]*\).* scope global.*/\1/p')
                                                        ping_protocol=6
                                                fi
                                                if [ $check_quality -eq 0 ]; then
git clone https://git.99rst.org/PROJECT