mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-13 11:01:50 +00:00
Merge branch 'develop' into master
This commit is contained in:
commit
d1b14f37cd
5 changed files with 27 additions and 16 deletions
|
@ -93,7 +93,9 @@ function wizard_add()
|
|||
ucic:foreach("network", "interface", function(s)
|
||||
local sectionname = s[".name"]
|
||||
if sectionname:match("^wan(%d+)$") then
|
||||
i = tonumber(string.match(sectionname, '(%d+)$')) + 1
|
||||
if i <= tonumber(string.match(sectionname, '%d+')) then
|
||||
i = tonumber(string.match(sectionname, '%d+')) + 1
|
||||
end
|
||||
end
|
||||
if ucic:get("network",sectionname,"multipath") == "master" then
|
||||
multipath_master = true
|
||||
|
|
|
@ -511,13 +511,11 @@ if [ "$multipath_config" = "master" ]; then
|
|||
if [ "$(uci -q get openmptcprouter.settings.master)" != "failover" ]; then
|
||||
config_foreach set_server_default_route server
|
||||
fi
|
||||
ip route replace default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE table 991337
|
||||
fi
|
||||
#if [ "$(uci -q get openmptcprouter.settings.master)" = "balancing" ] && [ "$(ip route show default | grep weight)" = "" ] && [ "$(uci -q get openmptcprouter.settings.defaultgw)" != "0" ] && [ "$(uci -q get openmptcprouter.settings.vpn)" != "mlvpn" ]; then
|
||||
if [ "$(uci -q get openmptcprouter.settings.master)" = "balancing" ] && [ "$(ip route show default | grep weight)" = "" ] && [ "$(uci -q get openmptcprouter.settings.defaultgw)" != "0" ]; then
|
||||
omrvpn_intf=$(uci -q get "network.omrvpn.ifname" || echo "tun")
|
||||
if [ -n "$omrvpn_intf" ] && [ "$(ip route show default | awk '/default/ {print $5}' | grep $omrvpn_intf)" = "" ]; then
|
||||
ip route replace default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE table 991337
|
||||
routesbalancing=""
|
||||
routesbalancingbackup=""
|
||||
nbintf=0
|
||||
|
@ -537,6 +535,9 @@ if [ "$multipath_config" = "master" ]; then
|
|||
}
|
||||
fi
|
||||
fi
|
||||
if [ -n "$OMR_TRACKER_DEVICE_GATEWAY" ] && [ -n "$OMR_TRACKER_DEVICE" ] && [ "$(ip r show table 991337)" != "default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE" ]; then
|
||||
ip route replace default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE table 991337
|
||||
fi
|
||||
if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc)" = "" ] || [ $(($(date +"%s") + $((10 + RANDOM % 31)) - $(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc))) -gt 3600 ] || [ "$(uci -q show openmptcprouter | grep get_config=\'1\')" != "" ] || [ "$(uci -q show openmptcprouter | grep admin_error=\'1\')" != "" ]; then
|
||||
/etc/init.d/openmptcprouter-vps restart >/dev/null 2>&1
|
||||
fi
|
||||
|
|
|
@ -11,8 +11,10 @@ _setup_rules() {
|
|||
_setup_routes() {
|
||||
config_get lookup $1 lookup
|
||||
config_get gateway $1 gateway
|
||||
intf=$(ifstatus | jsonfilter -e '@.l3_device' | tr -d "\n")
|
||||
intf=$(ifstatus $1 | jsonfilter -e '@.l3_device' | tr -d "\n")
|
||||
if [ -n "$lookup" ] && [ -n "$intf" ] && [ -n "$gateway" ]; then
|
||||
ip route replace default via $gateway dev $intf table $lookup
|
||||
fi
|
||||
}
|
||||
config_load network
|
||||
config_foreach _setup_rules interface
|
||||
|
|
|
@ -94,11 +94,17 @@ EOF
|
|||
if [ "$(uci -q get firewall.v2ray)" = "" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set firewall.v2ray=include
|
||||
set firewall.v2ray.path=/etc/firewall.v2ray
|
||||
set firewall.v2ray.path=/etc/firewall.v2ray-rules
|
||||
set firewall.v2ray.reload=1
|
||||
commit firewall
|
||||
EOF
|
||||
fi
|
||||
if [ "$(uci -q get firewall.v2ray.path)" != "/etc/firewall.v2ray-rules" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set firewall.v2ray.path=/etc/firewall.v2ray-rules
|
||||
commit firewall
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ "$(uci -q get v2ray.main_reverse.bridges | grep omrbridge)" = "" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
|
|
Loading…
Reference in a new issue