updown 552 B

123456789101112131415161718
  1. #!/bin/bash
  2. IF_NAME="xfrmi-${PLUTO_IF_ID_IN}"
  3. case "${PLUTO_VERB}" in
  4. up-client)
  5. /usr/local/libexec/ipsec/xfrmi -n "${IF_NAME}" -i "${PLUTO_IF_ID_IN}" -d eth0
  6. ip link set "${IF_NAME}" up
  7. ip route add 10.1.0.0/16 dev "${IF_NAME}"
  8. iptables -A FORWARD -i "${IF_NAME}" -j ACCEPT
  9. iptables -A FORWARD -o "${IF_NAME}" -j ACCEPT
  10. ;;
  11. down-client)
  12. iptables -D FORWARD -i "${IF_NAME}" -j ACCEPT
  13. iptables -D FORWARD -o "${IF_NAME}" -j ACCEPT
  14. ip link del "${IF_NAME}"
  15. ;;
  16. esac