/programs/_updown/_updown.in

https://gitlab.com/envieidoc/Openswan · Autoconf · 140 lines · 16 code · 8 blank · 116 comment · 2 complexity · 73fc422d2768a1368e2dc66b70e1a927 MD5 · raw file

  1. #! /bin/sh
  2. # iproute2 version, default updown script
  3. #
  4. # Copyright (C) 2003-2004 Nigel Metheringham
  5. # Copyright (C) 2002-2007 Michael Richardson <mcr@xelerance.com>
  6. # Copyright (C) 2003-2005 Tuomo Soini <tis@foobar.fi>
  7. #
  8. # This program is free software; you can redistribute it and/or modify it
  9. # under the terms of the GNU General Public License as published by the
  10. # Free Software Foundation; either version 2 of the License, or (at your
  11. # option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
  12. #
  13. # This program is distributed in the hope that it will be useful, but
  14. # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  15. # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  16. # for more details.
  17. #
  18. # CAUTION: Installing a new version of Openswan will install a new
  19. # copy of this script, wiping out any custom changes you make. If
  20. # you need changes, make a copy of this under another name, and customize
  21. # that, and use the (left/right)updown parameters in ipsec.conf to make
  22. # Openswan use yours instead of this default one.
  23. test $IPSEC_INIT_SCRIPT_DEBUG && set -v -x
  24. LC_ALL=C export LC_ALL
  25. # things that this script gets (from ipsec_pluto(8) man page)
  26. #
  27. #
  28. # PLUTO_VERSION
  29. # indicates what version of this interface is being
  30. # used. This document describes version 1.1. This
  31. # is upwardly compatible with version 1.0.
  32. #
  33. # PLUTO_VERB
  34. # specifies the name of the operation to be performed
  35. # (prepare-host, prepare-client, up-host, up-client,
  36. # down-host, or down-client). If the address family
  37. # for security gateway to security gateway communications
  38. # is IPv6, then a suffix of -v6 is added to the
  39. # verb.
  40. #
  41. # PLUTO_CONNECTION
  42. # is the name of the connection for which we are
  43. # routing.
  44. #
  45. # PLUTO_CONN_POLICY
  46. # the policy of the connection, as in:
  47. # RSASIG+ENCRYPT+TUNNEL+PFS+DONTREKEY+OPPORTUNISTIC+failureDROP+lKOD+rKOD
  48. #
  49. # PLUTO_NEXT_HOP
  50. # is the next hop to which packets bound for the peer
  51. # must be sent.
  52. #
  53. # PLUTO_INTERFACE
  54. # is the name of the ipsec interface to be used.
  55. #
  56. # PLUTO_ME
  57. # is the IP address of our host.
  58. #
  59. # PLUTO_MY_CLIENT
  60. # is the IP address / count of our client subnet. If
  61. # the client is just the host, this will be the
  62. # host's own IP address / max (where max is 32 for
  63. # IPv4 and 128 for IPv6).
  64. #
  65. # PLUTO_MY_CLIENT_NET
  66. # is the IP address of our client net. If the client
  67. # is just the host, this will be the host's own IP
  68. # address.
  69. #
  70. # PLUTO_MY_CLIENT_MASK
  71. # is the mask for our client net. If the client is
  72. # just the host, this will be 255.255.255.255.
  73. #
  74. # PLUTO_MY_SOURCEIP
  75. # if non-empty, then the source address for the route will be
  76. # set to this IP address.
  77. #
  78. # PLUTO_MY_PROTOCOL
  79. # is the protocol for this connection. Useful for
  80. # firewalling.
  81. #
  82. # PLUTO_MY_PORT
  83. # is the port. Useful for firewalling.
  84. #
  85. # PLUTO_PEER
  86. # is the IP address of our peer.
  87. #
  88. # PLUTO_PEER_CLIENT
  89. # is the IP address / count of the peer's client subnet.
  90. # If the client is just the peer, this will be
  91. # the peer's own IP address / max (where max is 32
  92. # for IPv4 and 128 for IPv6).
  93. #
  94. # PLUTO_PEER_CLIENT_NET
  95. # is the IP address of the peer's client net. If the
  96. # client is just the peer, this will be the peer's
  97. # own IP address.
  98. #
  99. # PLUTO_PEER_CLIENT_MASK
  100. # is the mask for the peer's client net. If the
  101. # client is just the peer, this will be
  102. # 255.255.255.255.
  103. #
  104. # PLUTO_PEER_PROTOCOL
  105. # is the protocol set for remote end with port
  106. # selector.
  107. #
  108. # PLUTO_PEER_PORT
  109. # is the peer's port. Useful for firewalling.
  110. #
  111. # PLUTO_CONNECTION_TYPE
  112. #
  113. # PLUTO_MY_REF/PLUTO_PEER_REF
  114. # KLIPSng(mast) references to the SA to be used in each
  115. # direction.
  116. #
  117. # PLUTO_STACK
  118. # The kernel level IPstack used (see protostack=)
  119. case $PLUTO_VERSION in
  120. 1.*) # Older Pluto?!? Play it safe, script may be using new features.
  121. echo "$0: obsolete interface version \`$PLUTO_VERSION'," >&2
  122. echo "$0: called by obsolete Pluto?" >&2
  123. exit 2;;
  124. 2.*) ;;
  125. esac
  126. if [ -x @IPSEC_LIBDIR@/_updown.${PLUTO_STACK} ]
  127. then
  128. exec @IPSEC_LIBDIR@/_updown.${PLUTO_STACK} $*
  129. else
  130. echo "FATAL: Could not execute @IPSEC_LIBDIR@/_updown.${PLUTO_STACK} $*"
  131. fi
  132. exit 3;