1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Get default gateway only if needed in error OMR-Tracker post script

This commit is contained in:
Ycarus (Yannick Chabanois) 2024-07-05 16:03:08 +02:00
parent 739fdc5dfa
commit b10ef6ed9d

View file

@ -2,9 +2,6 @@
. /lib/functions/network.sh
default_gw=$(ip route get 1.1.1.1 | grep via | awk '{print $3}')
default_gw6=$(ip -6 route get 2606:4700:4700::1111 | grep via | awk '{print $3}')
interface_up=$(ifstatus "$OMR_TRACKER_INTERFACE" 2>/dev/null | jsonfilter -q -e '@["up"]')
# An interface in error will never be used in MPTCP
@ -165,6 +162,8 @@ if [ "$OMR_TRACKER_STATUS" = "ERROR" ] || { [ "$OMR_TRACKER_INTERFACE" != "omrvp
#if [ "$(uci -q get openmptcprouter.settings.master)" = "balancing" ] && [ "$(uci -q get openmptcprouter.settings.vpn)" != "mlvpn" ]; then
if [ -n "$OMR_TRACKER_INTERFACE" ]; then
default_gw=$(ip route get 1.1.1.1 | grep via | awk '{print $3}')
default_gw6=$(ip -6 route get 2606:4700:4700::1111 | grep via | awk '{print $3}')
if { [ "$default_gw" = "$OMR_TRACKER_DEVICE_GATEWAY" ] || [ "$default_gw" = "" ] || [ "$default_gw6" != "$OMR_TRACKER_DEVICE_GATEWAY6" ]; } && [ "$(uci -q get openmptcprouter.settings.defaultgw)" != "0" ]; then
[ "$(uci -q get openmptcprouter.settings.debug)" = "true" ] && _log "Default gw: $default_gw - Set routes (current: $(ip r) )"
config_load network