diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0f1fe5ec1..837a083b9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,7 +8,7 @@ jobs: build: strategy: matrix: - OMR_TARGET: [bpi-r1, bpi-r2, bpi-r3, bpi-r4, bpi-r4-poe, bpi-r64, rpi2, rpi4, wrt32x, espressobin, r2s, rpi3, wrt3200acm, x86, x86_64, ubnt-erx, r4s, r7800, rutx12, rutx50, r5s, qnap-301w, rpi5, z8102ax_128m, z8102ax_64m, gl-mt6000, gl-mt3000, gl-mt2500, r5c, z8109ax_128m] + OMR_TARGET: [bpi-r1, bpi-r2, bpi-r3, bpi-r4, bpi-r4-poe, bpi-r64, rpi2, rpi4, wrt32x, espressobin, r2s, rpi3, wrt3200acm, x86, x86_64, ubnt-erx, r4s, r7800, rutx12, rutx50, r5s, qnap-301w, rpi5, z8102ax_128m, z8102ax_64m, z8102ax-emmc, gl-mt6000, gl-mt3000, gl-mt2500, r5c, z8109ax_128m] OMR_KERNEL: [6.6, 6.12] runs-on: ubuntu-latest continue-on-error: true diff --git a/omr-tracker/files/bin/omr-tracker b/omr-tracker/files/bin/omr-tracker index 4b0554213..c2c9d9b35 100755 --- a/omr-tracker/files/bin/omr-tracker +++ b/omr-tracker/files/bin/omr-tracker @@ -678,7 +678,7 @@ while true; do if [ -n "$OMR_TRACKER_LOSS" ] && [ -n "$OMR_TRACKER_RECOVERY_LOSS" ] && [ "$OMR_TRACKER_LOSS" -ge "$OMR_TRACKER_FAILURE_LOSS" ]; then OMR_TRACKER_STATUS="ERROR" OMR_TRACKER_STATUS_MSG="Packet loss is $OMR_TRACKER_LOSS this is more than failure limit defined at $OMR_TRACKER_FAILURE_LOSS" - elif [ -n "$OMR_TRACKER_LATENCY" ] && [ -n "$OMR_TRACKER_FAILURE_LATENCY"] && [ "$OMR_TRACKER_LATENCY" -ge "$OMR_TRACKER_FAILURE_LATENCY" ]; then + elif [ -n "$OMR_TRACKER_LATENCY" ] && [ -n "$OMR_TRACKER_FAILURE_LATENCY" ] && [ "$OMR_TRACKER_LATENCY" -ge "$OMR_TRACKER_FAILURE_LATENCY" ]; then OMR_TRACKER_STATUS="ERROR" OMR_TRACKER_STATUS_MSG="Latency is $OMR_TRACKER_LATENCY this is more than failure limit defined at $OMR_TRACKER_FAILURE_LATENCY" fi diff --git a/openmptcprouter/files/etc/init.d/openmptcprouter-vps b/openmptcprouter/files/etc/init.d/openmptcprouter-vps index 34006ddb0..d63ee38cb 100755 --- a/openmptcprouter/files/etc/init.d/openmptcprouter-vps +++ b/openmptcprouter/files/etc/init.d/openmptcprouter-vps @@ -1,5 +1,5 @@ #!/bin/sh /etc/rc.common -# Copyright (C) 2018-2023 Ycarus (Yannick Chabanois) +# Copyright (C) 2018-2025 Ycarus (Yannick Chabanois) # Released under GPL 3. See LICENSE for the full terms. START=99 @@ -45,19 +45,19 @@ _login() { server=$1 [ -n "$token" ] && return #auth=`curl --max-time 10 -s -k -H "Content-Type: application/json" -X POST -d '{"username":"'$username'","password":"'$password'"}' https://$server:$serverport/login` - resolve="$(resolveip -t 5 $server)" + #resolve="$(resolveip -t 5 $server)" valid_ip6=$(valid_subnet6 $server) - if [ "$resolve" != "$server" ] || [ "$valid_ip6" != "ok" ]; then - auth=`curl --max-time 10 -s -k -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -X POST -d 'username='$username'&password='$password https://$server:$serverport/token` - else + if [ "$valid_ip6" = "ok" ]; then auth=`curl --max-time 10 -s -k -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -X POST -d 'username='$username'&password='$password https://[$server]:$serverport/token` + else + auth=`curl --max-time 10 -s -k -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -X POST -d 'username='$username'&password='$password https://$server:$serverport/token` fi if [ -z "$auth" ]; then for intf in $(multipath 2>/dev/null | awk '/default/ { print $1 }'); do - if [ "$resolve" != "$server" ] || [ "$valid_ip6" != "ok" ]; then - auth=`curl --max-time 10 -s -k --interface $intf -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -X POST -d 'username='$username'&password='$password https://$server:$serverport/token` - else + if [ "$valid_ip6" = "ok" ]; then auth=`curl --max-time 10 -s -k --interface $intf -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -X POST -d 'username='$username'&password='$password https://[$server]:$serverport/token` + else + auth=`curl --max-time 10 -s -k --interface $intf -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -X POST -d 'username='$username'&password='$password https://$server:$serverport/token` fi [ -n "$auth" ] && break done @@ -85,17 +85,17 @@ _get_json() { [ -n "$token" ] && { resolve="$(resolveip -t 5 $server)" valid_ip6=$(valid_subnet6 $server) - if [ "$resolve" != "$server" ] || [ "$valid_ip6" != "ok" ]; then - result=`curl --max-time 10 -s -k -H "accept: application/json" -H "Authorization: Bearer $token" https://$server:$serverport/$route` - else + if [ "$valid_ip6" = "ok" ]; then result=`curl --max-time 10 -s -k -H "accept: application/json" -H "Authorization: Bearer $token" https://[$server]:$serverport/$route` + else + result=`curl --max-time 10 -s -k -H "accept: application/json" -H "Authorization: Bearer $token" https://$server:$serverport/$route` fi if [ -z "$result" ]; then for intf in $(multipath 2>/dev/null | awk '/default/ { print $1 }'); do - if [ "$resolve" != "$server" ] || [ "$valid_ip6" != "ok" ]; then - result=`curl --max-time 10 -s -k --interface $intf -H "accept: application/json" -H "Authorization: Bearer $token" https://$server:$serverport/$route` - else + if [ "$valid_ip6" = "ok" ]; then result=`curl --max-time 10 -s -k --interface $intf -H "accept: application/json" -H "Authorization: Bearer $token" https://[$server]:$serverport/$route` + else + result=`curl --max-time 10 -s -k --interface $intf -H "accept: application/json" -H "Authorization: Bearer $token" https://$server:$serverport/$route` fi [ -n "$result" ] && break done @@ -117,17 +117,17 @@ _set_json() { [ -n "$token" ] && { resolve="$(resolveip -t 5 $server)" valid_ip6=$(valid_subnet6 $server) - if [ "$resolve" != "$server" ] || [ "$valid_ip6" != "ok" ]; then - result=`curl --max-time 10 -s -k -H "Authorization: Bearer $token" -H "Content-Type: application/json" -X POST -d "$settings" https://$server:$serverport/$route` - else + if [ "$valid_ip6" = "ok" ]; then result=`curl --max-time 10 -s -k -H "Authorization: Bearer $token" -H "Content-Type: application/json" -X POST -d "$settings" https://[$server]:$serverport/$route` + else + result=`curl --max-time 10 -s -k -H "Authorization: Bearer $token" -H "Content-Type: application/json" -X POST -d "$settings" https://$server:$serverport/$route` fi if [ -z "$result" ]; then for intf in $(multipath 2>/dev/null | awk '/default/ { print $1 }'); do - if [ "$resolve" != "$server" ] || [ "$valid_ip6" != "ok" ]; then - result=`curl --max-time 10 -s -k --interface $intf -H "Authorization: Bearer $token" -H "Content-Type: application/json" -X POST -d "$settings" https://$server:$serverport/$route` - else + if [ "$valid_ip6" = "ok" ]; then result=`curl --max-time 10 -s -k --interface $intf -H "Authorization: Bearer $token" -H "Content-Type: application/json" -X POST -d "$settings" https://[$server]:$serverport/$route` + else + result=`curl --max-time 10 -s -k --interface $intf -H "Authorization: Bearer $token" -H "Content-Type: application/json" -X POST -d "$settings" https://$server:$serverport/$route` fi [ -n "$result" ] && break done @@ -1013,11 +1013,11 @@ _set_vpn_ip() { [ "$(uci -q get openmptcprouter.settings.vpn)" = "none" ] && return vpnifname="$(uci -q get network.omrvpn.device)" vpnip_local_current="$(echo "$vps_config" | jsonfilter -q -e '@.vpn.remoteip')" - vpnip_local=$(ip -4 -br addr ls dev ${vpnifname} | awk -F'[ /]+' '{print $3}') + vpnip_local=$(ip -4 -br addr ls dev ${vpnifname} 2>/dev/null | awk -F'[ /]+' '{print $3}') vpnip_remote_current="$(echo "$vps_config" | jsonfilter -q -e '@.vpn.localip')" vpnip_remote=$(ip -4 r show default dev ${vpnifname} | awk '{print $3}' | tr -d "\n") - [ -z "$vpnip_remote" ] && [ -n "$vpnifname" ] && vpnip_remote=$(ip -4 r list dev ${vpnifname} | grep kernel | awk '{print $1}' | tr -d "\n") - [ -z "$vpnip_remote" ] && [ -n "$vpnifname" ] && vpnip_remote=$(ip -4 r list dev ${vpnifname} | grep "proto static src" | awk '{print $3}' | tr -d "\n") + [ -z "$vpnip_remote" ] && [ -n "$vpnifname" ] && vpnip_remote=$(ip -4 r list dev ${vpnifname} 2>/dev/null | grep kernel | awk '{print $1}' | tr -d "\n") + [ -z "$vpnip_remote" ] && [ -n "$vpnifname" ] && vpnip_remote=$(ip -4 r list dev ${vpnifname} 2>/dev/null | grep "proto static src" | awk '{print $3}' | tr -d "\n") [ -z "$vpnip_remote" ] && vpnip_remote=$(ifstatus omrvpn | jsonfilter -e '@.route[0].nexthop') [ -z "$vpnip_remote" ] && [ "$vpnifname" = "bonding-omrvpn" ] && vpnip_remote="10.255.248.1" ula="$(uci -q get network.globals.ula_prefix)" diff --git a/openmptcprouter/files/etc/uci-defaults/1920-omr-network b/openmptcprouter/files/etc/uci-defaults/1920-omr-network index 6572e6158..61b3e5ebb 100755 --- a/openmptcprouter/files/etc/uci-defaults/1920-omr-network +++ b/openmptcprouter/files/etc/uci-defaults/1920-omr-network @@ -342,13 +342,15 @@ if [ "$(uci -q show network.wan1 | grep multipath)" = "" ] && [ -z "$(uci -q get _setup_macaddr "wan2" "${_macaddr:-$(dd if=/dev/urandom bs=1024 count=1 2>/dev/null | md5sum | sed -e 's/^\(..\)\(..\)\(..\)\(..\)\(..\)\(..\).*$/\1:\2:\3:\4:\5:\6/' -e 's/^\(.\)[13579bdf]/\10/')}" _setup_wan_interface wan3 lan3 on _macaddr=$(uci -q get "network.lan3.macaddr") - _setup_macaddr "wan3" "${_macaddr:-$(dd if=/dev/urandom bs=1024 count=1 2>/dev/null | md5sum | sed -e 's/^\(..\)\(..\)\(..\)\(..\)\(..\)\(..\).*$/\1:\2:\3:\4:\5:\6/' -e 's/^\(.\)[13579bdf]/\10/')}" - _setup_wan_interface wan4 lan4 on - _macaddr=$(uci -q get "network.lan4.macaddr") - _setup_macaddr "wan4" "${_macaddr:-$(dd if=/dev/urandom bs=1024 count=1 2>/dev/null | md5sum | sed -e 's/^\(..\)\(..\)\(..\)\(..\)\(..\)\(..\).*$/\1:\2:\3:\4:\5:\6/' -e 's/^\(.\)[13579bdf]/\10/')}" - if [ -d /sys/class/net/lan5 -o -n "$(ip link | grep ' lan5')" ]; then - _macaddr=$(uci -q get "network.lan5.macaddr") - _setup_macaddr "wan5" "${_macaddr:-$(dd if=/dev/urandom bs=1024 count=1 2>/dev/null | md5sum | sed -e 's/^\(..\)\(..\)\(..\)\(..\)\(..\)\(..\).*$/\1:\2:\3:\4:\5:\6/' -e 's/^\(.\)[13579bdf]/\10/')}" + if [ -z "$(cat /etc/board.json | jsonfilter -q -e '@.model.id' | grep z8109)" ]; then + _setup_macaddr "wan3" "${_macaddr:-$(dd if=/dev/urandom bs=1024 count=1 2>/dev/null | md5sum | sed -e 's/^\(..\)\(..\)\(..\)\(..\)\(..\)\(..\).*$/\1:\2:\3:\4:\5:\6/' -e 's/^\(.\)[13579bdf]/\10/')}" + _setup_wan_interface wan4 lan4 on + _macaddr=$(uci -q get "network.lan4.macaddr") + _setup_macaddr "wan4" "${_macaddr:-$(dd if=/dev/urandom bs=1024 count=1 2>/dev/null | md5sum | sed -e 's/^\(..\)\(..\)\(..\)\(..\)\(..\)\(..\).*$/\1:\2:\3:\4:\5:\6/' -e 's/^\(.\)[13579bdf]/\10/')}" + if [ -d /sys/class/net/lan5 -o -n "$(ip link | grep ' lan5')" ]; then + _macaddr=$(uci -q get "network.lan5.macaddr") + _setup_macaddr "wan5" "${_macaddr:-$(dd if=/dev/urandom bs=1024 count=1 2>/dev/null | md5sum | sed -e 's/^\(..\)\(..\)\(..\)\(..\)\(..\)\(..\).*$/\1:\2:\3:\4:\5:\6/' -e 's/^\(.\)[13579bdf]/\10/')}" + fi fi elif [ -d /sys/class/net/wan1 ] || [ -n "$(ip link | grep ' wan1')" ]; then if [ -d /sys/class/net/wan2 ] || [ -n "$(ip link | grep ' wan2')" ]; then diff --git a/openmptcprouter/files/etc/uci-defaults/2000-omr-dhcp b/openmptcprouter/files/etc/uci-defaults/2000-omr-dhcp index 5ad19ac9e..e320f727f 100755 --- a/openmptcprouter/files/etc/uci-defaults/2000-omr-dhcp +++ b/openmptcprouter/files/etc/uci-defaults/2000-omr-dhcp @@ -10,5 +10,9 @@ if [ "$(uci -q get openmptcprouter.settings.disable_ipv6)" != "0" ]; then EOF rm -f /tmp/luci-indexcache fi +uci -q batch <<-EOF >/dev/null + set dhcp.@dnsmasq[0].quietdhcp='1' + commit dhcp +EOF exit 0