1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00
This commit is contained in:
suyuan 2024-12-15 14:37:17 +08:00 committed by GitHub
commit e16079bb95
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 6 deletions

View file

@ -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.default = 0
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")
for cong in string.gmatch(availablecong, "[^%s]+") do
if cong == "bbr" and string.match(availablecong, "bbr1") then

View file

@ -24,6 +24,7 @@ export OMR_TRACKER_STATUS
export OMR_TRACKER_STATUS_MSG
export OMR_TRACKER_PREV_STATUS
export OMR_TRACKER_DEVICE
export OMR_TRACKER_PREV_DEVICE
export OMR_TRACKER_DEVICE_IP
export OMR_TRACKER_DEVICE_IP6
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
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')
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
@ -343,7 +345,7 @@ while true; do
fi
fi
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
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")
@ -354,6 +356,10 @@ while true; do
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")
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
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}')
@ -403,7 +409,7 @@ while true; do
break
elif [ "$OMR_TRACKER_TYPE" != "none" ]; then
if ! $(exit $status); then
OMR_TRACKER_STATUS_MSG="gateway down"
OMR_TRACKER_STATUS_MSG="IPv4 gateway down"
fi
serverip_ping=false
if [ "$OMR_TRACKER_TYPE" = "ping" ]; then
@ -472,7 +478,7 @@ while true; do
fi
[ "$OMR_TRACKER_STATUS" = "OK" ] && break
elif ! $(exit $status); then
OMR_TRACKER_STATUS_MSG="gateway down"
OMR_TRACKER_STATUS_MSG="IPv4 gateway down"
fi
tries=$((tries - 1))
#_restart
@ -507,7 +513,7 @@ while true; do
break
elif [ "$OMR_TRACKER_TYPE" != "none" ]; then
if ! $(exit $status); then
OMR_TRACKER_STATUS_MSG="gateway6 down"
OMR_TRACKER_STATUS_MSG="IPv6 gateway down"
fi
serverip_ping=false
if [ "$OMR_TRACKER_TYPE" = "ping" ]; then
@ -577,7 +583,7 @@ while true; do
fi
[ "$OMR_TRACKER_STATUS" = "OK" ] && break
elif ! $(exit $status); then
OMR_TRACKER_STATUS_MSG="gateway down"
OMR_TRACKER_STATUS_MSG="IPv6 gateway down"
fi
tries=$((tries - 1))
#_restart

View file

@ -126,6 +126,8 @@ if [ "$OMR_TRACKER_STATUS" = "ERROR" ] || { [ "$OMR_TRACKER_INTERFACE" != "omrvp
fi
. /lib/functions/network.sh
[ -z "$OMR_TRACKER_DEVICE" ] && OMR_TRACKER_DEVICE="$OMR_TRACKER_PREV_DEVICE"
# Get the current multipath status
multipath_status="off"
# [ "$OMR_TRACKER_INTERFACE" = "omrvpn" ] && multipath $OMR_TRACKER_DEVICE off >/dev/null 2>&1