1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Merge pull request #112 from Ysurac/develop

sync
This commit is contained in:
suyuan 2021-04-10 08:03:33 +08:00 committed by GitHub
commit 674fc77179
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 7 deletions

View file

@ -37,7 +37,7 @@ end
local mtcpsyn = s:option(Value, "mptcp_syn_retries", translate("Multipath TCP SYN retries")) local mtcpsyn = s:option(Value, "mptcp_syn_retries", translate("Multipath TCP SYN retries"))
mtcpsyn.datatype = "uinteger" mtcpsyn.datatype = "uinteger"
mtcpsyn.rmempty = false mtcpsyn.rmempty = false
local congestion = s:option(ListValue, "congestion", translate("Congestion Control"),translate("Default is bbr")) local congestion = s:option(ListValue, "congestion", translate("Congestion Control"),translate("Default is cubic"))
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
congestion:value(cong, translate(cong)) congestion:value(cong, translate(cong))

View file

@ -10,6 +10,7 @@ EXTRA_COMMANDS="reload_rules bypass_asn"
_add_proto() { _add_proto() {
protoname=$1 protoname=$1
[ -z "$protoname" ] && return
if [ "$(dd if=/proc/net/xt_ndpi/proto bs=4096 2> /dev/null | grep $protoname)" = "" ]; then if [ "$(dd if=/proc/net/xt_ndpi/proto bs=4096 2> /dev/null | grep $protoname)" = "" ]; then
echo "add_custom $protoname" >/proc/net/xt_ndpi/proto echo "add_custom $protoname" >/proc/net/xt_ndpi/proto
fi fi
@ -44,6 +45,7 @@ _bypass_domains() {
config_get intf $1 interface config_get intf $1 interface
config_get enabled $1 enabled config_get enabled $1 enabled
[ "$enabled" = "0" ] && return [ "$enabled" = "0" ] && return
[ -z "$domain" ] && return
if [ "$(echo $domain | grep '\.$')" != "" ] || [ "$(echo $domain | grep '\.\*$')" != "" ]; then if [ "$(echo $domain | grep '\.$')" != "" ] || [ "$(echo $domain | grep '\.\*$')" != "" ]; then
tlds=`curl --max-time 4 -s -k https://data.iana.org/TLD/tlds-alpha-by-domain.txt` tlds=`curl --max-time 4 -s -k https://data.iana.org/TLD/tlds-alpha-by-domain.txt`
domain="$(echo '"$domain"' | sed 's:*::')" domain="$(echo '"$domain"' | sed 's:*::')"
@ -742,7 +744,7 @@ start_service() {
done done
if [ "$ipsets" != "" ]; then if [ "$ipsets" != "" ]; then
resultipset="/$(echo $dnsipset | cut -d/ -f2)/$ipsets" resultipset="/$(echo $dnsipset | cut -d/ -f2)/$ipsets"
uci -q add_list dhcp.@dnsmasq[0].ipset=$resultipset [ -n "$resultipset" ] && uci -q add_list dhcp.@dnsmasq[0].ipset=$resultipset
fi fi
done done
fi fi

View file

@ -1,7 +1,9 @@
#!/bin/sh #!/bin/sh
MODEM_IP=`echo $1 | grep -E '^(192\.168|10\.|172\.1[6789]\.|172\.2[0-9]\.|172\.3[01]\.)'` INTF_IP=`echo $1 | grep -E '^(192\.168|10\.|172\.1[6789]\.|172\.2[0-9]\.|172\.3[01]\.)'`
[ -z "$INTF_IP" ] && return
MODEM_IP=`echo $2 | grep -E '^(192\.168|10\.|172\.1[6789]\.|172\.2[0-9]\.|172\.3[01]\.)'`
[ -z "$MODEM_IP" ] && return [ -z "$MODEM_IP" ] && return
INFO=$2 INFO=$3
SESTOK=$(curl -s -m 1 -X GET "http://$MODEM_IP/api/webserver/SesTokInfo") SESTOK=$(curl -s -m 1 -X GET "http://$MODEM_IP/api/webserver/SesTokInfo")
[ -z "$SESTOK" ] && return [ -z "$SESTOK" ] && return
COOKIE=$(echo $SESTOK | sed -ne '/SesInfo/{s/.*<SesInfo>\(.*\)<\/SesInfo>.*/\1/p;q;}') COOKIE=$(echo $SESTOK | sed -ne '/SesInfo/{s/.*<SesInfo>\(.*\)<\/SesInfo>.*/\1/p;q;}')

View file

@ -1282,8 +1282,8 @@ function interfaces_status()
gw_ping6 = "DOWN" gw_ping6 = "DOWN"
end end
end end
if uci:get("openmptcprouter", interface, "manufacturer") == "huawei" then if uci:get("openmptcprouter", interface, "manufacturer") == "huawei" and ipaddr ~= "" then
intfdata = ut.trim(sys.exec("omr-huawei " .. gateway .. " all")) intfdata = ut.trim(sys.exec("omr-huawei " .. ipaddr .. " " .. gateway .. " all"))
if intfdata ~= "" then if intfdata ~= "" then
signal = ut.trim(sys.exec("echo '".. intfdata .. "' | awk -F';' '{print $1}'")) signal = ut.trim(sys.exec("echo '".. intfdata .. "' | awk -F';' '{print $1}'"))
operator = ut.trim(sys.exec("echo '".. intfdata .. "' | awk -F';' '{print $2}'")) operator = ut.trim(sys.exec("echo '".. intfdata .. "' | awk -F';' '{print $2}'"))

View file

@ -1189,7 +1189,7 @@ if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc)" = "" ] || [ $(($(
# uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.state=$(echo $intfdata | awk -F";" '{print $4}') # uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.state=$(echo $intfdata | awk -F";" '{print $4}')
#else #else
if [ "$proto" != "qmi" ] && [ "$proto" != "modemmanager" ]; then if [ "$proto" != "qmi" ] && [ "$proto" != "modemmanager" ]; then
if [ -n "$OMR_TRACKER_DEVICE_GATEWAY" ] && [ -n "$(curl -s -m 2 -X GET http://$OMR_TRACKER_DEVICE_GATEWAY/api/webserver/SesTokInfo)" ]; then if [ -n "$OMR_TRACKER_DEVICE_GATEWAY" ] && [ -n "$OMR_TRACKER_DEVICE_IP" ] && [ -n "$(curl --interface $OMR_TRACKER_DEVICE_IP -s -m 2 -X GET http://$OMR_TRACKER_DEVICE_GATEWAY/api/webserver/SesTokInfo)" ]; then
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.manufacturer='huawei' uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.manufacturer='huawei'
else else
uci -q delete openmptcprouter.$OMR_TRACKER_INTERFACE.manufacturer uci -q delete openmptcprouter.$OMR_TRACKER_INTERFACE.manufacturer