diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 045706697..a75f5720c 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,7 +9,7 @@ jobs: build: strategy: matrix: - OMR_TARGET: [bpi-r1, bpi-r2, bpi-r64, rpi2, rpi4, x86_64] + 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 diff --git a/luci-app-omr-dscp/root/etc/config/dscp b/luci-app-omr-dscp/root/etc/config/dscp index 73211289f..ef2ef31f2 100755 --- a/luci-app-omr-dscp/root/etc/config/dscp +++ b/luci-app-omr-dscp/root/etc/config/dscp @@ -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' diff --git a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua index decb088aa..9aef3a1f7 100755 --- a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua +++ b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua @@ -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) diff --git a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/settings.htm b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/settings.htm index cdcd3c958..67bfa50c1 100755 --- a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/settings.htm +++ b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/settings.htm @@ -254,6 +254,27 @@ +
+ +
+ "> +
+
+ <%:Timeout for VPS checks on status pages%> +
+
+
+
+ +
+ "> +
+
+ <%:Timeout for retrieving WANs IP on status pages%> +
+
+
+
@@ -290,6 +311,16 @@
+
+ +
+ checked<% end %>> +
+
+ <%:Disable route loop detection%> +
+
+
diff --git a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wanstatus.htm b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wanstatus.htm index 73beda8bf..5f248ab31 100755 --- a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wanstatus.htm +++ b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wanstatus.htm @@ -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%>' + '
'; statusMessageClass = "error"; } + if(loop) + { + statusMessage += '<%:Looping route detected%>' + '
'; + } if(ipv6_discover == 'DETECTED') { statusMessage += '<%:IPv6 route received%>' + '
' diff --git a/luci-app-openmptcprouter/root/bin/omr-ip-intf b/luci-app-openmptcprouter/root/bin/omr-ip-intf index d09dfa07d..1fffd1036 100755 --- a/luci-app-openmptcprouter/root/bin/omr-ip-intf +++ b/luci-app-openmptcprouter/root/bin/omr-ip-intf @@ -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 diff --git a/luci-app-openmptcprouter/root/bin/omr-ip6-intf b/luci-app-openmptcprouter/root/bin/omr-ip6-intf index 12e3bdbc3..2166441d9 100755 --- a/luci-app-openmptcprouter/root/bin/omr-ip6-intf +++ b/luci-app-openmptcprouter/root/bin/omr-ip6-intf @@ -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 diff --git a/luci-app-openmptcprouter/root/bin/omr-mptcp-intf b/luci-app-openmptcprouter/root/bin/omr-mptcp-intf index 9df22c688..d2a74b245 100755 --- a/luci-app-openmptcprouter/root/bin/omr-mptcp-intf +++ b/luci-app-openmptcprouter/root/bin/omr-mptcp-intf @@ -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 diff --git a/luci-app-openmptcprouter/root/bin/omr-routing-loop b/luci-app-openmptcprouter/root/bin/omr-routing-loop new file mode 100755 index 000000000..396498470 --- /dev/null +++ b/luci-app-openmptcprouter/root/bin/omr-routing-loop @@ -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 \ No newline at end of file diff --git a/luci-app-openmptcprouter/root/etc/uci-defaults/openmptcprouter b/luci-app-openmptcprouter/root/etc/uci-defaults/openmptcprouter index fbcc9968e..f8a0dc21c 100755 --- a/luci-app-openmptcprouter/root/etc/uci-defaults/openmptcprouter +++ b/luci-app-openmptcprouter/root/etc/uci-defaults/openmptcprouter @@ -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 diff --git a/luci-app-openmptcprouter/root/usr/libexec/rpcd/openmptcprouter b/luci-app-openmptcprouter/root/usr/libexec/rpcd/openmptcprouter index cdd3308df..350172aad 100755 --- a/luci-app-openmptcprouter/root/usr/libexec/rpcd/openmptcprouter +++ b/luci-app-openmptcprouter/root/usr/libexec/rpcd/openmptcprouter @@ -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); diff --git a/macvlan/files/etc/init.d/macvlan b/macvlan/files/etc/init.d/macvlan index 01a6ee47c..2832e5133 100755 --- a/macvlan/files/etc/init.d/macvlan +++ b/macvlan/files/etc/init.d/macvlan @@ -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 diff --git a/mptcp/files/usr/share/omr/post-tracking.d/post-tracking b/mptcp/files/usr/share/omr/post-tracking.d/post-tracking index a44e9d0c2..49a81b56f 100755 --- a/mptcp/files/usr/share/omr/post-tracking.d/post-tracking +++ b/mptcp/files/usr/share/omr/post-tracking.d/post-tracking @@ -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() { diff --git a/omr-6in4/files/etc/init.d/omr-6in4 b/omr-6in4/files/etc/init.d/omr-6in4 index 757ee609c..5bec94c02 100755 --- a/omr-6in4/files/etc/init.d/omr-6in4 +++ b/omr-6in4/files/etc/init.d/omr-6in4 @@ -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" diff --git a/openmptcprouter-full/Makefile b/openmptcprouter-full/Makefile index 5f24f8029..d83c4733d 100755 --- a/openmptcprouter-full/Makefile +++ b/openmptcprouter-full/Makefile @@ -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 \