mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 07:28:39 +01:00
net/mwan3: add online_metric for local_source none
If we set the option "local_source" in the globals mwan3 section to "none", traffic generated by the router it self will always use the default route from the wan interface with the lowest metric. If this interface is down the router traffic still uses the connection with the lowest metric but this is disconnected. Load balancing and failover from the lan site is still possible. Only router generated traffic is not load balanced and could not use failover. To solve this issue with router initiated traffic add the additional option "online_metric" to the mwan3 interface section. If the interface is connected then this lower "online metric" is set in the default routing table. With this change we have at least a failover with router initiated traffic. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
@@ -1219,3 +1219,25 @@ mwan3_track_clean()
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
mwan3_online_metric_clean() {
|
||||
local iface="$1"
|
||||
|
||||
local online_metric ifname
|
||||
|
||||
config_get family $iface family ipv4
|
||||
config_get online_metric $iface online_metric ""
|
||||
ifname=$(uci_get_state network $iface ifname)
|
||||
|
||||
if [ "$family" == "ipv4" ] \
|
||||
&& [ "$online_metric" != "" ] \
|
||||
&& [ "$ifname" != "" ]; then
|
||||
$IP4 route del default dev $ifname proto static metric $online_metric 1>/dev/null 2>&1
|
||||
fi
|
||||
|
||||
if [ "$family" == "ipv6" ] \
|
||||
&& [ "$online_metric" != "" ] \
|
||||
&& [ "$ifname" != "" ]; then
|
||||
$IP6 route del default dev $ifname proto static metric $online_metric 1>/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user