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

Fix tracker log when nothing is configured

This commit is contained in:
Ycarus 2018-08-28 23:00:06 +02:00
parent 3a1f078e87
commit 7059c1b208

View file

@ -129,15 +129,19 @@ if [ "$OMR_TRACKER_STATUS" = "ERROR" ]; then
if [ "$(sysctl -n net.mptcp.mptcp_enabled | tr -d '\n')" = "1" ]; then if [ "$(sysctl -n net.mptcp.mptcp_enabled | tr -d '\n')" = "1" ]; then
multipath "$OMR_TRACKER_DEVICE" off multipath "$OMR_TRACKER_DEVICE" off
fi fi
glorytun-udp path $OMR_TRACKER_DEVICE_IP dev tun0 down > /dev/null 2>&1
config_load shadowsocks-libev
if [ -n "$OMR_TRACKER_DEVICE_IP" ]; then if [ -n "$OMR_TRACKER_DEVICE_IP" ]; then
glorytun-udp path $OMR_TRACKER_DEVICE_IP dev tun0 down > /dev/null 2>&1
fi
config_load shadowsocks-libev
if [ -n "$OMR_TRACKER_DEVICE_IP" ] && [ -n "$OMR_TRACKER_DEVICE_GATEWAY" ]; then
local metric=$(ip rule show | grep "$OMR_TRACKER_DEVICE_IP" | awk '{print $5}') local metric=$(ip rule show | grep "$OMR_TRACKER_DEVICE_IP" | awk '{print $5}')
ip route del default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE metric $metric ip route del default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE metric $metric
config_foreach del_ss_route server $metric config_foreach del_ss_route server $metric
else else
if [ -n "$OMR_TRACKER_DEVICE_GATEWAY" ]; then
ip route del default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE ip route del default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE
config_foreach del_ss_route server none fi
config_foreach del_ss_route server off
fi fi
} }
fi fi
@ -193,7 +197,7 @@ if [ "$multipath_config" = "master" ]; then
ip route replace default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE table 991337 ip route replace default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE table 991337
fi fi
fi fi
if [ -n "$OMR_TRACKER_DEVICE_IP" ]; then if [ -n "$OMR_TRACKER_DEVICE_IP" ] && [ -n "$OMR_TRACKER_DEVICE_GATEWAY" ]; then
local metric=$(ip rule show | grep "$OMR_TRACKER_DEVICE_IP" | awk '{print $5}') local metric=$(ip rule show | grep "$OMR_TRACKER_DEVICE_IP" | awk '{print $5}')
[ -n "$metric" ] && { [ -n "$metric" ] && {
ip route replace default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE metric $metric ip route replace default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE metric $metric
@ -201,7 +205,7 @@ if [ "$multipath_config" = "master" ]; then
fi fi
multipath_config="on" multipath_config="on"
else else
if [ -n "$OMR_TRACKER_DEVICE_IP" ]; then if [ -n "$OMR_TRACKER_DEVICE_IP" ] && [ -n "$OMR_TRACKER_DEVICE_GATEWAY" ]; then
local metric=$(ip rule show | grep "$OMR_TRACKER_DEVICE_IP" | awk '{print $5}') local metric=$(ip rule show | grep "$OMR_TRACKER_DEVICE_IP" | awk '{print $5}')
[ -n "$metric" ] && { [ -n "$metric" ] && {
ip route replace default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE metric $metric ip route replace default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE metric $metric