mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
sync (#600)
This commit is contained in:
commit
32d23efa93
19 changed files with 89 additions and 42 deletions
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
|
@ -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]
|
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, r5c]
|
||||||
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
|
||||||
|
|
|
@ -95,7 +95,12 @@ return view.extend({
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
o = s.option(form.Flag, 'server_http_test', _('Server http test'),
|
o = s.option(form.Flag, 'server_http_test', _('Server http test'),
|
||||||
_('Check if connection work with http by sending a request to server'));
|
_('Check if connection work with http by sending a request to server API'));
|
||||||
|
o.rmempty = false;
|
||||||
|
o.modalonly = true;
|
||||||
|
|
||||||
|
o = s.option(form.Flag, 'server_test', _('Server test'),
|
||||||
|
_('Check if connection work by sending a ping or http request to server over all interfaces, failed if only current interface is not able to.'));
|
||||||
o.rmempty = false;
|
o.rmempty = false;
|
||||||
o.modalonly = true;
|
o.modalonly = true;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
# Copyright (C) 2018-2020 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
|
# Copyright (C) 2018-2020 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
|
||||||
|
|
||||||
START=98
|
START=98
|
||||||
STOP=10
|
|
||||||
USE_PROCD=1
|
USE_PROCD=1
|
||||||
EXTRA_COMMANDS="reload_rules bypass_asn"
|
EXTRA_COMMANDS="reload_rules bypass_asn"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
# Copyright (C) 2018-2024 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
|
# Copyright (C) 2018-2024 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
|
||||||
|
|
||||||
START=98
|
START=98
|
||||||
STOP=10
|
|
||||||
USE_PROCD=1
|
USE_PROCD=1
|
||||||
EXTRA_COMMANDS="reload_rules bypass_asn"
|
EXTRA_COMMANDS="reload_rules bypass_asn"
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Copyright (C) 2018-2023 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
|
# Copyright (C) 2018-2025 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
|
||||||
#
|
#
|
||||||
# This is free software, licensed under the GNU General Public License v2.
|
# This is free software, licensed under the GNU General Public License v2.
|
||||||
# See /LICENSE for more information.
|
# See /LICENSE for more information.
|
||||||
|
@ -94,11 +95,13 @@ fi
|
||||||
|
|
||||||
if [ "$(pgrep rpcd)" = "" ] && [ -f /etc/init.d/rpcd ]; then
|
if [ "$(pgrep rpcd)" = "" ] && [ -f /etc/init.d/rpcd ]; then
|
||||||
_log "Can't find rpcd, restart it..."
|
_log "Can't find rpcd, restart it..."
|
||||||
|
/etc/init.d/rpcd enable >/dev/null 2>&1
|
||||||
/etc/init.d/rpcd restart >/dev/null 2>&1
|
/etc/init.d/rpcd restart >/dev/null 2>&1
|
||||||
sleep 5
|
sleep 5
|
||||||
fi
|
fi
|
||||||
if [ "$(pgrep dbus)" = "" ] && [ -f /etc/init.d/dbus ]; then
|
if [ "$(pgrep dbus)" = "" ] && [ -f /etc/init.d/dbus ]; then
|
||||||
_log "Can't find dbus, restart it..."
|
_log "Can't find dbus, restart it..."
|
||||||
|
/etc/init.d/dbus enable >/dev/null 2>&1
|
||||||
/etc/init.d/dbus restart >/dev/null 2>&1
|
/etc/init.d/dbus restart >/dev/null 2>&1
|
||||||
sleep 5
|
sleep 5
|
||||||
fi
|
fi
|
||||||
|
@ -123,6 +126,7 @@ if [ "$(uci -q get openmptcprouter.settings.disable_modemmanager)" != "1" ]; the
|
||||||
# /etc/init.d/modemmanager stop >/dev/null 2>&1
|
# /etc/init.d/modemmanager stop >/dev/null 2>&1
|
||||||
# sleep 5
|
# sleep 5
|
||||||
fi
|
fi
|
||||||
|
/etc/init.d/modemmanager enable >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
if [ "$(uci -q get v2ray.main.enabled)" = "1" ] && [ -f /etc/init.d/v2ray ] && [ "$(pgrep -f omr-tracker-v2ray)" = "" ] && [ "$(pgrep -f '/etc/init.d/omr-tracker')" = "" ]; then
|
if [ "$(uci -q get v2ray.main.enabled)" = "1" ] && [ -f /etc/init.d/v2ray ] && [ "$(pgrep -f omr-tracker-v2ray)" = "" ] && [ "$(pgrep -f '/etc/init.d/omr-tracker')" = "" ]; then
|
||||||
_log "Can't find omr-tracker-v2ray, restart omr-tracker..."
|
_log "Can't find omr-tracker-v2ray, restart omr-tracker..."
|
||||||
|
@ -150,6 +154,7 @@ restart_omrtracker() {
|
||||||
config_get ifenabled "$1" auto
|
config_get ifenabled "$1" auto
|
||||||
[ -z "$multipath" ] || [ "$multipath" = "off" ] && return
|
[ -z "$multipath" ] || [ "$multipath" = "off" ] && return
|
||||||
[ "$ifenabled" = "0" ] && return
|
[ "$ifenabled" = "0" ] && return
|
||||||
|
/etc/init.d/omr-tracker enable
|
||||||
/etc/init.d/omr-tracker start_interface "$1"
|
/etc/init.d/omr-tracker start_interface "$1"
|
||||||
sleep 10
|
sleep 10
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Copyright (C) 2018-2023 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
|
# Copyright (C) 2018-2023 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
|
||||||
#
|
#
|
||||||
|
|
|
@ -510,7 +510,7 @@ while true; do
|
||||||
OMR_TRACKER_STATUS="OK"
|
OMR_TRACKER_STATUS="OK"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
elif [ "$serverip_ping" = false ] && [ "$OMR_TRACKER_STATUS" = "OK" ]; then
|
elif [ "$serverip_ping" = false ] && [ "$OMR_TRACKER_STATUS" = "OK" ] && [ "$OMR_TRACKER_SERVER_TEST" = "1" ]; then
|
||||||
if [ "$OMR_TRACKER_TYPE" = "ping" ]; then
|
if [ "$OMR_TRACKER_TYPE" = "ping" ]; then
|
||||||
_ping_server_all
|
_ping_server_all
|
||||||
fi
|
fi
|
||||||
|
@ -627,7 +627,7 @@ while true; do
|
||||||
OMR_TRACKER_STATUS="OK"
|
OMR_TRACKER_STATUS="OK"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
elif [ "$serverip_ping" = false ] && [ "$OMR_TRACKER_STATUS" = "OK" ]; then
|
elif [ "$serverip_ping" = false ] && [ "$OMR_TRACKER_STATUS" = "OK" ] && [ "$OMR_TRACKER_SERVER_TEST" = "1" ]; then
|
||||||
if [ "$OMR_TRACKER_TYPE" = "ping" ]; then
|
if [ "$OMR_TRACKER_TYPE" = "ping" ]; then
|
||||||
_ping_server_all
|
_ping_server_all
|
||||||
fi
|
fi
|
||||||
|
@ -637,7 +637,7 @@ while true; do
|
||||||
if [ "$server_ping" != false ] && [ "$servers" = true ]; then
|
if [ "$server_ping" != false ] && [ "$servers" = true ]; then
|
||||||
OMR_TRACKER_STATUS_MSG="$OMR_TRACKER_STATUS_MSG No answer from server"
|
OMR_TRACKER_STATUS_MSG="$OMR_TRACKER_STATUS_MSG No answer from server"
|
||||||
OMR_TRACKER_STATUS="ERROR"
|
OMR_TRACKER_STATUS="ERROR"
|
||||||
break
|
#break
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
[ "$OMR_TRACKER_STATUS" = "OK" ] && break
|
[ "$OMR_TRACKER_STATUS" = "OK" ] && break
|
||||||
|
|
|
@ -29,6 +29,7 @@ config defaults 'defaults'
|
||||||
option type 'ping'
|
option type 'ping'
|
||||||
option wait_test '0'
|
option wait_test '0'
|
||||||
option server_http_test '0'
|
option server_http_test '0'
|
||||||
|
option server_test '0'
|
||||||
option restart_down '0'
|
option restart_down '0'
|
||||||
option mail_alert '0'
|
option mail_alert '0'
|
||||||
option initial_state 'online'
|
option initial_state 'online'
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
#!/bin/sh /etc/rc.common
|
#!/bin/sh /etc/rc.common
|
||||||
# shellcheck disable=SC2039
|
# shellcheck disable=SC2039
|
||||||
# vim: set noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 :
|
# vim: set noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 :
|
||||||
# Copyright (C) 2018-2021 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.
|
||||||
|
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
{
|
{
|
||||||
START=90
|
START=90
|
||||||
STOP=10
|
|
||||||
USE_PROCD=1
|
USE_PROCD=1
|
||||||
EXTRA_COMMANDS="start_interface"
|
EXTRA_COMMANDS="start_interface"
|
||||||
}
|
}
|
||||||
|
@ -17,7 +16,7 @@
|
||||||
|
|
||||||
_validate_section() {
|
_validate_section() {
|
||||||
local tmp_hosts=$hosts tmp_hosts6=$hosts6 tmp_timeout=$timeout tmp_count=$count tmp_tries=$tries tmp_size=$size tmp_max_ttl=$max_ttl tmp_failure_loss=$failure_loss tmp_failure_latency=$failure_latency tmp_recovery_loss=$recovery_loss tmp_recovery_latency=$recovery_latency tmp_reliability=$reliability
|
local tmp_hosts=$hosts tmp_hosts6=$hosts6 tmp_timeout=$timeout tmp_count=$count tmp_tries=$tries tmp_size=$size tmp_max_ttl=$max_ttl tmp_failure_loss=$failure_loss tmp_failure_latency=$failure_latency tmp_recovery_loss=$recovery_loss tmp_recovery_latency=$recovery_latency tmp_reliability=$reliability
|
||||||
local tmp_interval=$interval tmp_interval_tries=$interval_tries tmp_options=$options tmp_type=$type tmp_enabled=$enabled tmp_wait_test=$wait_test tmp_server_http_test=$server_http_test tmp_check_quality=$check_quality tmp_failure_interval=$failure_interval tmp_tries_up=$tries_up tmp_family=$family
|
local tmp_interval=$interval tmp_interval_tries=$interval_tries tmp_options=$options tmp_type=$type tmp_enabled=$enabled tmp_wait_test=$wait_test tmp_server_http_test=$server_http_test tmp_server_test=$server_test tmp_check_quality=$check_quality tmp_failure_interval=$failure_interval tmp_tries_up=$tries_up tmp_family=$family
|
||||||
|
|
||||||
uci_validate_section omr-tracker "$1" "$2" \
|
uci_validate_section omr-tracker "$1" "$2" \
|
||||||
'hosts:list(host)' \
|
'hosts:list(host)' \
|
||||||
|
@ -41,6 +40,7 @@ _validate_section() {
|
||||||
'type:string:undef' \
|
'type:string:undef' \
|
||||||
'enabled:bool:1' \
|
'enabled:bool:1' \
|
||||||
'server_http_test:bool:0' \
|
'server_http_test:bool:0' \
|
||||||
|
'server_test:bool:0' \
|
||||||
'family:string' \
|
'family:string' \
|
||||||
'options:string'
|
'options:string'
|
||||||
|
|
||||||
|
@ -65,6 +65,7 @@ _validate_section() {
|
||||||
[ -z "$options" ] && options=$tmp_options
|
[ -z "$options" ] && options=$tmp_options
|
||||||
[ "$type" = "undef" ] && type=${tmp_type:-ping}
|
[ "$type" = "undef" ] && type=${tmp_type:-ping}
|
||||||
[ -z "$server_http_test" ] && server_http_test=$tmp_server_http_test
|
[ -z "$server_http_test" ] && server_http_test=$tmp_server_http_test
|
||||||
|
[ -z "$server_test" ] && server_test=$tmp_server_test
|
||||||
[ -z "$family" ] && family=$tmp_family
|
[ -z "$family" ] && family=$tmp_family
|
||||||
[ -z "$enabled" ] && enabled=$tmp_enabled
|
[ -z "$enabled" ] && enabled=$tmp_enabled
|
||||||
}
|
}
|
||||||
|
@ -145,6 +146,7 @@ _launch_tracker() {
|
||||||
procd_append_param env "OMR_TRACKER_PROTO=$proto"
|
procd_append_param env "OMR_TRACKER_PROTO=$proto"
|
||||||
procd_append_param env "OMR_TRACKER_WAIT_TEST=$wait_test"
|
procd_append_param env "OMR_TRACKER_WAIT_TEST=$wait_test"
|
||||||
procd_append_param env "OMR_TRACKER_SERVER_HTTP_TEST=$server_http_test"
|
procd_append_param env "OMR_TRACKER_SERVER_HTTP_TEST=$server_http_test"
|
||||||
|
procd_append_param env "OMR_TRACKER_SERVER_TEST=$server_test"
|
||||||
procd_set_param limits nofile="51200 51200"
|
procd_set_param limits nofile="51200 51200"
|
||||||
procd_set_param respawn 0 10 0
|
procd_set_param respawn 0 10 0
|
||||||
procd_set_param stderr 1
|
procd_set_param stderr 1
|
||||||
|
|
|
@ -115,6 +115,13 @@ if [ "$(uci -q get omr-tracker.defaults.server_http_test)" = "" ]; then
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$(uci -q get omr-tracker.defaults.server_test)" = "" ]; then
|
||||||
|
uci -q batch <<-EOF >/dev/null
|
||||||
|
set omr-tracker.defaults.server_test=0
|
||||||
|
commit omr-tracker
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$(uci -q get omr-tracker.defaults.failure_interval)" ] || [ "$(uci -q get omr-tracker.defaults.failure_interval)" = "5" ]; then
|
if [ -z "$(uci -q get omr-tracker.defaults.failure_interval)" ] || [ "$(uci -q get omr-tracker.defaults.failure_interval)" = "5" ]; then
|
||||||
uci -q batch <<-EOF >/dev/null
|
uci -q batch <<-EOF >/dev/null
|
||||||
set omr-tracker.defaults.failure_interval=20
|
set omr-tracker.defaults.failure_interval=20
|
||||||
|
|
|
@ -330,7 +330,7 @@ set_route_balancing() {
|
||||||
local multipath_config_route interface_gw interface_if
|
local multipath_config_route interface_gw interface_if
|
||||||
INTERFACE=$1
|
INTERFACE=$1
|
||||||
[ -z "$INTERFACE" ] && return
|
[ -z "$INTERFACE" ] && return
|
||||||
[ "$INTERFACE" = "omrvpn" ] && continue
|
[ "$INTERFACE" = "omrvpn" ] && return
|
||||||
multipath_config_route=$(uci -q get openmptcprouter.$INTERFACE.multipath)
|
multipath_config_route=$(uci -q get openmptcprouter.$INTERFACE.multipath)
|
||||||
[ -z "$multipath_config_route" ] && multipath_config_route=$(uci -q get network.$INTERFACE.multipath || echo "off")
|
[ -z "$multipath_config_route" ] && multipath_config_route=$(uci -q get network.$INTERFACE.multipath || echo "off")
|
||||||
[ "$(uci -q get openmptcprouter.$INTERFACE.multipathvpn)" = "1" ] && {
|
[ "$(uci -q get openmptcprouter.$INTERFACE.multipathvpn)" = "1" ] && {
|
||||||
|
@ -390,8 +390,8 @@ set_route_balancing6() {
|
||||||
local multipath_config_route interface_gw interface_if
|
local multipath_config_route interface_gw interface_if
|
||||||
INTERFACE=$1
|
INTERFACE=$1
|
||||||
[ -z "$INTERFACE" ] && return
|
[ -z "$INTERFACE" ] && return
|
||||||
[ "$INTERFACE" = "omr6in4" ] && continue
|
[ "$INTERFACE" = "omr6in4" ] && return
|
||||||
[ "$INTERFACE" = "omrvpn" ] && continue
|
[ "$INTERFACE" = "omrvpn" ] && return
|
||||||
multipath_config_route=$(uci -q get openmptcprouter.$INTERFACE.multipath)
|
multipath_config_route=$(uci -q get openmptcprouter.$INTERFACE.multipath)
|
||||||
[ -z "$multipath_config_route" ] && multipath_config_route=$(uci -q get network.$INTERFACE.multipath || echo "off")
|
[ -z "$multipath_config_route" ] && multipath_config_route=$(uci -q get network.$INTERFACE.multipath || echo "off")
|
||||||
[ "$(uci -q get openmptcprouter.$INTERFACE.multipathvpn)" = "1" ] && {
|
[ "$(uci -q get openmptcprouter.$INTERFACE.multipathvpn)" = "1" ] && {
|
||||||
|
|
|
@ -7,18 +7,19 @@ timeout=$(uci -q get openmptcprouter.settings.status_getip_timeout)
|
||||||
[ -z "$timeout" ] && timeout="1"
|
[ -z "$timeout" ] && timeout="1"
|
||||||
|
|
||||||
get_ip_from_server() {
|
get_ip_from_server() {
|
||||||
|
[ -n "$ip" ] && return
|
||||||
serverport=$(uci -q get openmptcprouter.$1.port)
|
serverport=$(uci -q get openmptcprouter.$1.port)
|
||||||
get_ip() {
|
get_ip() {
|
||||||
|
[ -n "$ip" ] && return
|
||||||
serverip=$1
|
serverip=$1
|
||||||
getip="$(curl -s -k -4 -m ${timeout} --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' | sed 's/::ffff://')
|
[ -n "$getip" ] && getip=$(echo $getip | jsonfilter -e '@.client_host' | sed 's/::ffff://')
|
||||||
if expr "$getip" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' >/dev/null; then
|
if expr "$getip" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' >/dev/null; then
|
||||||
ip=$getip
|
ip=$getip
|
||||||
break
|
return
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
config_list_foreach $1 ip get_ip
|
config_list_foreach $1 ip get_ip
|
||||||
[ -n "$ip" ] && break
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get_ip_from_website() {
|
get_ip_from_website() {
|
||||||
|
@ -30,7 +31,6 @@ get_ip_from_website() {
|
||||||
ipset del ss_rules_dst_bypass_all $checkip > /dev/null 2>&1
|
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
|
if expr "$getip" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' >/dev/null; then
|
||||||
ip=$getip
|
ip=$getip
|
||||||
break
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,17 +7,18 @@ timeout=$(uci -q get openmptcprouter.settings.status_getip_timeout)
|
||||||
[ -z "$timeout" ] && timeout="1"
|
[ -z "$timeout" ] && timeout="1"
|
||||||
|
|
||||||
get_ip_from_server() {
|
get_ip_from_server() {
|
||||||
|
[ -n "$ip" ] && return
|
||||||
serverport=$(uci -q get openmptcprouter.$1.port)
|
serverport=$(uci -q get openmptcprouter.$1.port)
|
||||||
get_ip() {
|
get_ip() {
|
||||||
|
[ -n "$ip" ] && return
|
||||||
getip="$(curl -s -k -6 -m ${timeout} --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')
|
[ -n "$getip" ] && getip=$(echo $getip | jsonfilter -e '@.client_host')
|
||||||
if [ -n "$(echo "$getip" | grep :)" ]; then
|
if [ -n "$(echo "$getip" | grep :)" ]; then
|
||||||
ip=$getip
|
ip=$getip
|
||||||
break
|
return
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
config_list_foreach $1 ip get_ip
|
config_list_foreach $1 ip get_ip
|
||||||
[ -n "$ip" ] && break
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get_ip_from_website() {
|
get_ip_from_website() {
|
||||||
|
@ -29,7 +30,6 @@ get_ip_from_website() {
|
||||||
ipset del ss_rules6_dst_bypass_all $checkip > /dev/null 2>&1
|
ipset del ss_rules6_dst_bypass_all $checkip > /dev/null 2>&1
|
||||||
if [ -n "$(echo "$getip" | grep :)" ]; then
|
if [ -n "$(echo "$getip" | grep :)" ]; then
|
||||||
ip=$getip
|
ip=$getip
|
||||||
break
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,10 @@ timeout="$(uci -q get openmptcprouter.settings.status_vps_timeout)"
|
||||||
[ -z "$intf" ] && return
|
[ -z "$intf" ] && return
|
||||||
|
|
||||||
get_mptcp_from_server() {
|
get_mptcp_from_server() {
|
||||||
|
[ -n "$support" ] && return
|
||||||
serverport=$(uci -q get openmptcprouter.$1.port)
|
serverport=$(uci -q get openmptcprouter.$1.port)
|
||||||
get_mptcp() {
|
get_mptcp() {
|
||||||
|
[ -n "$support" ] && return
|
||||||
serverip=$1
|
serverip=$1
|
||||||
if [ "$(echo $serverip | grep :)" ]; then
|
if [ "$(echo $serverip | grep :)" ]; then
|
||||||
if [ -f /proc/sys/net/mptcp/enabled ]; then
|
if [ -f /proc/sys/net/mptcp/enabled ]; then
|
||||||
|
@ -26,11 +28,10 @@ get_mptcp_from_server() {
|
||||||
fi
|
fi
|
||||||
[ -n "$support" ] && {
|
[ -n "$support" ] && {
|
||||||
support=$(echo $support | jsonfilter -e '@.mptcp')
|
support=$(echo $support | jsonfilter -e '@.mptcp')
|
||||||
break
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
config_list_foreach $1 ip get_mptcp
|
config_list_foreach $1 ip get_mptcp
|
||||||
[ -n "$support" ] && break
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get_mptcpv0_from_website() {
|
get_mptcpv0_from_website() {
|
||||||
|
|
|
@ -188,6 +188,9 @@ while [ "$response" = "000" ] && [ "$try" -le 3 ]; do
|
||||||
HOSTLST=$(echo $HOSTLST | tr ' ' '\n' | grep -v "$HOST" | xargs)
|
HOSTLST=$(echo $HOSTLST | tr ' ' '\n' | grep -v "$HOST" | xargs)
|
||||||
fi
|
fi
|
||||||
try=$((try+1))
|
try=$((try+1))
|
||||||
|
if [ "$response" = "000" ]; then
|
||||||
|
echo "No answer from $HOST, retry..."
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
[ -z "$HOST" ] && HOST="http://speedtest.milkywan.fr/files/10G.iso"
|
[ -z "$HOST" ] && HOST="http://speedtest.milkywan.fr/files/10G.iso"
|
||||||
|
|
|
@ -43,6 +43,7 @@ _login() {
|
||||||
if [ -z "$token" ]; then
|
if [ -z "$token" ]; then
|
||||||
login_on_server() {
|
login_on_server() {
|
||||||
server=$1
|
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`
|
#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)
|
||||||
|
@ -61,10 +62,10 @@ _login() {
|
||||||
[ -n "$auth" ] && break
|
[ -n "$auth" ] && break
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
[ -z "$auth" ] && return
|
[ -n "$auth" ] && {
|
||||||
token="$(echo "$auth" | jsonfilter -q -e '@.access_token')"
|
token="$(echo "$auth" | jsonfilter -q -e '@.access_token')"
|
||||||
uci -q set openmptcprouter.${servername}.token="$token"
|
uci -q set openmptcprouter.${servername}.token="$token"
|
||||||
[ -n "$token" ] && break
|
}
|
||||||
}
|
}
|
||||||
config_load openmptcprouter
|
config_load openmptcprouter
|
||||||
config_list_foreach ${servername} ip login_on_server
|
config_list_foreach ${servername} ip login_on_server
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
#!/bin/sh /etc/rc.common
|
#!/bin/sh /etc/rc.common
|
||||||
|
|
||||||
EXTRA_COMMANDS="backup restore"
|
EXTRA_COMMANDS="backup restore"
|
||||||
EXTRA_HELP=<<EOF
|
EXTRA_HELP=" backup Backup vnstat database
|
||||||
backup Backup vnstat database
|
|
||||||
restore Restore vnstat database
|
restore Restore vnstat database
|
||||||
EOF
|
"
|
||||||
|
|
||||||
START=50
|
START=50
|
||||||
STOP=60
|
STOP=60
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
. /lib/functions.sh
|
. /lib/functions.sh
|
||||||
|
|
||||||
_setup_macaddr() {
|
_setup_macaddr() {
|
||||||
uci -q get "network.$1.macaddr" >/dev/null && return
|
uci -q get "network.${1}.macaddr" >/dev/null && return
|
||||||
uci -q set "network.$1.macaddr=$2"
|
uci -q set "network.${1}.macaddr=$2"
|
||||||
}
|
}
|
||||||
|
|
||||||
_setup_macvlan() {
|
_setup_macvlan() {
|
||||||
|
@ -104,11 +104,13 @@ if [ "$(uci -q show network.lan | grep multipath)" != "" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
lanif="eth0"
|
lanif="eth0"
|
||||||
if [ "$(grep rockchip /etc/os-release)" != "" ]; then
|
if [ "$(cat /etc/board.json | jsonfilter -q -e '@.model.id' | tr -d '\n')" = "friendlyarm,nanopi-r5c" ]; then
|
||||||
|
lanif="eth0"
|
||||||
|
elif [ "$(grep rockchip /etc/os-release)" != "" ]; then
|
||||||
lanif="eth1"
|
lanif="eth1"
|
||||||
elif [ "$(grep filogic /etc/os-release)" != "" ]; then
|
elif [ "$(grep filogic /etc/os-release)" != "" ]; then
|
||||||
lanif="eth1"
|
lanif="eth1"
|
||||||
elif [ "$(cat /etc/board.json | jsonfilter -q -e '@.model.id' | tr -d '\n')" = "bananapi_bpi-r3" ]; then
|
elif [ -n "$(cat /etc/board.json | jsonfilter -q -e '@.model.id' | grep bananapi_bpi-r3)" ]; then
|
||||||
lanif="eth0"
|
lanif="eth0"
|
||||||
elif [ -d /sys/class/net/lan0 -o -n "$(ip link | grep ' lan0')" ] && [ -d /sys/class/net/wan -o -n "$(ip link | grep ' wan@')" -o -n "$(ip link | grep ' wan:')" ]; then
|
elif [ -d /sys/class/net/lan0 -o -n "$(ip link | grep ' lan0')" ] && [ -d /sys/class/net/wan -o -n "$(ip link | grep ' wan@')" -o -n "$(ip link | grep ' wan:')" ]; then
|
||||||
lanif="wan"
|
lanif="wan"
|
||||||
|
@ -196,10 +198,22 @@ set network.lan.delegate=0
|
||||||
set network.lan.addlatency=0
|
set network.lan.addlatency=0
|
||||||
set network.lan.txqueuelen=2000
|
set network.lan.txqueuelen=2000
|
||||||
set dhcp.lan.dhcpv4='server'
|
set dhcp.lan.dhcpv4='server'
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Add Lan device if no device defined
|
||||||
|
if [ -z "$(uci -q show network | grep device)" ]; then
|
||||||
|
uci -q batch <<-EOF
|
||||||
set network.lan_dev=device
|
set network.lan_dev=device
|
||||||
set network.lan_dev.name=${lanif}
|
set network.lan_dev.name=${lanif}
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Delete all bridges
|
||||||
|
#if [ -n "$(uci -q show network | grep bridge)" ]; then
|
||||||
|
# for bridge in $(uci -q show network | awk -F. '/bridge/ { print $2}'); do
|
||||||
|
# uci -q delete network.${bridge}
|
||||||
|
# done
|
||||||
|
#fi
|
||||||
|
|
||||||
uci -q batch <<-EOF
|
uci -q batch <<-EOF
|
||||||
delete network.none
|
delete network.none
|
||||||
|
@ -245,6 +259,11 @@ if [ "$(uci -q show network.wan1 | grep multipath)" = "" ] && [ -z "$(uci -q get
|
||||||
_setup_wan_interface wan2 eth1.2 on
|
_setup_wan_interface wan2 eth1.2 on
|
||||||
_setup_wan_interface wan3 eth1.3 on
|
_setup_wan_interface wan3 eth1.3 on
|
||||||
_setup_wan_interface wan4 eth1.4 on
|
_setup_wan_interface wan4 eth1.4 on
|
||||||
|
elif [ "$(cat /etc/board.json | jsonfilter -q -e '@.model.id' | tr -d '\n')" = "friendlyarm,nanopi-r5c" ]; then
|
||||||
|
_setup_wan_interface wan1 eth1 master macvlan
|
||||||
|
_setup_wan_interface wan2 eth1 on macvlan
|
||||||
|
_setup_macvlan wan1
|
||||||
|
_setup_macvlan wan2
|
||||||
elif [ "$(grep rockchip /etc/os-release)" != "" ]; then
|
elif [ "$(grep rockchip /etc/os-release)" != "" ]; then
|
||||||
_setup_wan_interface wan1 eth0 master macvlan
|
_setup_wan_interface wan1 eth0 master macvlan
|
||||||
_setup_wan_interface wan2 eth0 on macvlan
|
_setup_wan_interface wan2 eth0 on macvlan
|
||||||
|
|
|
@ -106,3 +106,8 @@ start_service()
|
||||||
modem2
|
modem2
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
restart()
|
||||||
|
{
|
||||||
|
start_service "@"
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue