mwan3: Don't use /128 address for ping source
authorBrian J. Murrell <redacted>
Thu, 30 Apr 2020 12:23:37 +0000 (08:23 -0400)
committerFlorian Eckert <redacted>
Thu, 30 Apr 2020 12:55:20 +0000 (14:55 +0200)
An interface can have both a /64 and a /128 from a provider.

In such a case, use the address from the /64 to do the ping check, not
the /128.

Signed-off-by: Brian J. Murrell <redacted>
net/mwan3/files/usr/sbin/mwan3track

index d60760f3c51a7ccb5fc06df327d121abeacbdf6b..136b3249c56d1b124fd194985ecc443f354e8c24 100755 (executable)
@@ -136,7 +136,7 @@ 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 's/ *inet6 \([^ \/]*\).* scope global.*/\1/p')
+                                                       ADDR=$(ip -6 addr ls dev "$DEVICE" | sed -ne '/\/128/d' -e 's/ *inet6 \([^ \/]*\).* scope global.*/\1/p')
                                                fi
                                                if [ $check_quality -eq 0 ]; then
                                                        ping -I ${ADDR:-$DEVICE} -c $count -W $timeout -s $size -t $max_ttl -q $track_ip &> /dev/null
git clone https://git.99rst.org/PROJECT