1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Disable multipath on interface not used

This commit is contained in:
Ycarus 2018-12-06 15:49:14 +01:00
parent 9ea04c5c1e
commit 12ecfda3dc

View file

@ -44,11 +44,11 @@ interface_multipath_settings() {
config_get enabled "$config" auto "1"
config_get iface "$config" ifname
count=$(($count+1))
[ -z "$iface" ] && iface=$(ifstatus "$config" | jsonfilter -q -e '@["l3_device"]')
[ "$enabled" = "0" ] && return 0
count=$(($count+1))
id=$count
[ -n "$intf" ] && [ "$iface" != "$intf" ] && return 0
[ -z "$iface" ] && return 0
@ -93,7 +93,7 @@ interface_multipath_settings() {
ip rule del table $id > /dev/null 2>&1
ip route flush $id > /dev/null 2>&1
if [ -n "$gateway" ] && [ -n "$network" ]; then
ip rule add from $ipaddr iif $iface oif $iface table $id pref 0
ip rule add from $ipaddr iif $iface oif $iface table $id
ip route replace $network/$netmask dev $iface scope link table $id
ip route replace default via $gateway dev $iface table $id
ip route flush $id
@ -141,7 +141,7 @@ interface_multipath_settings() {
ip -6 rule del table 6$id > /dev/null 2>&1
ip -6 route flush 6$id > /dev/null 2>&1
if [ -n "$ip6addr" ] && [ -n "$gateway6" ] && [ -n "$network6" ]; then
ip -6 rule add from $ip6addr iif $iface oif $iface table 6$id pref 0
ip -6 rule add from $ip6addr iif $iface oif $iface table 6$id
ip -6 route replace $network6/$netmask6 dev $iface scope link table 6$id
ip -6 route replace default via $gateway6 dev $iface table 6$id
ip -6 route flush 6$id