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

Fix and change default to new master select after network change

This commit is contained in:
Ycarus 2018-12-13 13:54:06 +01:00
parent 6958ceba6f
commit a1c1e5917e
5 changed files with 13 additions and 11 deletions

View file

@ -352,12 +352,13 @@ fi
[ -n "$OMR_TRACKER_LATENCY" ] && {
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.latency="$OMR_TRACKER_LATENCY"
if [ "$multipath_config" = "on" ] && [ "$(uci -q get network.$OMR_TRACKER_INTERFACE.multipath)" != "master" ] && [ "$(uci -q get openmptcprouter.settings.master)" = "dynamic" ]; then
if [ "$multipath_config" = "on" ] && [ "$(uci -q get network.$OMR_TRACKER_INTERFACE.multipath)" != "master" ] && ([ "$(uci -q get openmptcprouter.settings.master)" = "dynamic" ] || ([ "$(uci -q get openmptcprouter.settings.master)" = "change" ] && [ "$(uci -q get openmptcprouter.settings.master_lcintf | grep $OMR_TRACKER_INTERFACE)" = "" ])); then
masterintf="$(uci -q show network | grep multipath=\'master\' | cut -d'.' -f2)"
masterlatency="$(uci -q get openmptcprouter.$masterintf.latency | tr -d '\n')"
if [ -n "$masterintf" ] && [ "$masterlatency" != "" ] && [ "$OMR_TRACKER_LATENCY" -lt "$(($masterlatency/2))" ]; then
if [ -n "$masterintf" ] && [ "$masterlatency" != "" ] && [ "$OMR_TRACKER_LATENCY" -lt "$((masterlatency/2))" ]; then
uci -q set network.$masterintf.multipath='on'
uci -q set network.$OMR_TRACKER_INTERFACE.multipath='master'
uci -q add_list openmptcprouter.settings.master_lcintf="$OMR_TRACKER_INTERFACE"
_log "Change master interface from $masterintf ($masterlatency ms) to $OMR_TRACKER_INTERFACE ($OMR_TRACKER_LATENCY ms)"
fi
fi