From: Jonatan Schlag Date: Sat, 29 Jul 2017 08:39:37 +0000 (+0200) Subject: network: add new ipsec functionality X-Git-Tag: 009~103 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1b67a8c630f81991445a524843040b4005be056f;p=network.git network: add new ipsec functionality Signed-off-by: Jonatan Schlag Signed-off-by: Michael Tremer --- diff --git a/src/network b/src/network index 16c8f609..88c90b1f 100644 --- a/src/network +++ b/src/network @@ -1409,6 +1409,24 @@ cli_vpn() { security-policies) cli_vpn_security_policies $@ ;; + ipsec) + cli_vpn_ipsec $@ + ;; + *) + error "Unrecognized argument: ${action}" + exit ${EXIT_ERROR} + ;; + esac +} + +cli_vpn_ipsec() { + local action=${1} + shift 1 + + case "${action}" in + connection) + cli_vpn_ipsec_connection $@ + ;; *) error "Unrecognized argument: ${action}" exit ${EXIT_ERROR} @@ -1416,6 +1434,43 @@ cli_vpn() { esac } +cli_vpn_ipsec_connection() { + if ipsec_connection_exists ${1}; then + local connection=${1} + local key=${2} + key=${key//-/_} + shift 2 + + case "${key}" in + authentication|inactivity-timout|local|mode|peer|remote|security-policy) + ipsec_connection_${key} ${connection} $@ + ;; + *) + error "Unrecognized argument: ${key}" + exit ${EXIT_ERROR} + ;; + esac + else + local action=${1} + shift + + case "${action}" in + new) + ipsec_connection_new $@ + ;; + destroy) + ipsec_connection_destroy $@ + ;; + ""|*) + if [ -n "${action}" ]; then + error "Unrecognized argument: '${action}'" + fi + exit ${EXIT_ERROR} + ;; + esac + fi +} + cli_vpn_security_policies() { local action