1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00
This commit is contained in:
suyuan 2025-02-26 15:32:02 +08:00 committed by GitHub
commit 3fbddf528c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 38 additions and 32 deletions

View file

@ -8,7 +8,7 @@ jobs:
build: build:
strategy: strategy:
matrix: 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] OMR_KERNEL: [6.6, 6.12]
runs-on: ubuntu-latest runs-on: ubuntu-latest
continue-on-error: true continue-on-error: true

View file

@ -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 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="ERROR"
OMR_TRACKER_STATUS_MSG="Packet loss is $OMR_TRACKER_LOSS this is more than failure limit defined at $OMR_TRACKER_FAILURE_LOSS" 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="ERROR"
OMR_TRACKER_STATUS_MSG="Latency is $OMR_TRACKER_LATENCY this is more than failure limit defined at $OMR_TRACKER_FAILURE_LATENCY" OMR_TRACKER_STATUS_MSG="Latency is $OMR_TRACKER_LATENCY this is more than failure limit defined at $OMR_TRACKER_FAILURE_LATENCY"
fi fi

View file

@ -1,5 +1,5 @@
#!/bin/sh /etc/rc.common #!/bin/sh /etc/rc.common
# Copyright (C) 2018-2023 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> # Copyright (C) 2018-2025 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
# Released under GPL 3. See LICENSE for the full terms. # Released under GPL 3. See LICENSE for the full terms.
START=99 START=99
@ -45,19 +45,19 @@ _login() {
server=$1 server=$1
[ -n "$token" ] && return [ -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` #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) valid_ip6=$(valid_subnet6 $server)
if [ "$resolve" != "$server" ] || [ "$valid_ip6" != "ok" ]; then 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` 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 fi
if [ -z "$auth" ]; then if [ -z "$auth" ]; then
for intf in $(multipath 2>/dev/null | awk '/default/ { print $1 }'); do for intf in $(multipath 2>/dev/null | awk '/default/ { print $1 }'); do
if [ "$resolve" != "$server" ] || [ "$valid_ip6" != "ok" ]; then 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` 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 fi
[ -n "$auth" ] && break [ -n "$auth" ] && break
done done
@ -85,17 +85,17 @@ _get_json() {
[ -n "$token" ] && { [ -n "$token" ] && {
resolve="$(resolveip -t 5 $server)" resolve="$(resolveip -t 5 $server)"
valid_ip6=$(valid_subnet6 $server) valid_ip6=$(valid_subnet6 $server)
if [ "$resolve" != "$server" ] || [ "$valid_ip6" != "ok" ]; then 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` 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 fi
if [ -z "$result" ]; then if [ -z "$result" ]; then
for intf in $(multipath 2>/dev/null | awk '/default/ { print $1 }'); do for intf in $(multipath 2>/dev/null | awk '/default/ { print $1 }'); do
if [ "$resolve" != "$server" ] || [ "$valid_ip6" != "ok" ]; then 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` 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 fi
[ -n "$result" ] && break [ -n "$result" ] && break
done done
@ -117,17 +117,17 @@ _set_json() {
[ -n "$token" ] && { [ -n "$token" ] && {
resolve="$(resolveip -t 5 $server)" resolve="$(resolveip -t 5 $server)"
valid_ip6=$(valid_subnet6 $server) valid_ip6=$(valid_subnet6 $server)
if [ "$resolve" != "$server" ] || [ "$valid_ip6" != "ok" ]; then 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` 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 fi
if [ -z "$result" ]; then if [ -z "$result" ]; then
for intf in $(multipath 2>/dev/null | awk '/default/ { print $1 }'); do for intf in $(multipath 2>/dev/null | awk '/default/ { print $1 }'); do
if [ "$resolve" != "$server" ] || [ "$valid_ip6" != "ok" ]; then 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` 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 fi
[ -n "$result" ] && break [ -n "$result" ] && break
done done
@ -1013,11 +1013,11 @@ _set_vpn_ip() {
[ "$(uci -q get openmptcprouter.settings.vpn)" = "none" ] && return [ "$(uci -q get openmptcprouter.settings.vpn)" = "none" ] && return
vpnifname="$(uci -q get network.omrvpn.device)" vpnifname="$(uci -q get network.omrvpn.device)"
vpnip_local_current="$(echo "$vps_config" | jsonfilter -q -e '@.vpn.remoteip')" 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_current="$(echo "$vps_config" | jsonfilter -q -e '@.vpn.localip')"
vpnip_remote=$(ip -4 r show default dev ${vpnifname} | awk '{print $3}' | tr -d "\n") 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} 2>/dev/null | 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 "proto static src" | awk '{print $3}' | tr -d "\n")
[ -z "$vpnip_remote" ] && vpnip_remote=$(ifstatus omrvpn | jsonfilter -e '@.route[0].nexthop') [ -z "$vpnip_remote" ] && vpnip_remote=$(ifstatus omrvpn | jsonfilter -e '@.route[0].nexthop')
[ -z "$vpnip_remote" ] && [ "$vpnifname" = "bonding-omrvpn" ] && vpnip_remote="10.255.248.1" [ -z "$vpnip_remote" ] && [ "$vpnifname" = "bonding-omrvpn" ] && vpnip_remote="10.255.248.1"
ula="$(uci -q get network.globals.ula_prefix)" ula="$(uci -q get network.globals.ula_prefix)"

View file

@ -342,6 +342,7 @@ 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_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 _setup_wan_interface wan3 lan3 on
_macaddr=$(uci -q get "network.lan3.macaddr") _macaddr=$(uci -q get "network.lan3.macaddr")
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_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 _setup_wan_interface wan4 lan4 on
_macaddr=$(uci -q get "network.lan4.macaddr") _macaddr=$(uci -q get "network.lan4.macaddr")
@ -350,6 +351,7 @@ if [ "$(uci -q show network.wan1 | grep multipath)" = "" ] && [ -z "$(uci -q get
_macaddr=$(uci -q get "network.lan5.macaddr") _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/')}" _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
fi
elif [ -d /sys/class/net/wan1 ] || [ -n "$(ip link | grep ' wan1')" ]; then elif [ -d /sys/class/net/wan1 ] || [ -n "$(ip link | grep ' wan1')" ]; then
if [ -d /sys/class/net/wan2 ] || [ -n "$(ip link | grep ' wan2')" ]; then if [ -d /sys/class/net/wan2 ] || [ -n "$(ip link | grep ' wan2')" ]; then
_setup_wan_interface wan1 wan1 master _setup_wan_interface wan1 wan1 master

View file

@ -10,5 +10,9 @@ if [ "$(uci -q get openmptcprouter.settings.disable_ipv6)" != "0" ]; then
EOF EOF
rm -f /tmp/luci-indexcache rm -f /tmp/luci-indexcache
fi fi
uci -q batch <<-EOF >/dev/null
set dhcp.@dnsmasq[0].quietdhcp='1'
commit dhcp
EOF
exit 0 exit 0