From 267b65ad9f74c854e790f0771e280b763df5f07e Mon Sep 17 00:00:00 2001 From: Aaron Goodman Date: Mon, 28 Dec 2020 20:09:08 -0500 Subject: [PATCH] mwan3: fix regression in ipv6 routing tables Signed-off-by: Aaron Goodman --- net/mwan3/Makefile | 2 +- net/mwan3/files/etc/hotplug.d/iface/15-mwan3 | 5 ++--- net/mwan3/files/etc/init.d/mwan3 | 2 -- net/mwan3/files/lib/mwan3/common.sh | 10 ++++++---- net/mwan3/files/lib/mwan3/mwan3.sh | 3 --- net/mwan3/files/usr/sbin/mwan3 | 1 - net/mwan3/files/usr/sbin/mwan3rtmon | 9 +++------ net/mwan3/files/usr/sbin/mwan3track | 1 - 8 files changed, 12 insertions(+), 21 deletions(-) diff --git a/net/mwan3/Makefile b/net/mwan3/Makefile index 87ad0e8a1d..914844674f 100644 --- a/net/mwan3/Makefile +++ b/net/mwan3/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mwan3 -PKG_VERSION:=2.10.5 +PKG_VERSION:=2.10.6 PKG_RELEASE:=1 PKG_MAINTAINER:=Florian Eckert , \ Aaron Goodman diff --git a/net/mwan3/files/etc/hotplug.d/iface/15-mwan3 b/net/mwan3/files/etc/hotplug.d/iface/15-mwan3 index 32497a5a07..e00cbfa5ca 100644 --- a/net/mwan3/files/etc/hotplug.d/iface/15-mwan3 +++ b/net/mwan3/files/etc/hotplug.d/iface/15-mwan3 @@ -21,7 +21,8 @@ fi [ "$MWAN3_STARTUP" = "init" ] || procd_lock -config_load mwan3 +mwan3_init + /etc/init.d/mwan3 running || { [ "$MWAN3_STARTUP" = "init" ] || procd_lock LOG notice "mwan3 hotplug $ACTION on $INTERFACE not called because globally disabled" @@ -34,8 +35,6 @@ $IPT4 -S mwan3_hook &>/dev/null || { exit 0 } -mwan3_init - if [ "$MWAN3_STARTUP" != "init" ] && [ "$ACTION" = "ifup" ]; then mwan3_set_user_iface_rules $INTERFACE $DEVICE fi diff --git a/net/mwan3/files/etc/init.d/mwan3 b/net/mwan3/files/etc/init.d/mwan3 index c34dda767b..2d5b53d233 100755 --- a/net/mwan3/files/etc/init.d/mwan3 +++ b/net/mwan3/files/etc/init.d/mwan3 @@ -27,7 +27,6 @@ start_tracker() { start_service() { local enabled hotplug_pids - config_load mwan3 mwan3_init config_foreach start_tracker interface @@ -57,7 +56,6 @@ start_service() { stop_service() { local ipset rule IP IPTR IPT family table tid - config_load mwan3 mwan3_init config_foreach mwan3_interface_shutdown interface diff --git a/net/mwan3/files/lib/mwan3/common.sh b/net/mwan3/files/lib/mwan3/common.sh index bb55a466cb..33a94ae862 100644 --- a/net/mwan3/files/lib/mwan3/common.sh +++ b/net/mwan3/files/lib/mwan3/common.sh @@ -107,8 +107,9 @@ mwan3_get_mwan3track_status() mwan3_init() { - local bitcnt - local mmdefault + local bitcnt mmdefault source_routing + + config_load mwan3 [ -d $MWAN3_STATUS_DIR ] || mkdir -p $MWAN3_STATUS_DIR/iface_state @@ -117,7 +118,6 @@ mwan3_init() MMX_MASK=$(cat "${MWAN3_STATUS_DIR}/mmx_mask") MWAN3_INTERFACE_MAX=$(uci_get_state mwan3 globals iface_max) else - config_load mwan3 config_get MMX_MASK globals mmx_mask '0x3F00' echo "$MMX_MASK"| tr 'A-F' 'a-f' > "${MWAN3_STATUS_DIR}/mmx_mask" LOG debug "Using firewall mask ${MMX_MASK}" @@ -130,7 +130,9 @@ mwan3_init() fi # remove "linkdown", expiry and source based routing modifiers from route lines - MWAN3_ROUTE_LINE_EXP="s/linkdown //; s/expires [0-9]\+sec//;s/error [0-9]\+//; ${source_routing:+s/default\(.*\) from [^ ]*/default\1/;} p" + config_get_bool source_routing globals source_routing 0 + [ $source_routing -eq 1 ] && unset source_routing + MWAN3_ROUTE_LINE_EXP="s/linkdown //; s/expires [0-9]\+sec//; s/error [0-9]\+//; ${source_routing:+s/default\(.*\) from [^ ]*/default\1/;} p" # mark mask constants bitcnt=$(mwan3_count_one_bits MMX_MASK) diff --git a/net/mwan3/files/lib/mwan3/mwan3.sh b/net/mwan3/files/lib/mwan3/mwan3.sh index b99f282318..24af3dad52 100644 --- a/net/mwan3/files/lib/mwan3/mwan3.sh +++ b/net/mwan3/files/lib/mwan3/mwan3.sh @@ -410,9 +410,6 @@ mwan3_delete_iface_iptables() mwan3_get_routes() { - local source_routing - config_get_bool source_routing globals source_routing 0 - [ $source_routing -eq 0 ] && unset source_routing $IP route list table main | sed -ne "$MWAN3_ROUTE_LINE_EXP" | uniq } diff --git a/net/mwan3/files/usr/sbin/mwan3 b/net/mwan3/files/usr/sbin/mwan3 index 803e74b9a0..51f4686760 100755 --- a/net/mwan3/files/usr/sbin/mwan3 +++ b/net/mwan3/files/usr/sbin/mwan3 @@ -129,7 +129,6 @@ use() { local interface device src_ip family mwan3_init - config_load mwan3 interface=$1 ; shift [ -z "$*" ] && echo "no command specified for mwan3 use" && return diff --git a/net/mwan3/files/usr/sbin/mwan3rtmon b/net/mwan3/files/usr/sbin/mwan3rtmon index 96a774783d..06be435971 100755 --- a/net/mwan3/files/usr/sbin/mwan3rtmon +++ b/net/mwan3/files/usr/sbin/mwan3rtmon @@ -69,14 +69,11 @@ mwan3_add_all_routes() mwan3_rtmon_route_handle() { - local action route_line family tbl device line tid source_routing + local action route_line family tbl device line tid route_line=${1##"Deleted "} route_family=$2 - config_get_bool source_routing globals source_routing 0 - [ $source_routing -eq 0 ] && unset source_routing - if [ "$route_line" = "$1" ]; then action="replace" $IPS -! add mwan3_connected_${route_family##ip} ${route_line%% *} @@ -143,7 +140,8 @@ main() { local IP family - config_load mwan3 + mwan3_init + family=$1 [ -z $family ] && family=ipv4 if [ "$family" = "ipv6" ]; then @@ -155,7 +153,6 @@ main() else IP="$IP4" fi - mwan3_init sh -c "echo \$\$; exec $IP monitor route" | { read -r monitor_pid trap_with_arg func_trap "$monitor_pid" SIGINT SIGTERM SIGKILL diff --git a/net/mwan3/files/usr/sbin/mwan3track b/net/mwan3/files/usr/sbin/mwan3track index bd8954c073..c6333198e9 100755 --- a/net/mwan3/files/usr/sbin/mwan3track +++ b/net/mwan3/files/usr/sbin/mwan3track @@ -192,7 +192,6 @@ main() { trap if_down USR1 trap if_up USR2 - config_load mwan3 config_get FAMILY $INTERFACE family ipv4 config_get track_method $INTERFACE track_method ping config_get_bool httping_ssl $INTERFACE httping_ssl 0 -- 2.30.2