From 15cfa3bf624b1475f9273b23905159417f5979be Mon Sep 17 00:00:00 2001 From: zwf Date: Sat, 21 Jan 2023 03:57:13 +0800 Subject: [PATCH] exclude static route with via ip in route helper (#1791) When adding Routes to zerotier's Managed Routes, the helper will add a route rule to the device that does not have a via ip, so that the address of the Destination segment cannot be routed correctly within the container. Here, based on the contents of the routes key in `zerotier-cli -j listnetworks`, by determining whether the via key has an ip address, if it is not null, helper will no longer add route rules. --- pkg/synology/dsm7-docker/entrypoint.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/synology/dsm7-docker/entrypoint.sh b/pkg/synology/dsm7-docker/entrypoint.sh index acc66d4dc..e760518b3 100755 --- a/pkg/synology/dsm7-docker/entrypoint.sh +++ b/pkg/synology/dsm7-docker/entrypoint.sh @@ -55,6 +55,7 @@ do for ((k=0; k<=$((ROUTE_COUNT-1)); k++)) do ROUTE="$(jq -r '.['$j'].routes['$k'].target' <<< "$NETWORK_LIST")" + VIA="$(jq -r '.['$j'].routes['$k'].via' <<< "$NETWORK_LIST")" if [[ -n "$ROUTE" ]] then # check if route is default and allowDefault enabled for this network @@ -63,7 +64,7 @@ do continue fi EXIST="$(ip -o route show "$ROUTE")" - if [[ -z "${EXIST}" ]] + if [[ -z "${EXIST}" && "$VIA" == "null" ]] then IFNAME="$(jq -r '.['$j'] | .portDeviceName' <<< "$NETWORK_LIST")" echo " Adding route $ROUTE to dev $IFNAME"