mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-13 02:51:50 +00:00
On dynamic master route change also check previous latency
This commit is contained in:
parent
12eb96e01e
commit
1de85be7d0
1 changed files with 8 additions and 5 deletions
|
@ -381,15 +381,18 @@ if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc)" = "" ] || [ $(($(
|
|||
fi
|
||||
|
||||
[ -n "$OMR_TRACKER_LATENCY" ] && {
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.latency_previous="$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.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" ] || ([ "$(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
|
||||
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)"
|
||||
if [ -n "$masterintf" ] && [ "$masterlatency" != "" ]; then
|
||||
if ([ "$(uci -q get openmptcprouter.settings.master)" = "change" ] && [ "$OMR_TRACKER_LATENCY" -lt "$((masterlatency/2))" ]) || ([ "$(uci -q get openmptcprouter.settings.master)" = "dynamic" ] && [ "$OMR_TRACKER_LATENCY" -lt "$((masterlatency/2))" ] && [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.latency_previous)" -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
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue