mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-16 03:56:54 +02: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
1 changed files with 2 additions and 1 deletions
|
@ -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…
Add table
Reference in a new issue