mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
sync (#580)
This commit is contained in:
commit
e16079bb95
3 changed files with 14 additions and 6 deletions
|
@ -67,7 +67,7 @@ if uname.release:sub(1,4) ~= "5.15" and uname.release:sub(1,1) ~= "6" then
|
||||||
o:value(1, translate("1"))
|
o:value(1, translate("1"))
|
||||||
o.default = 0
|
o.default = 0
|
||||||
end
|
end
|
||||||
o = s:option(ListValue, "congestion", translate("Congestion Control"),translate("Default is cubic"))
|
o = s:option(ListValue, "congestion", translate("Congestion Control"),translate("Default is bbr"))
|
||||||
local availablecong = sys.exec("sysctl -n net.ipv4.tcp_available_congestion_control | xargs -n1 | sort | xargs")
|
local availablecong = sys.exec("sysctl -n net.ipv4.tcp_available_congestion_control | xargs -n1 | sort | xargs")
|
||||||
for cong in string.gmatch(availablecong, "[^%s]+") do
|
for cong in string.gmatch(availablecong, "[^%s]+") do
|
||||||
if cong == "bbr" and string.match(availablecong, "bbr1") then
|
if cong == "bbr" and string.match(availablecong, "bbr1") then
|
||||||
|
|
|
@ -24,6 +24,7 @@ export OMR_TRACKER_STATUS
|
||||||
export OMR_TRACKER_STATUS_MSG
|
export OMR_TRACKER_STATUS_MSG
|
||||||
export OMR_TRACKER_PREV_STATUS
|
export OMR_TRACKER_PREV_STATUS
|
||||||
export OMR_TRACKER_DEVICE
|
export OMR_TRACKER_DEVICE
|
||||||
|
export OMR_TRACKER_PREV_DEVICE
|
||||||
export OMR_TRACKER_DEVICE_IP
|
export OMR_TRACKER_DEVICE_IP
|
||||||
export OMR_TRACKER_DEVICE_IP6
|
export OMR_TRACKER_DEVICE_IP6
|
||||||
export OMR_TRACKER_PREV_DEVICE_IP
|
export OMR_TRACKER_PREV_DEVICE_IP
|
||||||
|
@ -306,6 +307,7 @@ while true; do
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -n "$OMR_TRACKER_DEVICE" ] && [ -d "/sys/class/net/$OMR_TRACKER_DEVICE" ]; then
|
if [ -n "$OMR_TRACKER_DEVICE" ] && [ -d "/sys/class/net/$OMR_TRACKER_DEVICE" ]; then
|
||||||
|
OMR_TRACKER_PREV_DEVICE="$OMR_TRACKER_DEVICE"
|
||||||
OMR_TRACKER_DEVICE_STATE=$(ip -j link show dev "$OMR_TRACKER_DEVICE" | jsonfilter -q -e '@[*].operstate' | tr -d '\n')
|
OMR_TRACKER_DEVICE_STATE=$(ip -j link show dev "$OMR_TRACKER_DEVICE" | jsonfilter -q -e '@[*].operstate' | tr -d '\n')
|
||||||
if ([ "$(ifstatus $OMR_TRACKER_INTERFACE | jsonfilter -q -e '@.up')" == "true" ] && [ "$OMR_TRACKER_DEVICE_STATE" != "DOWN" ]) || [ "$OMR_TRACKER_INTERFACE" = "omrvpn" ]; then
|
if ([ "$(ifstatus $OMR_TRACKER_INTERFACE | jsonfilter -q -e '@.up')" == "true" ] && [ "$OMR_TRACKER_DEVICE_STATE" != "DOWN" ]) || [ "$OMR_TRACKER_INTERFACE" = "omrvpn" ]; then
|
||||||
# retrieve iface ip and gateway
|
# retrieve iface ip and gateway
|
||||||
|
@ -343,7 +345,7 @@ while true; do
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ]; then
|
if [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ]; then
|
||||||
OMR_TRACKER_DEVICE_ROUTE=$(ip -4 r list dev "$OMR_TRACKER_DEVICE" | grep via | grep -v default | grep -v metric | grep -v / | awk '{print $1; exit}' | tr -d "\n")
|
OMR_TRACKER_DEVICE_ROUTE=$(ip -4 r list dev "$OMR_TRACKER_DEVICE" | grep via | grep -v default | grep -v nexthop | grep -v metric | grep -v / | awk '{print $1; exit}' | tr -d "\n")
|
||||||
fi
|
fi
|
||||||
if [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ]; then
|
if [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ]; then
|
||||||
OMR_TRACKER_DEVICE_GATEWAY=$(ip -4 r list dev "$OMR_TRACKER_DEVICE" | grep kernel | grep -v '.0/' | awk '/proto kernel/ {print $1;exit}' | tr -d "\n")
|
OMR_TRACKER_DEVICE_GATEWAY=$(ip -4 r list dev "$OMR_TRACKER_DEVICE" | grep kernel | grep -v '.0/' | awk '/proto kernel/ {print $1;exit}' | tr -d "\n")
|
||||||
|
@ -354,6 +356,10 @@ while true; do
|
||||||
if [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ]; then
|
if [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ]; then
|
||||||
OMR_TRACKER_DEVICE_GATEWAY=$(ip -4 r list dev "$OMR_TRACKER_DEVICE" | awk '/via/ {print $3;exit}' | tr -d "\n")
|
OMR_TRACKER_DEVICE_GATEWAY=$(ip -4 r list dev "$OMR_TRACKER_DEVICE" | awk '/via/ {print $3;exit}' | tr -d "\n")
|
||||||
fi
|
fi
|
||||||
|
if [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ] && [ "$OMR_TRACKER_INTERFACE" = "omrvpn" ] && [ "$(uci -q get openvpn.omr.enabled)" = "1" ]; then
|
||||||
|
OMR_TRACKER_DEVICE_GATEWAY="10.255.252.1"
|
||||||
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
if { [ "$OMR_TRACKER_IPV6" = "1" ] || [ "$OMR_TRACKER_IPV6" = "auto" ]; } && { [ "$OMR_TRACKER_FAMILY" = "ipv6" ] || [ "$OMR_TRACKER_FAMILY" = "ipv4ipv6" ]; }; then
|
if { [ "$OMR_TRACKER_IPV6" = "1" ] || [ "$OMR_TRACKER_IPV6" = "auto" ]; } && { [ "$OMR_TRACKER_FAMILY" = "ipv6" ] || [ "$OMR_TRACKER_FAMILY" = "ipv4ipv6" ]; }; then
|
||||||
#OMR_TRACKER_DEVICE_IP6=$(ip -6 -br addr ls dev "$OMR_TRACKER_DEVICE" | awk -F'[ /]+' '{print $3}')
|
#OMR_TRACKER_DEVICE_IP6=$(ip -6 -br addr ls dev "$OMR_TRACKER_DEVICE" | awk -F'[ /]+' '{print $3}')
|
||||||
|
@ -403,7 +409,7 @@ while true; do
|
||||||
break
|
break
|
||||||
elif [ "$OMR_TRACKER_TYPE" != "none" ]; then
|
elif [ "$OMR_TRACKER_TYPE" != "none" ]; then
|
||||||
if ! $(exit $status); then
|
if ! $(exit $status); then
|
||||||
OMR_TRACKER_STATUS_MSG="gateway down"
|
OMR_TRACKER_STATUS_MSG="IPv4 gateway down"
|
||||||
fi
|
fi
|
||||||
serverip_ping=false
|
serverip_ping=false
|
||||||
if [ "$OMR_TRACKER_TYPE" = "ping" ]; then
|
if [ "$OMR_TRACKER_TYPE" = "ping" ]; then
|
||||||
|
@ -472,7 +478,7 @@ while true; do
|
||||||
fi
|
fi
|
||||||
[ "$OMR_TRACKER_STATUS" = "OK" ] && break
|
[ "$OMR_TRACKER_STATUS" = "OK" ] && break
|
||||||
elif ! $(exit $status); then
|
elif ! $(exit $status); then
|
||||||
OMR_TRACKER_STATUS_MSG="gateway down"
|
OMR_TRACKER_STATUS_MSG="IPv4 gateway down"
|
||||||
fi
|
fi
|
||||||
tries=$((tries - 1))
|
tries=$((tries - 1))
|
||||||
#_restart
|
#_restart
|
||||||
|
@ -507,7 +513,7 @@ while true; do
|
||||||
break
|
break
|
||||||
elif [ "$OMR_TRACKER_TYPE" != "none" ]; then
|
elif [ "$OMR_TRACKER_TYPE" != "none" ]; then
|
||||||
if ! $(exit $status); then
|
if ! $(exit $status); then
|
||||||
OMR_TRACKER_STATUS_MSG="gateway6 down"
|
OMR_TRACKER_STATUS_MSG="IPv6 gateway down"
|
||||||
fi
|
fi
|
||||||
serverip_ping=false
|
serverip_ping=false
|
||||||
if [ "$OMR_TRACKER_TYPE" = "ping" ]; then
|
if [ "$OMR_TRACKER_TYPE" = "ping" ]; then
|
||||||
|
@ -577,7 +583,7 @@ while true; do
|
||||||
fi
|
fi
|
||||||
[ "$OMR_TRACKER_STATUS" = "OK" ] && break
|
[ "$OMR_TRACKER_STATUS" = "OK" ] && break
|
||||||
elif ! $(exit $status); then
|
elif ! $(exit $status); then
|
||||||
OMR_TRACKER_STATUS_MSG="gateway down"
|
OMR_TRACKER_STATUS_MSG="IPv6 gateway down"
|
||||||
fi
|
fi
|
||||||
tries=$((tries - 1))
|
tries=$((tries - 1))
|
||||||
#_restart
|
#_restart
|
||||||
|
|
|
@ -126,6 +126,8 @@ if [ "$OMR_TRACKER_STATUS" = "ERROR" ] || { [ "$OMR_TRACKER_INTERFACE" != "omrvp
|
||||||
fi
|
fi
|
||||||
. /lib/functions/network.sh
|
. /lib/functions/network.sh
|
||||||
|
|
||||||
|
[ -z "$OMR_TRACKER_DEVICE" ] && OMR_TRACKER_DEVICE="$OMR_TRACKER_PREV_DEVICE"
|
||||||
|
|
||||||
# Get the current multipath status
|
# Get the current multipath status
|
||||||
multipath_status="off"
|
multipath_status="off"
|
||||||
# [ "$OMR_TRACKER_INTERFACE" = "omrvpn" ] && multipath $OMR_TRACKER_DEVICE off >/dev/null 2>&1
|
# [ "$OMR_TRACKER_INTERFACE" = "omrvpn" ] && multipath $OMR_TRACKER_DEVICE off >/dev/null 2>&1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue