summaryrefslogtreecommitdiff
path: root/ipmasq/rules/A01precompute_ipsec.def
blob: 5d9091379e2674ec6542f006e5bf1cadef841e05 (plain)
  1. # You should not edit this file. Instead, create a file with the same
  2. # name as this one, but with a .rul extension instead of .def. The
  3. # .rul file will override this one.
  4. #
  5. # However, any changes you make to this file will be preserved.
  6. # precompute ips and netmasks
  7. if [ -n "$IPSEC" ]; then
  8. if [ "$SHOWRULES" = "yes" ]; then
  9. echo "#: IPSec interfaces found:"
  10. fi
  11. IPSECGW=""
  12. for i in $IPSEC; do
  13. ii=$(echo $i | sed -e 's/\:/_/g')
  14. igw=$(ipsec look | grep IPIP:.*src=$ip | sed 's/^\([^[:blank:]]*\).*/\1/')
  15. cidrcollect=""
  16. for ipsecgw in $igw; do
  17. cidr=$(ipsec look | grep "=> $ipsecgw" | sed 's/^\([^[:blank:]]*\).*/\1/')
  18. cidrcollect="$cidrcollect $cidr"
  19. done
  20. eval "CIDROFIPSEC_${ii}=\"$cidrcollect\""
  21. if [ "$SHOWRULES" = "yes" ]; then
  22. /bin/echo -e "#: $i\t$ip/$nm\t$cidrcollect"
  23. fi
  24. done
  25. fi