From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Tremer To: network@lists.ipfire.org Subject: Re: [RFC PATCH 2/2] network: add ipsec Date: Thu, 27 Jul 2017 16:46:21 +0100 Message-ID: <1501170381.2528.3.camel@ipfire.org> In-Reply-To: <1501090354-17617-2-git-send-email-jonatan.schlag@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0789195782521998478==" List-Id: --===============0789195782521998478== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Hi, On Wed, 2017-07-26 at 19:32 +0200, Jonatan Schlag wrote: > 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 You could just replace any - by _ in ${key} which makes this easier: key=${key//-/_} > + > + case "${key}" in > + authentication|local|mode|peer|remote) > + vpn_ipsec_connection_${key} > ${connection} $@ > + ;; > + inactivity-timeout) > + vpn_ipsec_connection_inactivity_time > out ${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 --===============0789195782521998478== Content-Type: application/pgp-signature Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="signature.asc" MIME-Version: 1.0 LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KVmVyc2lvbjogR251UEcgdjIKCmlRSWNCQUFC Q2dBR0JRSlplZ3JOQUFvSkVJQjU4UDl2a0FrSGl4UVFBSjNoVXpvVlgyUk9lNW5DaWFLN091bm0K dUVvUVRtZmdBellFWEl3Z0l4R0tzeVNha3dTeTJNbmRhL0pmZVZjRDhtNVFsakRqRm1EOEVEWEpI amltbXc3NgpwcFkxbUMxRDhHT0pmR3B1Qy8zOHJsZ3VrcHd3Wm5SY1NpeTlWMWNTRkpJZnoxRlRF aHhJQzMvb0dhTkswYzJxCmFJWDFRV3dHT2s3TVlwb2g4d2NVeEJ1WnU5eHcrT3g4Qm9TWHhDY0Rs bCtTQUlCZlJVSmlVYmptN25rMzBTM0IKdmdrMVRla3JONjlEd0hOMzRQZDZrZjhvWVhlTHJqbHFR a3lmRzYybUVyMnB5TkVDdWV4V3dzNEtya1I0SmNtTQp2M0RqSC8zNGl3dDZEbllEakw4UFRhZVlT K1FnRjdiWk4zeUkzNEpjbUhTMnpGRkZQVEx5RUVmTDNYWnE1b1hnClFDNHNQem1TME54ZmF2ZnNx NWFJNml6SlRxdWJGRFVGUmpYY1NReUM4Y1o3ZXN6MUZ4c1VXTTYwcHJuZHBKMncKYmFoNHVLZGh3 TTBsRW1SRXlxQUE2bEtUL0gzNi9QK1lUMDR2bi80ODZ2QkNJUUFnSUdzckcvRnBJN3JlUUhNUQp1 WDFHQjdHRmd6MHhIdllpRWtMaks1MVpWL25KZWhuT2dKc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