diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 600e7ff77..e85491615 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -46,6 +46,7 @@ jobs: git clone --depth 1 $REPO_URL omr cd omr if [ "$SOURCE_NAME" != "Test-Github-Actions" ] && [ "$SOURCE_NAME" != "develop" ]; then + git fetch git checkout master else git checkout develop diff --git a/glorytun-udp/init b/glorytun-udp/init index 1a3273e33..638736017 100755 --- a/glorytun-udp/init +++ b/glorytun-udp/init @@ -80,6 +80,9 @@ start_instance() { procd_close_instance + tc qdisc replace dev ${dev} root cake + + #ip link set $dev txqlen 100 #config_load network #config_foreach add_glorytun_path interface diff --git a/luci-app-openmptcprouter/htdocs/luci-static/resources/openmptcprouter/css/wanstatus.css b/luci-app-openmptcprouter/htdocs/luci-static/resources/openmptcprouter/css/wanstatus.css index 3bf9dc7dc..2e90291e6 100644 --- a/luci-app-openmptcprouter/htdocs/luci-static/resources/openmptcprouter/css/wanstatus.css +++ b/luci-app-openmptcprouter/htdocs/luci-static/resources/openmptcprouter/css/wanstatus.css @@ -194,7 +194,7 @@ right connector from last child*/ border-left: 2px solid black; border-bottom: none; width: 2px; - height: 30px; + height: 20em; z-index: -10; } .remote-from-lease a { diff --git a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua index 369c7ffc1..1bb28c3b1 100644 --- a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua +++ b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua @@ -93,7 +93,9 @@ function wizard_add() ucic:foreach("network", "interface", function(s) local sectionname = s[".name"] if sectionname:match("^wan(%d+)$") then - i = i + 1 + if i <= tonumber(string.match(sectionname, '%d+')) then + i = tonumber(string.match(sectionname, '%d+')) + 1 + end end if ucic:get("network",sectionname,"multipath") == "master" then multipath_master = true diff --git a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm index 0e4432ad3..8605f16d3 100644 --- a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm +++ b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm @@ -390,16 +390,30 @@ end <% iffind=0 for _, ifacea in ipairs(ifaces) do - if not (ifacea == "lo" or ifacea == "6in4-omr6in4" or ifacea == "mlvpn0" or ifacea:match("^ifb.*") or ifacea:match("^sit.*") or ifacea:match("^gre.*") or ifacea:match("^ip6.*") or ifacea:match("^teql.*") or ifacea:match("^erspan.*") or ifacea:match("^tun.*")) and device_notvirtual(ifacea) then + if not (ifacea == "lo" or ifacea == "6in4-omr6in4" or ifacea == "mlvpn0" or ifacea:match("^ifb.*") or ifacea:match("^sit.*") or ifacea:match("^gre.*") or ifacea:match("^ip6.*") or ifacea:match("^teql.*") or ifacea:match("^erspan.*") or ifacea:match("^tun.*")) then + if uci:get("network",ifname,"proto") ~= "macvlan" then %> <% + else + %> + + <% + end end end - if iffinf == 0 and uci:get("network",ifname,"ifname") ~= nil then + if uci:get("network",ifname,"proto") ~= "macvlan" then + if iffind == 0 and uci:get("network",ifname,"ifname") ~= nil then %> <% + end + else + if iffind == 0 and uci:get("network",ifname,"masterintf") ~= nil then + %> + + <% + end end %> @@ -481,7 +495,7 @@ end <% for _, ifacea in ipairs(ifaces) do - if not (ifacea == "lo" or ifacea == "6in4-omr6in4" or ifacea == "mlvpn0" or ifacea:match("^ifb.*") or ifacea:match("^sit.*") or ifacea:match("^gre.*") or ifacea:match("^ip6.*") or ifacea:match("^teql.*") or ifacea:match("^erspan.*")) and device_notvirtual(ifacea) then + if not (ifacea == "lo" or ifacea == "6in4-omr6in4" or ifacea == "mlvpn0" or ifacea:match("^ifb.*") or ifacea:match("^sit.*") or ifacea:match("^gre.*") or ifacea:match("^ip6.*") or ifacea:match("^teql.*") or ifacea:match("^erspan.*")) then %> <% diff --git a/luci-app-openmptcprouter/root/etc/init.d/openmptcprouter b/luci-app-openmptcprouter/root/etc/init.d/openmptcprouter index 8309d6c2d..c49866fd5 100755 --- a/luci-app-openmptcprouter/root/etc/init.d/openmptcprouter +++ b/luci-app-openmptcprouter/root/etc/init.d/openmptcprouter @@ -23,25 +23,27 @@ omr_intf_set() { config_get ifname "$1" ifname config_get device "$1" device config_get proto "$1" proto - config_get addlatency "$1" addlatency "0" + config_get type "$1" type + config_get addlatency "$1" addlatency + [ -z "$addlatency" ] && addlatency=0 devicename=$(echo "$device" | cut -d'/' -f3) [ -z "$ifname" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]') if [ -n "$ifname" ]; then - if [ "$addlatency" = "0" ] && [ "$(tc qdisc show $ifname | grep delay)" != "" ]; then + if [ "$addlatency" = "0" ] && [ "$(tc qdisc show dev $ifname | grep delay)" != "" ]; then tc qdisc del dev ${ifname} root netem fi if [ "$addlatency" != "0" ]; then - if [ "$(tc qdisc show $ifname | grep delay)" != "" ]; then + if [ "$(tc qdisc show dev $ifname | grep delay)" != "" ]; then tc qdisc add dev ${ifname} root netem delay ${addlatency}ms - elif [ "$(tc qdisc show $ifname | awk '/delay/ { print $10 }' | sed 's/ms//')" != "$addlatency" ]; then + elif [ "$(tc qdisc show dev $ifname | awk '/delay/ { print $10 }' | sed 's/ms//')" != "$addlatency" ]; then tc qdisc replace dev ${ifname} root netem delay ${addlatency}ms fi fi fi - if [ -n "$ifname" ] && [ -f /sys/class/net/${ifname}/device/uevent ]; then + if [ "$type" != "macvlan" ] && [ -n "$ifname" ] && [ -f /sys/class/net/${ifname}/device/uevent ]; then devicepath=$(readlink -f /sys/class/net/${ifname}) if [ -n "$devicepath" ] && [ "$(echo ${devicepath} | grep virtual)" = "" ]; then uci -q set network.$1.modalias="$(cat /sys/class/net/${ifname}/device/uevent | grep MODALIAS | cut -d '=' -f2 | tr -d '\n')" @@ -50,7 +52,7 @@ omr_intf_set() { uci -q delete network.$1.device uci -q delete network.$1.modalias fi - elif [ -n "$device" ] && [ -f /sys/bus/usb-serial/devices/${devicename}/device/uevent ]; then + elif [ "$type" != "macvlan" ] && [ -n "$device" ] && [ -f /sys/bus/usb-serial/devices/${devicename}/device/uevent ]; then uci -q set network.$1.modalias="$(cat /sys/bus/usb-serial/devices/${devicename}/device/uevent | grep MODALIAS | cut -d '=' -f2 | tr -d '\n')" uci -q set network.$1.product="$(cat /sys/bus/usb-serial/devices/${devicename}/device/uevent | grep PRODUCT | cut -d '=' -f2 | tr -d '\n')" fi diff --git a/macvlan/files/etc/init.d/macvlan b/macvlan/files/etc/init.d/macvlan index 2a868905d..01a6ee47c 100755 --- a/macvlan/files/etc/init.d/macvlan +++ b/macvlan/files/etc/init.d/macvlan @@ -67,6 +67,7 @@ _setup_interface() { [ -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) + uci set network.$1.ifname=$1 uci -q commit network return 0 } diff --git a/mlvpn/files/etc/config/mlvpn b/mlvpn/files/etc/config/mlvpn index 0f94c7894..53085dc48 100644 --- a/mlvpn/files/etc/config/mlvpn +++ b/mlvpn/files/etc/config/mlvpn @@ -2,7 +2,7 @@ config mlvpn 'general' option enable '0' option password '' option timeout '30' - option reorder_buffer_size '64' + option reorder_buffer_size '128' option loss_tolerence '50' option mode 'client' option host '128.128.128.128' diff --git a/mlvpn/files/etc/init.d/mlvpn b/mlvpn/files/etc/init.d/mlvpn index 6591792d7..761694f6c 100755 --- a/mlvpn/files/etc/init.d/mlvpn +++ b/mlvpn/files/etc/init.d/mlvpn @@ -4,7 +4,6 @@ START=88 SERVICE_DAEMONIZE=1 #SERVICE_SIG="KILL" - interface_multipath_settings() { local mode port local config="$1" @@ -53,9 +52,9 @@ start() { mode = "${mode}" interface_name = "${interface_name}" timeout = ${timeout} - #reorder_buffer = yes + reorder_buffer = yes reorder_buffer_size = ${reorder_buffer_size} - #loss_tolerence = ${loss_tolerence} + loss_tolerence = ${loss_tolerence} password = "${password}" mtu = 1452 EOF @@ -71,3 +70,8 @@ start() { stop() { service_stop /usr/sbin/mlvpn } + +reload() { + stop + start +} \ No newline at end of file diff --git a/mptcp/files/etc/init.d/mptcp b/mptcp/files/etc/init.d/mptcp index 2e5518319..9f0db4286 100755 --- a/mptcp/files/etc/init.d/mptcp +++ b/mptcp/files/etc/init.d/mptcp @@ -46,25 +46,39 @@ interface_macaddr_count() { [ "$macaddr" = "$dmacaddr" ] && nbmac=$((nbmac+1)) } +interface_max_metric() { + local config="$1" + config_get metric "$config" metric + if [ "$metric" = "$count" ]; then + count=$((count+1)) + config_set "$config" metric $count + fi + if [ "$metric" -gt "$count" ]; then + count=$metric + fi +} + interface_multipath_settings() { - local mode iface proto + local mode iface proto metric local config="$1" local intf="$2" local enabled config_get enabled "$config" auto "1" config_get iface "$config" ifname + config_get txqueuelen "$config" txqueuelen [ -z "$iface" ] && iface=$(ifstatus "$config" | jsonfilter -q -e '@["l3_device"]') if [ "$(uci -q get openmptcprouter.${config}.metric)" = "" ]; then - count=$(($count+1)) + count=$((count+1)) + metric=$count else - count="$(uci -q get openmptcprouter.${config}.metric)" + metric="$(uci -q get openmptcprouter.${config}.metric)" fi - config_set "$config" metric $count - uci -q set network.${config}.metric=$count - uci -q set openmptcprouter.${config}.metric=$count + config_set "$config" metric $metric + uci -q set network.${config}.metric=$metric + uci -q set openmptcprouter.${config}.metric=$metric config_get mode "$config" multipath - id=$count + id=$metric [ "$mode" = "" ] && { mode="$(uci -q get openmptcprouter.${config}.multipath)" [ -n "$mode" ] && uci -q set network.${config}.multipath="$mode" @@ -221,11 +235,11 @@ interface_multipath_settings() { #echo "ip route replace default via $gateway dev $iface" ip route replace default via $gateway dev $iface } - [ "$mode" = "off" ] && { - ifconfig $iface txqueuelen 50 > /dev/null 2>&1 - } || { + if [ "$txqueuelen" != "" ]; then + ifconfig $iface txqueuelen $txqueuelen > /dev/null 2>&1 + else ifconfig $iface txqueuelen 100 > /dev/null 2>&1 - } + fi fi if [ "$(uci -q get openmptcprouter.settings.disable_ipv6)" != "1" ] && [ "$config" != "omr6in4" ]; then # IPv6 Updates: @@ -398,6 +412,10 @@ start_service() { mptcpintf="" master="" + count="0" + config_load openmptcprouter + config_foreach interface_max_metric interface + config_load network #config_foreach remove route #config_foreach remove route6 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 4faac7ac0..1a07d20c0 100755 --- a/mptcp/files/usr/share/omr/post-tracking.d/post-tracking +++ b/mptcp/files/usr/share/omr/post-tracking.d/post-tracking @@ -511,13 +511,11 @@ if [ "$multipath_config" = "master" ]; then if [ "$(uci -q get openmptcprouter.settings.master)" != "failover" ]; then config_foreach set_server_default_route server fi - ip route replace default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE table 991337 fi #if [ "$(uci -q get openmptcprouter.settings.master)" = "balancing" ] && [ "$(ip route show default | grep weight)" = "" ] && [ "$(uci -q get openmptcprouter.settings.defaultgw)" != "0" ] && [ "$(uci -q get openmptcprouter.settings.vpn)" != "mlvpn" ]; then if [ "$(uci -q get openmptcprouter.settings.master)" = "balancing" ] && [ "$(ip route show default | grep weight)" = "" ] && [ "$(uci -q get openmptcprouter.settings.defaultgw)" != "0" ]; then omrvpn_intf=$(uci -q get "network.omrvpn.ifname" || echo "tun") if [ -n "$omrvpn_intf" ] && [ "$(ip route show default | awk '/default/ {print $5}' | grep $omrvpn_intf)" = "" ]; then - ip route replace default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE table 991337 routesbalancing="" routesbalancingbackup="" nbintf=0 @@ -537,6 +535,9 @@ if [ "$multipath_config" = "master" ]; then } fi fi + if [ -n "$OMR_TRACKER_DEVICE_GATEWAY" ] && [ -n "$OMR_TRACKER_DEVICE" ] && [ "$(ip r show table 991337)" != "default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE " ]; then + ip route replace default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE table 991337 + fi if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc)" = "" ] || [ $(($(date +"%s") + $((10 + RANDOM % 31)) - $(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc))) -gt 3600 ] || [ "$(uci -q show openmptcprouter | grep get_config=\'1\')" != "" ] || [ "$(uci -q show openmptcprouter | grep admin_error=\'1\')" != "" ]; then /etc/init.d/openmptcprouter-vps restart >/dev/null 2>&1 fi diff --git a/omr-tracker/files/etc/config/omr-tracker b/omr-tracker/files/etc/config/omr-tracker index b3f65e058..cc0aed0cc 100644 --- a/omr-tracker/files/etc/config/omr-tracker +++ b/omr-tracker/files/etc/config/omr-tracker @@ -2,15 +2,15 @@ config defaults 'defaults' option enabled '1' list hosts '4.2.2.1' list hosts '8.8.8.8' + list hosts '80.67.169.12' list hosts '8.8.4.4' list hosts '9.9.9.9' - list hosts '1.1.1.1' list hosts '1.0.0.1' + list hosts '114.114.115.115' list hosts '1.2.4.8' - list hosts '80.67.169.12' list hosts '80.67.169.40' list hosts '114.114.114.114' - list hosts '114.114.115.115' + list hosts '1.1.1.1' option timeout '2' option tries '3' option interval '2' @@ -20,12 +20,12 @@ config defaults 'defaults' config proxy 'proxy' option enabled '1' - list hosts '1.1.1.1' list hosts '1.0.0.1' list hosts '212.27.48.10' list hosts '198.27.92.1' list hosts '151.101.129.164' list hosts '77.88.55.77' + list hosts '1.1.1.1' list hosts '74.82.42.42' list hosts '176.103.130.130' option timeout '10' diff --git a/openmptcprouter/files/etc/firewall.gre-tunnel b/openmptcprouter/files/etc/firewall.gre-tunnel index 037f135f7..41b00e664 100644 --- a/openmptcprouter/files/etc/firewall.gre-tunnel +++ b/openmptcprouter/files/etc/firewall.gre-tunnel @@ -11,8 +11,10 @@ _setup_rules() { _setup_routes() { config_get lookup $1 lookup config_get gateway $1 gateway - intf=$(ifstatus | jsonfilter -e '@.l3_device' | tr -d "\n") - ip route replace default via $gateway dev $intf table $lookup + intf=$(ifstatus $1 | jsonfilter -e '@.l3_device' | tr -d "\n") + if [ -n "$lookup" ] && [ -n "$intf" ] && [ -n "$gateway" ]; then + ip route replace default via $gateway dev $intf table $lookup + fi } config_load network config_foreach _setup_rules interface diff --git a/openmptcprouter/files/etc/init.d/openmptcprouter-vps b/openmptcprouter/files/etc/init.d/openmptcprouter-vps index 65a7d4f11..33383f44e 100755 --- a/openmptcprouter/files/etc/init.d/openmptcprouter-vps +++ b/openmptcprouter/files/etc/init.d/openmptcprouter-vps @@ -668,6 +668,7 @@ _set_vpn_ip() { vpnip_remote=$(ip -4 r list dev ${vpnifname} | grep via | grep -v default | grep -v / | grep -v metric | awk '{print $1}' | tr -d "\n") [ -z "$vpnip_remote" ] && vpnip_remote=$(ip -4 r list dev ${vpnifname} | grep kernel | awk '{print $1}' | tr -d "\n") [ -z "$vpnip_remote" ] && vpnip_remote=$(ip -4 r list dev ${vpnifname} | grep "proto static src" | awk '{print $3}' | tr -d "\n") + [ -z "$vpnip_remote" ] && vpnip_remote=$(ifstatus omrvpn | jsonfilter -e '@.route[0].nexthop') ula="$(uci -q get network.globals.ula_prefix)" ula_current="$(echo "$vps_config" | jsonfilter -q -e '@.ip6in4.ula')" if [ "$vpnip_remote" != "" ] && [ "$vpnip_local" != "" ] && ([ "$vpnip_remote" != "$vpnip_remote_current" ] || [ "$vpnip_local" != "$vpnip_local_current" ] || [ "$ula" != "$ula_current" ]); then @@ -724,7 +725,7 @@ _vps_firewall_redirect_port() { #uci -q delete firewall.$1 #return fi - [ "$(v2ray.main.enabled)" = "0" ] && v2ray="0" + [ "$(uci -q get v2ray.main.enabled)" = "0" ] && v2ray="0" [ "$proto" = "all" ] && proto="tcp udp" [ "$proto" = "" ] && proto="tcp udp" [ "$src" = "vpn" ] && [ -n "$proto" ] && [ -n "$src_dport" ] && [ "$enabled" != "0" ] && { diff --git a/openmptcprouter/files/etc/uci-defaults/1980-omr-firewall b/openmptcprouter/files/etc/uci-defaults/1980-omr-firewall index 5dfb44313..a76ef9bea 100755 --- a/openmptcprouter/files/etc/uci-defaults/1980-omr-firewall +++ b/openmptcprouter/files/etc/uci-defaults/1980-omr-firewall @@ -16,16 +16,16 @@ if [ "$(uci -q get firewall.@zone[2].name)" = "vpn" ]; then fi if [ "$(uci -q get firewall.zone_vpn)" = "" ]; then - uci -q batch <<-EOF >/dev/null - set firewall.zone_vpn=zone - set firewall.zone_vpn.name=vpn - set firewall.zone_vpn.network=glorytun - set firewall.zone_vpn.masq=1 - set firewall.zone_vpn.input=REJECT - set firewall.zone_vpn.forward=ACCEPT - set firewall.zone_vpn.output=ACCEPT - commit firewall - EOF + uci -q batch <<-EOF >/dev/null + set firewall.zone_vpn=zone + set firewall.zone_vpn.name=vpn + set firewall.zone_vpn.network=glorytun + set firewall.zone_vpn.masq=1 + set firewall.zone_vpn.input=REJECT + set firewall.zone_vpn.forward=ACCEPT + set firewall.zone_vpn.output=ACCEPT + commit firewall + EOF fi if [ "$(uci -q get firewall.@rule[5].name)" = "Allow-ICMPv6-Input" ]; then @@ -131,6 +131,26 @@ if [ "$(uci -q get firewall.fwlantovpn)" = "" ]; then commit firewall EOF fi + +if [ "$(uci -q get firewall.blockquicproxy)" = "" ]; then + uci -q batch <<-EOF >/dev/null + set firewall.blockquicproxy=rule + set firewall.blockquicproxy.name='Block QUIC Proxy' + set firewall.blockquicproxy.proto='udp' + set firewall.blockquicproxy.dest_port='443' + set firewall.blockquicproxy.target='DROP' + set firewall.blockquicproxy.src='lan' + set firewall.blockquicall=rule + set firewall.blockquicall.name='Block QUIC All' + set firewall.blockquicall.proto='udp' + set firewall.blockquicall.src='*' + set firewall.blockquicall.dest='*' + set firewall.blockquicall.dest_port='443' + set firewall.blockquicall.target='DROP' + commit firewall + EOF +fi + uci -q batch <<-EOF >/dev/null set firewall.@zone[0].mtu_fix='1' set firewall.zone_vpn.mtu_fix='1' diff --git a/v2ray-core/files/etc/uci-defaults/3010-omr-v2ray b/v2ray-core/files/etc/uci-defaults/3010-omr-v2ray index 28939a191..3388a1663 100644 --- a/v2ray-core/files/etc/uci-defaults/3010-omr-v2ray +++ b/v2ray-core/files/etc/uci-defaults/3010-omr-v2ray @@ -23,7 +23,7 @@ if [ -z "$(uci -q get v2ray.main)" ]; then set v2ray.policy_level_0=policy_level set v2ray.policy_level_0.level='0' set v2ray.policy_level_0.handshake='4' - set v2ray.policy_level_0.conn_idle='600' + set v2ray.policy_level_0.conn_idle='2400' set v2ray.policy_level_0.uplink_only='0' set v2ray.policy_level_0.downlink_only='0' set v2ray.policy_level_0.buffer_size='512' @@ -94,11 +94,17 @@ EOF if [ "$(uci -q get firewall.v2ray)" = "" ]; then uci -q batch <<-EOF >/dev/null set firewall.v2ray=include - set firewall.v2ray.path=/etc/firewall.v2ray + set firewall.v2ray.path=/etc/firewall.v2ray-rules set firewall.v2ray.reload=1 commit firewall EOF fi +if [ "$(uci -q get firewall.v2ray.path)" != "/etc/firewall.v2ray-rules" ]; then + uci -q batch <<-EOF >/dev/null + set firewall.v2ray.path=/etc/firewall.v2ray-rules + commit firewall + EOF +fi if [ "$(uci -q get v2ray.main_reverse.bridges | grep omrbridge)" = "" ]; then uci -q batch <<-EOF >/dev/null