mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-09 04:04:13 +00:00
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.
This commit is contained in:
parent
9c9d1650d1
commit
15cfa3bf62
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user