From 11569b5d8aa315511f1ae90b73d0775c4206b098 Mon Sep 17 00:00:00 2001 From: qo-op Date: Tue, 8 Dec 2020 03:36:10 +0100 Subject: [PATCH] [[ ! $foundIp && ! $isLAN ]] --- zen/ipfs_SWARM_refresh.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/zen/ipfs_SWARM_refresh.sh b/zen/ipfs_SWARM_refresh.sh index aabc1fd..0033e54 100755 --- a/zen/ipfs_SWARM_refresh.sh +++ b/zen/ipfs_SWARM_refresh.sh @@ -45,9 +45,10 @@ do timestamp=$(date -u +%s%N | cut -b1-13) echo "$nowdate - $id - $ip" - foundIp=$(cat ~/.zen/A_allow_ip.txt | grep "$ip" | wc -l) + foundIp=$(cat ~/.zen/A_allow_ip.txt | grep "$ip") + isLAN=$(echo $ip | cut -f3 -d '/' | grep -E "(^127\.)|(^192\.168\.)|(^fd42\:)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/") - if [ "$foundIp" -eq 0 ] ; then + if [[ ! $foundIp && ! $isLAN ]] ; then echo "${ip} of peer ${id} is not in the authorized ip list." echo "${peer} will be removed from the swarm"