You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.0 KiB

  1. #!/bin/sh
  2. #
  3. log="logger -t p1client-up[$$]"
  4. . /lib/functions.sh
  5. . /etc/racoon/functions.sh
  6. if [ -z "$SPLIT_INCLUDE_CIDR" ]; then
  7. $log "Connection without server-pushed routing is not supported"
  8. exit 1
  9. fi
  10. $log "Setting up tunnel to server $REMOTE_ADDR"
  11. $log "Making tunnel(-s) to $SPLIT_INCLUDE_CIDR through $INTERNAL_ADDR4"
  12. get_fieldval data dev "$(/usr/sbin/ip route get $REMOTE_ADDR)"
  13. ip address add $INTERNAL_ADDR4/32 dev $data
  14. config_load racoon
  15. config_get confIntZone racoon int_zone lan
  16. config_get confExtZone racoon ext_zone wan
  17. data=$(get_zoneiflist $confIntZone)
  18. if [ -n "$data" ]; then
  19. for item in $data ; do
  20. network_get_subnet locnet $item
  21. if [ -n "$locnet" ]; then
  22. manage_sa add "$locnet" "$SPLIT_INCLUDE_CIDR" $REMOTE_ADDR $INTERNAL_ADDR4
  23. else
  24. $log "Can not find subnet on interface $item"
  25. fi
  26. done
  27. else
  28. $log "Can not find interfaces in zone $confIntZone"
  29. fi
  30. manage_fw add $confIntZone $confExtZone "$INTERNAL_ADDR4 $SPLIT_INCLUDE_CIDR"
  31. # EOF /etc/racoon/p1client-up