p1client-down 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/sh
  2. #
  3. log="logger -t p1client-down[$$]"
  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 "Shutting down tunnel to server $REMOTE_ADDR"
  11. $log "Closing tunnel(-s) to $SPLIT_INCLUDE_CIDR through $INTERNAL_ADDR4"
  12. config_load racoon
  13. config_get confIntZone racoon int_zone lan
  14. config_get confExtZone racoon ext_zone wan
  15. manage_fw del $confIntZone $confExtZone "$INTERNAL_ADDR4 $SPLIT_INCLUDE_CIDR"
  16. data=$(get_zoneiflist $confIntZone)
  17. if [ -n "$data" ]; then
  18. for item in $data ; do
  19. network_get_subnet locnet $item
  20. if [ -n "$locnet" ]; then
  21. manage_sa del "$locnet" "$SPLIT_INCLUDE_CIDR" $REMOTE_ADDR $INTERNAL_ADDR4
  22. else
  23. $log "Can not find subnet on interface $item"
  24. fi
  25. done
  26. else
  27. $log "Can not find subnets in zone $confIntZone"
  28. fi
  29. get_fieldval data dev "$(/usr/sbin/ip route get $REMOTE_ADDR)"
  30. ip address del $INTERNAL_ADDR4/32 dev $data
  31. # EOF /etc/racoon/p1client-down