mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-15 03:51:51 +00:00
commit
2b955f1696
15 changed files with 124 additions and 19 deletions
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
|
@ -9,7 +9,7 @@ jobs:
|
|||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
OMR_TARGET: [bpi-r1, bpi-r2, bpi-r64, rpi2, rpi4, wrt32x, espressobin, r2s, rpi3, wrt3200acm, x86, x86_64, ubnt-erx]
|
||||
OMR_TARGET: [bpi-r1, bpi-r2, bpi-r64, rpi2, rpi4, wrt32x, espressobin, r2s, rpi3, wrt3200acm, x86, x86_64, ubnt-erx, r4s]
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
|
||||
|
|
|
@ -144,12 +144,17 @@ config domains
|
|||
config domains
|
||||
option name 'whatsapp.net'
|
||||
option class 'cs2'
|
||||
option comment 'cdn'
|
||||
option comment 'chat'
|
||||
|
||||
config domains
|
||||
option name 'whatsapp.com'
|
||||
option class 'cs2'
|
||||
option comment 'cdn'
|
||||
option comment 'chat'
|
||||
|
||||
config domains
|
||||
option name 'zoom.us'
|
||||
option class 'cs2'
|
||||
option comment 'chat'
|
||||
|
||||
config domains
|
||||
option name 'googleapis.com'
|
||||
|
|
|
@ -1001,6 +1001,18 @@ function settings_add()
|
|||
local disablegwping = luci.http.formvalue("disablegwping") or "0"
|
||||
ucic:set("openmptcprouter","settings","disablegwping",disablegwping)
|
||||
|
||||
-- VPS timeout
|
||||
local status_vps_timeout = luci.http.formvalue("status_vps_timeout") or "1"
|
||||
ucic:set("openmptcprouter","settings","status_vps_timeout",status_vps_timeout)
|
||||
|
||||
-- IP timeout
|
||||
local status_getip_timeout = luci.http.formvalue("status_getip_timeout") or "1"
|
||||
ucic:set("openmptcprouter","settings","status_getip_timeout",status_getip_timeout)
|
||||
|
||||
-- Enable/disable loop detection
|
||||
local disableloopdetection = luci.http.formvalue("disableloopdetection") or "0"
|
||||
ucic:set("openmptcprouter","settings","disableloopdetection",disableloopdetection)
|
||||
|
||||
-- Enable/disable renaming intf
|
||||
local disableintfrename = luci.http.formvalue("disableintfrename") or "0"
|
||||
ucic:set("openmptcprouter","settings","disableintfrename",disableintfrename)
|
||||
|
|
|
@ -254,6 +254,27 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:VPS checks timeout%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" name="status_vps_timeout" class="cbi-input-text" value="<%=luci.model.uci.cursor():get("openmptcprouter","settings","status_vps_timeout")%>">
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:Timeout for VPS checks on status pages%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:WAN IPs retrieve timeout%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" name="status_getip_timeout" class="cbi-input-text" value="<%=luci.model.uci.cursor():get("openmptcprouter","settings","status_getip_timeout")%>">
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:Timeout for retrieving WANs IP on status pages%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:Disable interfaces auto rename%></label>
|
||||
<div class="cbi-value-field">
|
||||
|
@ -290,6 +311,16 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:Disable route loop detection%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="checkbox" name="disableloopdetection" class="cbi-input-checkbox" value="1" <% if luci.model.uci.cursor():get("openmptcprouter","settings","disableloopdetection") == "1" then %>checked<% end %>>
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:Disable route loop detection%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:Disable tracebox test%></label>
|
||||
<div class="cbi-value-field">
|
||||
|
|
|
@ -463,6 +463,7 @@ local statuslogo = ucic:get("openmptcprouter","settings","statuslogo") or "openm
|
|||
var multipath_state = mArray.wans[i].multipath_state;
|
||||
var duplicateif = mArray.wans[i].duplicateif;
|
||||
var duplicatemac = mArray.wans[i].duplicatemac;
|
||||
var loop = mArray.wans[i].loop;
|
||||
// Generate template
|
||||
if(mArray.openmptcprouter.remote_from_lease == true && mArray.wans.length == 1)
|
||||
{
|
||||
|
@ -622,6 +623,10 @@ local statuslogo = ucic:get("openmptcprouter","settings","statuslogo") or "openm
|
|||
statusMessage += '<%:Network interface MAC address duplicated%>' + '<br />';
|
||||
statusMessageClass = "error";
|
||||
}
|
||||
if(loop)
|
||||
{
|
||||
statusMessage += '<%:Looping route detected%>' + '<br />';
|
||||
}
|
||||
if(ipv6_discover == 'DETECTED')
|
||||
{
|
||||
statusMessage += '<%:IPv6 route received%>' + '<br />'
|
||||
|
|
|
@ -3,11 +3,14 @@
|
|||
|
||||
intf=$1
|
||||
|
||||
timeout=$(uci -q get openmptcprouter.settings.status_getip_timeout)
|
||||
[ -z "$timeout" ] && timeout="1"
|
||||
|
||||
get_ip_from_server() {
|
||||
serverport=$(uci -q get openmptcprouter.$1.port)
|
||||
get_ip() {
|
||||
serverip=$1
|
||||
getip="$(curl -s -k -4 -m 2 --interface $intf https://$serverip:$serverport/clienthost)"
|
||||
getip="$(curl -s -k -4 -m ${timeout} --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
|
||||
|
@ -23,7 +26,7 @@ get_ip_from_website() {
|
|||
[ -z "$check_ipv4_website" ] && check_ipv4_website="http://ip.openmptcprouter.com"
|
||||
checkip=$(echo $check_ipv4_website | sed -e 's/https:\/\///' -e 's/http:\/\///' | xargs dig +short A | tr -d "\n")
|
||||
ipset add ss_rules_dst_bypass_all $checkip > /dev/null 2>&1
|
||||
getip="$(curl -s -4 -m 2 --interface $intf $check_ipv4_website)"
|
||||
getip="$(curl -s -4 -m ${timeout} --interface $intf $check_ipv4_website)"
|
||||
ipset del ss_rules_dst_bypass_all $checkip > /dev/null 2>&1
|
||||
if expr "$getip" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' >/dev/null; then
|
||||
ip=$getip
|
||||
|
|
|
@ -3,10 +3,13 @@
|
|||
|
||||
intf=$1
|
||||
|
||||
timeout=$(uci -q get openmptcprouter.settings.status_getip_timeout)
|
||||
[ -z "$timeout" ] && timeout="1"
|
||||
|
||||
get_ip_from_server() {
|
||||
serverport=$(uci -q get openmptcprouter.$1.port)
|
||||
get_ip() {
|
||||
getip="$(curl -s -k -6 -m 2 --interface $intf https://$serverip:$serverport/clienthost)"
|
||||
getip="$(curl -s -k -6 -m ${timeout} --interface $intf https://$serverip:$serverport/clienthost)"
|
||||
[ -n "$getip" ] && getip=$(echo $getip | jsonfilter -e '@.client_host')
|
||||
if [ -n "$(echo "$getip" | grep :)" ]; then
|
||||
ip=$getip
|
||||
|
@ -22,7 +25,7 @@ get_ip_from_website() {
|
|||
[ -z "$check_ipv6_website" ] && check_ipv6_website="http://ipv6.openmptcprouter.com"
|
||||
checkip=$(echo $check_ipv6_website | sed -e 's/https:\/\///' -e 's/http:\/\///' | xargs dig +short AAAA | tr -d "\n")
|
||||
ipset add ss_rules6_dst_bypass_all $checkip > /dev/null 2>&1
|
||||
getip="$(curl -s -6 -m 2 --interface $intf $check_ipv6_website)"
|
||||
getip="$(curl -s -6 -m ${timeout} --interface $intf $check_ipv6_website)"
|
||||
ipset del ss_rules6_dst_bypass_all $checkip > /dev/null 2>&1
|
||||
if [ -n "$(echo "$getip" | grep :)" ]; then
|
||||
ip=$getip
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
. /lib/functions.sh
|
||||
|
||||
intf=$1
|
||||
timeout="$(uci -q get openmptcprouter.settings.status_vps_timeout)"
|
||||
[ -z "$timeout" ] && timeout="1"
|
||||
|
||||
[ -z "$intf" ] && return
|
||||
|
||||
|
@ -10,9 +12,9 @@ get_mptcp_from_server() {
|
|||
get_mptcp() {
|
||||
serverip=$1
|
||||
if [ "$(echo $serverip | grep :)" ]; then
|
||||
support="$(curl -s -k -6 -m 2 --interface $intf https://[$serverip]:$serverport/mptcpsupport)"
|
||||
support="$(curl -s -k -6 -m ${timeout} --interface $intf https://[$serverip]:$serverport/mptcpsupport)"
|
||||
else
|
||||
support="$(curl -s -k -4 -m 2 --interface $intf https://$serverip:$serverport/mptcpsupport)"
|
||||
support="$(curl -s -k -4 -m ${timeout} --interface $intf https://$serverip:$serverport/mptcpsupport)"
|
||||
fi
|
||||
[ -n "$support" ] && {
|
||||
support=$(echo $support | jsonfilter -e '@.mptcp')
|
||||
|
@ -26,7 +28,7 @@ get_mptcp_from_server() {
|
|||
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)"
|
||||
support="$(curl -s -4 -m ${timeout} --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
|
||||
|
@ -40,7 +42,7 @@ get_mptcp_from_website() {
|
|||
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)"
|
||||
support="$(curl -s -6 -m ${timeout} --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
|
||||
|
|
9
luci-app-openmptcprouter/root/bin/omr-routing-loop
Executable file
9
luci-app-openmptcprouter/root/bin/omr-routing-loop
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
VPS=$1
|
||||
LANIP=$2
|
||||
|
||||
if [ -n "$(traceroute -q 1 -i eth1 -w 1 -n -m 5 ${VPS} | grep ${LANIP})" ]; then
|
||||
echo "detected"
|
||||
else
|
||||
echo "no loop"
|
||||
fi
|
|
@ -88,13 +88,13 @@ if [ "$(uci -q get openmptcprouter.settings.check_ipv6_website)" = "" ]; then
|
|||
fi
|
||||
if [ "$(uci -q get openmptcprouter.settings.status_vps_timeout)" = "" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set openmptcprouter.settings.status_vps_timeout=2
|
||||
set openmptcprouter.settings.status_vps_timeout=1
|
||||
commit openmptcprouter
|
||||
EOF
|
||||
fi
|
||||
if [ "$(uci -q get openmptcprouter.settings.status_getip_timeout)" = "" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set openmptcprouter.settings.status_getip_timeout=2
|
||||
set openmptcprouter.settings.status_getip_timeout=1
|
||||
commit openmptcprouter
|
||||
EOF
|
||||
fi
|
||||
|
|
|
@ -763,7 +763,7 @@ function interfaces_status()
|
|||
mArray.openmptcprouter["omr_time"] = os.time()
|
||||
-- dns
|
||||
mArray.openmptcprouter["dns"] = false
|
||||
local timeout = uci:get("openmptcprouter","settings","status_getip_timeout") or "2"
|
||||
local timeout = uci:get("openmptcprouter","settings","status_getip_timeout") or "1"
|
||||
local dns_test = sys.exec("dig +timeout=" .. timeout .. " +tries=1 openmptcprouter.com | grep 'ANSWER: 0'")
|
||||
if dns_test == "" then
|
||||
mArray.openmptcprouter["dns"] = true
|
||||
|
@ -848,7 +848,7 @@ function interfaces_status()
|
|||
mArray.openmptcprouter["vps_omr_version"] = uci:get("openmptcprouter", s[".name"], "omr_version") or ""
|
||||
mArray.openmptcprouter["vps_kernel"] = uci:get("openmptcprouter",s[".name"],"kernel") or ""
|
||||
mArray.openmptcprouter["vps_machine"] = uci:get("openmptcprouter",s[".name"],"machine") or ""
|
||||
timeout = uci:get("openmptcprouter","settings","status_vps_timeout") or "2"
|
||||
timeout = uci:get("openmptcprouter","settings","status_vps_timeout") or "1"
|
||||
if uci:get("openmptcprouter",s[".name"],"admin_error") == "1" then
|
||||
mArray.openmptcprouter["vps_admin_error"] = true
|
||||
end
|
||||
|
@ -1484,6 +1484,10 @@ function interfaces_status()
|
|||
end
|
||||
end
|
||||
end
|
||||
loop = false
|
||||
if uci:get("openmptcprouter", interface, "loop") == "1" then
|
||||
loop = true
|
||||
end
|
||||
end
|
||||
local rx = ""
|
||||
local tx = ""
|
||||
|
@ -1536,6 +1540,7 @@ function interfaces_status()
|
|||
zonewan = zonewan,
|
||||
iftype = itype,
|
||||
state = state,
|
||||
loop = loop,
|
||||
}
|
||||
if ifname ~= nil and ifname:match("^tun.*") then
|
||||
table.insert(mArray.tunnels, data);
|
||||
|
|
|
@ -66,7 +66,7 @@ _setup_interface() {
|
|||
uci -q set network.$1_dev.mtu=$(uci -q get network.$1.mtu)
|
||||
[ -z "$(uci -q get network.$1.masterintf)" ] && uci -q set network.$1.masterintf=$(uci -q get network.$1_dev.ifname)
|
||||
[ -n "$(uci -q get network.$1.masterintf)" ] && uci -q set network.$1_dev.ifname=$(uci -q get network.$1.masterintf)
|
||||
[ -z "$(uci -q get network.$1.macaddr)" ] && uci -q set network.$1_dev.macaddr=$(uci -q get network.$1.macaddr)
|
||||
[ -n "$(uci -q get network.$1.macaddr)" ] && uci -q set network.$1_dev.macaddr=$(uci -q get network.$1.macaddr)
|
||||
uci set network.$1.ifname=$1
|
||||
uci -q commit network
|
||||
return 0
|
||||
|
@ -83,7 +83,7 @@ _setup_interface() {
|
|||
set network.$1.defaultroute=0
|
||||
EOF
|
||||
|
||||
_macaddr=$(uci -q get "network.$1.macaddr")
|
||||
#_macaddr=$(uci -q get "network.$1.macaddr")
|
||||
_setup_macaddr "$1" "${_macaddr:-auto$(date +%s)}"
|
||||
uci -q set network.$1_dev.mtu=$(uci -q get network.$1.mtu)
|
||||
uci -q commit network
|
||||
|
|
|
@ -1124,6 +1124,35 @@ if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc)" = "" ] || [ $(($(
|
|||
[ -n "$asn" ] && {
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.asn="$asn"
|
||||
}
|
||||
|
||||
# Routing loop detection
|
||||
local lanip="$(uci -q network.lan.ipaddr)"
|
||||
local masterip
|
||||
get_master_ip() {
|
||||
if [ "$(openmptcprouter.$1.multipath)" = "master" ]; then
|
||||
masterip="$(uci -q get openmptcprouter.$1.publicip)"
|
||||
fi
|
||||
}
|
||||
config_load openmptcprouter
|
||||
config_foreach get_master_ip interface
|
||||
if [ -n "$lanip" ] && [ -n "$masterip" ] && [ -n "$ipaddr" ] && [ "$ipaddr" = "$masterip" ] && [ "$(uci -q get openmptcprouter.settings.disableloopdetection)" != "1" ]; then
|
||||
loop=0
|
||||
routingloop() {
|
||||
if [ "$(omr-routing-loop $1 $lanip)" = "detected" ]; then
|
||||
loop=1
|
||||
fi
|
||||
}
|
||||
config_load openmptcprouter
|
||||
config_foreach routingloop server
|
||||
if [ "$loop" = "1" ]; then
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.loop='1'
|
||||
else
|
||||
uci -q delete openmptcprouter.$OMR_TRACKER_INTERFACE.loop
|
||||
fi
|
||||
else
|
||||
uci -q delete openmptcprouter.$OMR_TRACKER_INTERFACE.loop
|
||||
fi
|
||||
|
||||
local omrtracebox
|
||||
traceboxmtutest() {
|
||||
omr_tracebox_mtu() {
|
||||
|
|
|
@ -61,7 +61,8 @@ set_ipv6_state() {
|
|||
set dhcp.lan.ra_default="1"
|
||||
set dhcp.lan.ra_preference="high"
|
||||
set dhcp.lan.ra_management="1"
|
||||
set dhcp.lan.ra_flags='managed-config'
|
||||
delete dhcp.lan.ra_flags
|
||||
add_list dhcp.lan.ra_flags='managed-config'
|
||||
set dhcp.lan.ra_slaac='1'
|
||||
add_list dhcp.lan.ra_flags='other-config'
|
||||
set network.lan.ipv6="1"
|
||||
|
|
|
@ -77,7 +77,7 @@ MY_DEPENDS := \
|
|||
!TARGET_mvebu:kmod-usb-serial !TARGET_mvebu:kmod-usb-serial-option !TARGET_mvebu:kmod-usb-serial-wwan !TARGET_mvebu:usb-modeswitch !TARGET_mvebu:uqmi \
|
||||
!TARGET_mvebu:umbim !TARGET_mvebu:kmod-mii !TARGET_mvebu:kmod-usb-net !TARGET_mvebu:kmod-usb-wdm !TARGET_mvebu:kmod-usb-net-qmi-wwan !TARGET_mvebu:kmod-usb-net-cdc-mbim !TARGET_mvebu:umbim \
|
||||
!TARGET_mvebu:kmod-usb-net-huawei-cdc-ncm !TARGET_mvebu:kmod-usb-net-rndis !TARGET_mvebu:kmod-usb-net-cdc-ether !TARGET_mvebu:kmod-usb-net-ipheth !TARGET_mvebu:usbmuxd \
|
||||
kmod-rt2800-usb kmod-rtl8xxxu kmod-rtl8192cu kmod-net-rtl8192su \
|
||||
kmod-rt2800-usb kmod-rtl8xxxu kmod-rtl8192cu kmod-net-rtl8192su kmod-rtl8812au-ct \
|
||||
!TARGET_mvebu:luci-proto-qmi wpad-basic kmod-mt7601u kmod-rtl8187 \
|
||||
luci-app-mlvpn mlvpn 464xlat !TARGET_mvebu:kmod-usb-net-smsc75xx kmod-zram kmod-swconfig swconfig kmod-ipt-nat kmod-ipt-nat6 luci-app-https-dns-proxy kmod-tcp-nanqinlang (TARGET_x86_64||aarch64):kmod-tcp-bbr2 iptables-mod-ipopt igmpproxy ss iptraf-ng \
|
||||
luci-app-acl block-mount blockd fstools luci-app-shutdown libwebp luci-proto-gre tcptraceroute luci-proto-mbim kmod-rtl8xxxu kmod-ath9k-htc luci-app-ttyd luci-mod-dashboard (TARGET_x86||TARGET_x86_64):rtl8192eu-firmware kmod-usb2 libustream-wolfssl (TARGET_x86||TARGET_x86_64):kmod-ixgbevf \
|
||||
|
|
Loading…
Reference in a new issue