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:
parent
6958ceba6f
commit
a1c1e5917e
5 changed files with 13 additions and 11 deletions
|
@ -37,7 +37,7 @@ function wizard_add()
|
|||
local add_server = luci.http.formvalue("add_server") or ""
|
||||
local add_server_name = luci.http.formvalue("add_server_name") or ""
|
||||
if add_server ~= "" and add_server_name ~= "" then
|
||||
ucic:set("openmptcprouter",add_server_name,"server")
|
||||
ucic:set("openmptcprouter",add_server_name:gsub("[^%w_]+","_"),"server")
|
||||
gostatus = false
|
||||
end
|
||||
|
||||
|
@ -404,6 +404,7 @@ function wizard_add()
|
|||
local shadowsocks_disable = luci.http.formvalue("disableshadowsocks") or "0"
|
||||
ucic:set("openmptcprouter","settings","shadowsocks_disable",shadowsocks_disable)
|
||||
ucic:set("openmptcprouter","settings","vpn",default_vpn)
|
||||
ucic:delete("openmptcprouter","settings","master_lcintf")
|
||||
ucic:save("openmptcprouter")
|
||||
ucic:commit("openmptcprouter")
|
||||
|
||||
|
|
|
@ -71,13 +71,13 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:Dynamic master interface%></label>
|
||||
<label class="cbi-value-title"><%:Master interface selection%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="checkbox" name="master_type" class="cbi-input-checkbox" value="dynamic" <% if luci.model.uci.cursor():get("openmptcprouter","settings","master") == "dynamic" then %>checked<% end %>>
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:Connection with lowest RTT is used as master interface%>
|
||||
</div>
|
||||
<select class="cbi-input-select" name="master_type">
|
||||
<option value="change" <% if luci.model.uci.cursor():get("openmptcprouter","settings","master") == "change" then %>selected="selected"<% end %>><%:On wizard change%></option>
|
||||
<option value="dynamic" <% if luci.model.uci.cursor():get("openmptcprouter","settings","master") == "dynamic" then %>selected="selected"<% end %>><%:Dynamic change%></option>
|
||||
<option value="static" <% if luci.model.uci.cursor():get("openmptcprouter","settings","master") == "static" then %>selected="selected"<% end %>><%:No change%></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
|
|
@ -99,7 +99,7 @@ end
|
|||
%>
|
||||
<div class="cbi-section-create">
|
||||
<div>
|
||||
<input type="text" class="cbi-section-create-name" id="cbi.cts.omr-bypass.server." name="add_server_name" data-type="uciname" data-optional="true" />
|
||||
<input type="text" class="cbi-section-create-name" id="cbi.cts.omr-bypass.server." name="add_server_name" data-type="uciname" data-optional="false" />
|
||||
</div>
|
||||
<input class="cbi-button cbi-button-add" type="submit" onclick="this.form.cbi_state='add-section'; return true" name="add_server" value="<%:Add server%>" />
|
||||
</div>
|
||||
|
|
|
@ -36,7 +36,7 @@ fi
|
|||
if [ "$(uci -q get openmptcprouter.settings.master)" = "" ]; then
|
||||
uci -q batch <<-EOF
|
||||
set openmptcprouter.settings=settings
|
||||
set openmptcprouter.settings.master='dynamic'
|
||||
set openmptcprouter.settings.master='change'
|
||||
commit openmptcprouter
|
||||
EOF
|
||||
fi
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue