mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Various changes in OMR-Tracker for optimization
This commit is contained in:
parent
da55fcb051
commit
b1a4cc8783
7 changed files with 44 additions and 10 deletions
|
@ -26,6 +26,8 @@ export OMR_TRACKER_PREV_STATUS
|
|||
export OMR_TRACKER_DEVICE
|
||||
export OMR_TRACKER_DEVICE_IP
|
||||
export OMR_TRACKER_DEVICE_IP6
|
||||
export OMR_TRACKER_PREV_DEVICE_IP
|
||||
export OMR_TRACKER_PREV_DEVICE_IP6
|
||||
export OMR_TRACKER_DEVICE_GATEWAY
|
||||
export OMR_TRACKER_DEVICE_GATEWAY6
|
||||
export OMR_TRACKER_IPV6
|
||||
|
@ -275,9 +277,9 @@ while true; do
|
|||
OMR_TRACKER_DEVICE_GATEWAY=
|
||||
OMR_TRACKER_DEVICE_GATEWAY6=
|
||||
serverip_ping=false
|
||||
[ -z "$OMR_TRACKER_DEVICE" ] && {
|
||||
network_get_device OMR_TRACKER_DEVICE "$OMR_TRACKER_INTERFACE"
|
||||
[ -z "$OMR_TRACKER_DEVICE" ] && network_get_physdev OMR_TRACKER_DEVICE "$OMR_TRACKER_INTERFACE"
|
||||
[ -z "$OMR_TRACKER_DEVICE" ] || [ -d "/sys/class/net/$OMR_TRACKER_DEVICE" ] && {
|
||||
network_get_physdev OMR_TRACKER_DEVICE "$OMR_TRACKER_INTERFACE"
|
||||
[ -z "$OMR_TRACKER_DEVICE" ] && network_get_device OMR_TRACKER_DEVICE "$OMR_TRACKER_INTERFACE"
|
||||
[ -z "$OMR_TRACKER_DEVICE" ] && OMR_TRACKER_DEVICE=$(ifstatus "$OMR_TRACKER_INTERFACE" | jsonfilter -q -e '@["l3_device"]')
|
||||
[ -z "$OMR_TRACKER_DEVICE" ] && OMR_TRACKER_DEVICE=$(ifstatus "${OMR_TRACKER_INTERFACE}_4" | jsonfilter -q -e '@["l3_device"]')
|
||||
#[ -z "$OMR_TRACKER_DEVICE" ] && config_get OMR_TRACKER_DEVICE "$OMR_TRACKER_INTERFACE" device
|
||||
|
@ -286,7 +288,7 @@ while true; do
|
|||
|
||||
if [ -n "$OMR_TRACKER_DEVICE" ] && [ -d "/sys/class/net/$OMR_TRACKER_DEVICE" ]; then
|
||||
#if [ -n "$(ip link show $OMR_TRACKER_DEVICE | grep 'state UP')" ] || [ -n "$(ip link show $OMR_TRACKER_DEVICE | grep 'state UNKNOWN')" ]; then
|
||||
if [ "$(ifstatus $OMR_TRACKER_INTERFACE | jsonfilter -e '@.up')" == "true" ] || [ "$OMR_TRACKER_INTERFACE" = "omrvpn" ]; then
|
||||
if [ "$(ifstatus $OMR_TRACKER_INTERFACE | jsonfilter -q -e '@.up')" == "true" ] || [ "$OMR_TRACKER_INTERFACE" = "omrvpn" ]; then
|
||||
# retrieve iface ip and gateway
|
||||
if { [ "$OMR_TRACKER_FAMILY" = "ipv4" ] || [ "$OMR_TRACKER_FAMILY" = "ipv4ipv6" ]; } && [ "$OMR_TRACKER_INTERFACE_PROTO" != "dhcpv6" ]; then
|
||||
OMR_TRACKER_DEVICE_IP=$(ip -4 -br addr ls dev "$OMR_TRACKER_DEVICE" | awk -F'[ /]+' '{print $3}')
|
||||
|
@ -623,6 +625,8 @@ while true; do
|
|||
_post_tracking
|
||||
[ "$OMR_TRACKER_STATUS" = "ERROR" ] && sleep $wait_test
|
||||
OMR_TRACKER_PREV_STATUS="$OMR_TRACKER_STATUS"
|
||||
OMR_TRACKER_PREV_DEVICE_IP="$OMR_TRACKER_DEVICE_IP"
|
||||
OMR_TRACKER_PREV_DEVICE_IP6="$OMR_TRACKER_DEVICE_IP6"
|
||||
_restart
|
||||
|
||||
if [ "$OMR_TRACKER_STATUS" = "ERROR" ]; then
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2018-2024 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
# This script check if MPTCP status is correct on interface
|
||||
|
||||
# Set default multipath status
|
||||
[ "$OMR_TRACKER_INTERFACE" = "omrvpn" ] && multipath "$OMR_TRACKER_DEVICE" off >/dev/null 2>&1
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2018-2024 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
# This script do commands when an interface is detected as down
|
||||
|
||||
. /lib/functions/network.sh
|
||||
|
||||
interface_up=$(ifstatus "$OMR_TRACKER_INTERFACE" 2>/dev/null | jsonfilter -q -e '@["up"]')
|
||||
|
||||
|
@ -114,6 +120,7 @@ if [ "$OMR_TRACKER_STATUS" = "ERROR" ] || { [ "$OMR_TRACKER_INTERFACE" != "omrvp
|
|||
if [ "$OMR_TRACKER_PREV_STATUS" = "$OMR_TRACKER_STATUS" ]; then
|
||||
exit 0
|
||||
fi
|
||||
. /lib/functions/network.sh
|
||||
|
||||
# Get the current multipath status
|
||||
multipath_status="off"
|
||||
|
@ -293,3 +300,4 @@ if [ "$OMR_TRACKER_STATUS" = "ERROR" ] || { [ "$OMR_TRACKER_INTERFACE" != "omrvp
|
|||
exit 0
|
||||
fi
|
||||
|
||||
exit 0
|
|
@ -1,9 +1,20 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2018-2024 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
# This script do commands when an interface is detected as up
|
||||
|
||||
if [ "$OMR_TRACKER_STATUS" = "ERROR" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$OMR_TRACKER_PREV_STATUS" = "$OMR_TRACKER_STATUS" ] && [ -n "$OMR_TRACKER_INTERFACE" ] && [ "$OMR_TRACKER_PREV_DEVICE_IP" = "$OMR_TRACKER_DEVICE_IP" ] && [ "$OMR_TRACKER_PREV_DEVICE_IP6" = "$OMR_TRACKER_DEVICE_IP6" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
SETROUTE=false
|
||||
|
||||
. /lib/functions/network.sh
|
||||
|
@ -196,7 +207,7 @@ set_routes_intf() {
|
|||
local interface_if
|
||||
local INTERFACE=$1
|
||||
[ -z "$INTERFACE" ] && return
|
||||
[ "$INTERFACE" = "omrvpn" ] && continue
|
||||
[ "$INTERFACE" = "omrvpn" ] && return
|
||||
multipath_config_route=$(uci -q get openmptcprouter.$INTERFACE.multipath)
|
||||
[ -z "$multipath_config_route" ] && multipath_config_route=$(uci -q get network.$INTERFACE.multipath || echo "off")
|
||||
[ "$(uci -q get openmptcprouter.$INTERFACE.multipathvpn)" = "1" ] && {
|
||||
|
@ -255,8 +266,8 @@ set_routes_intf6() {
|
|||
local interface_if
|
||||
local INTERFACE=$1
|
||||
[ -z "$INTERFACE" ] && return
|
||||
[ "$INTERFACE" = "omr6in4" ] && continue
|
||||
[ "$INTERFACE" = "omrvpn" ] && continue
|
||||
[ "$INTERFACE" = "omr6in4" ] && return
|
||||
[ "$INTERFACE" = "omrvpn" ] && return
|
||||
multipath_config_route=$(uci -q get openmptcprouter.$INTERFACE.multipath)
|
||||
[ -z "$multipath_config_route" ] && multipath_config_route=$(uci -q get network.$INTERFACE.multipath || echo "off")
|
||||
[ "$(uci -q get openmptcprouter.$INTERFACE.multipathvpn)" = "1" ] && {
|
||||
|
@ -1073,3 +1084,4 @@ fi
|
|||
[ -n "$(uci -q changes openmptcprouter)" ] && uci -q commit openmptcprouter
|
||||
|
||||
#ubus call network reload
|
||||
exit 0
|
|
@ -275,6 +275,7 @@ if [ -n "$OMR_TRACKER_INTERFACE" ] && { [ "$(uci -q get openmptcprouter.$OMR_TRA
|
|||
_log "Check API configuration... Done"
|
||||
fi
|
||||
fi
|
||||
dns_flush
|
||||
#dns_flush
|
||||
fi
|
||||
|
||||
exit 0
|
|
@ -61,3 +61,4 @@ if [ -n "$OMR_TRACKER_INTERFACE" ] && [ -n "$OMR_TRACKER_DEVICE" ]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
|
@ -64,3 +64,4 @@ if [ -n "$OMR_TRACKER_INTERFACE" ] && [ -n "$OMR_TRACKER_DEVICE" ] && [ "$(pgrep
|
|||
sleep 5
|
||||
fi
|
||||
|
||||
exit 0
|
Loading…
Add table
Add a link
Reference in a new issue