From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonatan Schlag To: network@lists.ipfire.org Subject: [RFC PATCH 2/2] network: add ipsec Date: Wed, 26 Jul 2017 19:32:34 +0200 Message-ID: <1501090354-17617-2-git-send-email-jonatan.schlag@ipfire.org> In-Reply-To: <1501090354-17617-1-git-send-email-jonatan.schlag@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8468786964353934733==" List-Id: --===============8468786964353934733== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Signed-off-by: Jonatan Schlag --- src/network | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/src/network b/src/network index adc9ac3..893c411 100644 --- a/src/network +++ b/src/network @@ -1403,6 +1403,9 @@ cli_vpn() { security-policies) cli_vpn_security_policies $@ ;; + ipsec) + cli_vpn_ipsec $@ + ;; *) error "Unrecognized argument: ${action}" exit ${EXIT_ERROR} @@ -1410,6 +1413,63 @@ cli_vpn() { esac } +cli_vpn_ipsec() { + local action=${1} + shift 1 + + case "${action}" in + connection) + cli_vpn_ipsec_connection $@ + ;; + *) + error "Unrecognized argument: ${action}" + exit ${EXIT_ERROR} + ;; + esac +} + +cli_vpn_ipsec_connection() { + if vpn_ipsec_connection_exists ${1}; then + local connection=${1} + local key=${2} + shift 2 + + case "${key}" in + authentication|local|mode|peer|remote) + vpn_ipsec_connection_${key} ${connection} $@ + ;; + inactivity-timeout) + vpn_ipsec_connection_inactivity_timeout ${connection} $@ + ;; + security-policy) + vpn_ipsec_connection_security_policy ${connection} $@ + ;; + *) + error "Unrecognized argument: ${key}" + exit ${EXIT_ERROR} + ;; + esac + else + local action=${1} + shift + + case "${action}" in + new) + vpn_ipsec_connection_new $@ + ;; + destroy) + vpn_ipsec_connection_destroy $@ + ;; + ""|*) + if [ -n "${action}" ]; then + error "Unrecognized argument: '${action}'" + fi + exit ${EXIT_ERROR} + ;; + esac + fi +} + cli_vpn_security_policies() { local action -- 2.6.3 --===============8468786964353934733==--