mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
commit
8ed1058af1
28 changed files with 12527 additions and 61 deletions
|
@ -1067,6 +1067,13 @@ function settings_add()
|
|||
ucic:set("openmptcprouter","settings","scaling_governor",scaling_governor)
|
||||
end
|
||||
|
||||
-- Enable/disable Qualcomm Shortcut FE
|
||||
local sfe_enabled = luci.http.formvalue("sfe_enabled") or "0"
|
||||
ucic:set("openmptcprouter","settings","sfe_enabled",sfe_enabled)
|
||||
local sfe_bridge = luci.http.formvalue("sfe_bridge") or "0"
|
||||
ucic:set("openmptcprouter","settings","sfe_bridge",sfe_bridge)
|
||||
|
||||
|
||||
ucic:save("openmptcprouter")
|
||||
ucic:commit("openmptcprouter")
|
||||
|
||||
|
|
|
@ -322,6 +322,28 @@
|
|||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<%
|
||||
if nixio.fs.access("/lib/modules/" .. nixio.uname().release .. "/shortcut-fe.ko") then
|
||||
%>
|
||||
<hr />
|
||||
<fieldset class="cbi-section" id="fe">
|
||||
<legend><%:Qualcomm Shortcut FE driver%></legend>
|
||||
<div class="cbi-section-descr"></div>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:Enable Fast Patch offloading for connections%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="checkbox" name="sfe_enabled" class="cbi-input-checkbox" value="1" <% if luci.model.uci.cursor():get("openmptcprouter","settings","sfe_enabled") == "1" then %>checked<% end %>>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:Enable Bridge Acceleration%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="checkbox" name="sfe_bridge" class="cbi-input-checkbox" value="1" <% if luci.model.uci.cursor():get("openmptcprouter","settings","sfe_bridge") == "1" then %>checked<% end %>>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<% if nixio.fs.access("/sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq") then %>
|
||||
<fieldset class="cbi-section" id="system">
|
||||
<legend><%:Systems settings%></legend>
|
||||
|
|
|
@ -4,14 +4,18 @@
|
|||
intf=$1
|
||||
|
||||
get_ip_from_server() {
|
||||
serverip=$(uci -q get openmptcprouter.$1.ip)
|
||||
serverport=$(uci -q get openmptcprouter.$1.port)
|
||||
getip="$(curl -s -k -4 -m 2 --interface $intf https://$serverip:$serverport/clienthost)"
|
||||
[ -n "$getip" ] && getip=$(echo $getip | jsonfilter -e '@.client_host')
|
||||
if expr "$getip" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' >/dev/null; then
|
||||
ip=$getip
|
||||
break
|
||||
fi
|
||||
get_ip() {
|
||||
serverip=$1
|
||||
getip="$(curl -s -k -4 -m 2 --interface $intf https://$serverip:$serverport/clienthost)"
|
||||
[ -n "$getip" ] && getip=$(echo $getip | jsonfilter -e '@.client_host')
|
||||
if expr "$getip" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' >/dev/null; then
|
||||
ip=$getip
|
||||
break
|
||||
fi
|
||||
}
|
||||
config_list_foreach $1 ip get_ip
|
||||
[ -n "$ip" ] && break
|
||||
}
|
||||
|
||||
get_ip_from_website() {
|
||||
|
|
|
@ -4,14 +4,17 @@
|
|||
intf=$1
|
||||
|
||||
get_ip_from_server() {
|
||||
serverip=$(uci -q get openmptcprouter.$1.ip)
|
||||
serverport=$(uci -q get openmptcprouter.$1.port)
|
||||
getip="$(curl -s -k -6 -m 2 --interface $intf https://$serverip:$serverport/clienthost)"
|
||||
[ -n "$getip" ] && getip=$(echo $getip | jsonfilter -e '@.client_host')
|
||||
if [ -n "$(echo "$getip" | grep :)" ]; then
|
||||
ip=$getip
|
||||
break
|
||||
fi
|
||||
get_ip() {
|
||||
getip="$(curl -s -k -6 -m 2 --interface $intf https://$serverip:$serverport/clienthost)"
|
||||
[ -n "$getip" ] && getip=$(echo $getip | jsonfilter -e '@.client_host')
|
||||
if [ -n "$(echo "$getip" | grep :)" ]; then
|
||||
ip=$getip
|
||||
break
|
||||
fi
|
||||
}
|
||||
config_list_foreach $1 ip get_ip
|
||||
[ -n "$ip" ] && break
|
||||
}
|
||||
|
||||
get_ip_from_website() {
|
||||
|
|
|
@ -1,5 +1,63 @@
|
|||
#!/bin/sh
|
||||
multipathip=$(dig +short A multipath-tcp.org | tr -d "\n")
|
||||
ipset add ss_rules_dst_bypass_all $multipathip > /dev/null 2>&1
|
||||
curl -s -4 -m 2 --interface $1 http://www.multipath-tcp.org
|
||||
ipset del ss_rules_dst_bypass_all $multipathip > /dev/null 2>&1
|
||||
. /lib/functions.sh
|
||||
|
||||
intf=$1
|
||||
|
||||
[ -z "$intf" ] && return
|
||||
|
||||
get_mptcp_from_server() {
|
||||
serverport=$(uci -q get openmptcprouter.$1.port)
|
||||
get_mptcp() {
|
||||
serverip=$1
|
||||
if [ "$(echo $serverip | grep :)" ]; then
|
||||
support="$(curl -s -k -6 -m 2 --interface $intf https://[$serverip]:$serverport/mptcpsupport)"
|
||||
else
|
||||
support="$(curl -s -k -4 -m 2 --interface $intf https://$serverip:$serverport/mptcpsupport)"
|
||||
fi
|
||||
[ -n "$support" ] && {
|
||||
support=$(echo $support | jsonfilter -e '@.mptcp')
|
||||
break
|
||||
}
|
||||
}
|
||||
config_list_foreach $1 ip get_mptcp
|
||||
[ -n "$support" ] && break
|
||||
}
|
||||
|
||||
get_mptcp_from_website() {
|
||||
multipathip=$(dig +short A multipath-tcp.org | tr -d "\n")
|
||||
ipset add ss_rules_dst_bypass_all $multipathip > /dev/null 2>&1
|
||||
support="$(curl -s -4 -m 2 --interface $intf http://www.multipath-tcp.org)"
|
||||
ipset del ss_rules_dst_bypass_all $multipathip > /dev/null 2>&1
|
||||
[ -n "$support" ] && {
|
||||
if [ "$support" = "Yay, you are MPTCP-capable! You can now rest in peace." ]; then
|
||||
support="working"
|
||||
else
|
||||
support="not working"
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
get_mptcp_from_website6() {
|
||||
multipathip=$(dig +short AAAA multipath-tcp.org | tr -d "\n")
|
||||
ipset add ss_rules6_dst_bypass_all $multipathip > /dev/null 2>&1
|
||||
support="$(curl -s -6 -m 2 --interface $intf http://www.multipath-tcp.org)"
|
||||
ipset del ss_rules6_dst_bypass_all $multipathip > /dev/null 2>&1
|
||||
[ -n "$support" ] && {
|
||||
if [ "$support" = "Yay, you are MPTCP-capable! You can now rest in peace." ]; then
|
||||
support="working"
|
||||
else
|
||||
support="not working"
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
support=""
|
||||
config_load openmptcprouter
|
||||
config_foreach get_mptcp_from_server server
|
||||
[ -z "$support" ] && [ -n "$(ip -4 a show dev $intf)" ] && get_mptcp_from_website
|
||||
[ -z "$support" ] && [ -n "$(ip -6 a show dev $intf)" ] && get_mptcp_from_website6
|
||||
if [ "$support" = "working" ]; then
|
||||
echo "MPTCP enabled"
|
||||
elif [ "$support" = "not working" ]; then
|
||||
echo "MPTCP disabled"
|
||||
fi
|
||||
|
|
|
@ -157,6 +157,23 @@ start_service() {
|
|||
EOF
|
||||
fi
|
||||
|
||||
if [ "$(uci -q get openmptcprouter.settings.sfe_enabled)" = "1" ]; then
|
||||
[ -z "$(lsmod | grep fast_classifier)" ] && modprobe fast_classifier 2>&1 >/dev/null
|
||||
if [ "$(uci -q get openmptcprouter.settings.sfe_bridge)" = "1" ]; then
|
||||
echo 1 >/sys/fast_classifier/skip_to_bridge_ingress
|
||||
else
|
||||
echo 0 >/sys/fast_classifier/skip_to_bridge_ingress
|
||||
fi
|
||||
if [ "$(uci -q get openmptcprouter.settings.disable_ipv6)" = "0" ]; then
|
||||
sfe_ipv6=$(cat /sys/sfe_ipv6/debug_dev)
|
||||
[ ! -f /dev/sfe_ipv6 ] && mknod /dev/sfe_ipv6 c $sfe_ipv6 0 2>&1 >/dev/null
|
||||
else
|
||||
rm -f /dev/sfe_ipv6
|
||||
fi
|
||||
else
|
||||
rmmod fast_classifier 2>&1 >/dev/null
|
||||
fi
|
||||
|
||||
if [ "$(uci -q get rpcd.@rpcd[0].socket)" != "/var/run/ubus/ubus.sock" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set rpcd.@rpcd[0].socket='/var/run/ubus/ubus.sock'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue