1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-12 18:41:51 +00:00

Initialize var and use them

This commit is contained in:
Ycarus (Yannick Chabanois) 2021-03-31 09:58:11 +02:00
parent 7f318ebce4
commit a905c24760

View file

@ -876,7 +876,9 @@ if [ "$multipath_config" = "master" ]; then
routesbalancing=""
routesbalancingbackup=""
nbintf=0
nbintfb=0
nbintf6=0
nbintfb6=0
config_load network
config_foreach set_route_balancing interface
config_foreach set_route_balancing6 interface
@ -893,13 +895,13 @@ if [ "$multipath_config" = "master" ]; then
}
}
[ -n "$routesbalancingbackup" ] && {
([ "$nbintf" -gt "1" ] && [ "$(ip r show default metric 999 | tr -d '\t' | tr -d '\n')" != "default via $routesbalancingbackup " ]) || ([ "$nbintf" = "1" ] && ([ "$(ip r show default metric 999 | grep $OMR_TRACKER_DEVICE)" = "" ] || [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.vpn)" = "1" ]) && [ -n "$OMR_TRACKER_DEVICE_IP" ]) && {
([ "$nbintfb" -gt "1" ] && [ "$(ip r show default metric 999 | tr -d '\t' | tr -d '\n')" != "default via $routesbalancingbackup " ]) || ([ "$nbintf" = "1" ] && ([ "$(ip r show default metric 999 | grep $OMR_TRACKER_DEVICE)" = "" ] || [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.vpn)" = "1" ]) && [ -n "$OMR_TRACKER_DEVICE_IP" ]) && {
_log "Set backup ip route replace default scope global $routesbalancingbackup"
ip route replace default scope global metric 999 $routesbalancingbackup 2>&1 >/dev/null
}
}
[ -n "$routesbalancingbackup6" ] && {
([ "$nbintf6" -gt "1" ] && [ "$(ip -6 r show default metric 999 | tr -d '\t' | tr -d '\n')" != "default via $routesbalancingbackup6 " ]) || ([ "$nbintf6" = "1" ] && [ "$(ip -6 r show default metric 999 | grep $OMR_TRACKER_DEVICE)" = "" ] && [ -n "$OMR_TRACKER_DEVICE_IP6" ]) && {
([ "$nbintfb6" -gt "1" ] && [ "$(ip -6 r show default metric 999 | tr -d '\t' | tr -d '\n')" != "default via $routesbalancingbackup6 " ]) || ([ "$nbintf6" = "1" ] && [ "$(ip -6 r show default metric 999 | grep $OMR_TRACKER_DEVICE)" = "" ] && [ -n "$OMR_TRACKER_DEVICE_IP6" ]) && {
_log "Set backup ip -6 route replace default scope global $routesbalancingbackup6"
ip -6 route replace default scope global metric 999 $routesbalancingbackup6 2>&1 >/dev/null
}