* Re: [RFC 2/2] network: add vpn security policies commands
[not found] <1500033485.2029.0@mail01.ipfire.org>
@ 2017-07-14 17:51 ` Michael Tremer
0 siblings, 0 replies; 3+ messages in thread
From: Michael Tremer @ 2017-07-14 17:51 UTC (permalink / raw)
To: network
[-- Attachment #1: Type: text/plain, Size: 3162 bytes --]
On Fri, 2017-07-14 at 13:58 +0200, Jonatan Schlag wrote:
>
>
> Am Fr, 14. Jul, 2017 um 1:25 schrieb Michael Tremer <michael.tremer(a)i
> pfire.org>:
> > Hi,
> >
> > On Thu, 2017-07-13 at 20:33 +0200, Jonatan Schlag wrote:
> > Signed-off-by: Jonatan Schlag <jonatan.schlag(a)ipfire.org>
> > ---
> > src/network | 67
> > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
> > 1 file changed, 65 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/network b/src/network
> > index 154d253..e7b637c 100644
> > --- a/src/network
> > +++ b/src/network
> > @@ -1194,7 +1194,6 @@ cli_reset() {
> > fi
> >
> > warning_log "Will reset the whole network
> > configuration!!!"
> > -
> > # Force mode is disabled by default
> > local force=0
> >
> >
> > This change doesn't have anything to do with the sec pols.
> >
> > @@ -1384,13 +1383,77 @@ cli_raw() {
> > exit ${EXIT_OK}
> > }
> >
> > +cli_vpn() {
> > +
> > + local action
> > + action=${1}
> > + shift 1
> >
> > Just no :)
>
> This is not understandable :). What just no or why?
It should be:
local action=${1}
shift 1
We always do the assignment of the arguments of a function in one line.
> >
> > +
> > + case "${action}" in
> > + security-policies)
> > + cli_vpn_security-policies $@
> > + ;;
> > + *)
> > + error "Unrecognized argument: ${action}"
> > + exit ${EXIT_ERROR}
> > + ;;
> > + esac
> > +}
> > +
> > +cli_vpn_security-policies() {
> >
> > Try to avoid a dash in the function name.
> >
> > +
> > + local action
> > + local security_policy
> > +
> > + if vpn_security_policy_exists ${1}; then
> > +
> > + security_policy=${1}
> > + key=${2}
> > + shift 2
> > +
> > + case "${key}" in
> > + cipher|compression|integrity|lifetime|pfs
> > |sh
> > ow)
> > + vpn_security_policies_${key}
> > ${security_policy} $@
> > + ;;
> > + group-type)
> > + vpn_security_policies_group_type
> > ${security_policy} $@
> > + ;;
> > + key-exchange)
> > + vpn_security_policies_key_exchang
> > e
> > ${security_policy} $@
> > + ;;
> > + *)
> > + error "Unrecognized argument:
> > ${key}"
> > + exit ${EXIT_ERROR}
> > + ;;
> > + esac
> > + else
> > + action=${1}
> > + shift
> > +
> > + case "${action}" in
> > + new)
> > + vpn_security_policies_new $@
> > + ;;
> > + destroy)
> > + vpn_security_policies_destroy $@
> > + ;;
> > + ""|*)
> > + if [ -n "${action}" ]; then
> > + error "Unrecognized
> > argument: '${action}'"
> > + fi
> > + exit ${EXIT_ERROR}
> > + ;;
> > + esac
> > + fi
> > +}
> > +
> > # Process the given action
> > case "${action}" in
> > init)
> > init_run
> > ;;
> >
> > - settings|hostname|port|device|zone|start|stop|restart|sta
> > tus
> > |reset|route)
> > + settings|hostname|port|device|zone|start|stop|restart|sta
> > tus
> > |reset|route|vpn)
> > cli_${action} $@
> > ;;
> >
> >
> > -Michael
>
> Jonatan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC 2/2] network: add vpn security policies commands
2017-07-13 18:33 ` [RFC 2/2] network: add vpn security policies commands Jonatan Schlag
@ 2017-07-13 23:25 ` Michael Tremer
0 siblings, 0 replies; 3+ messages in thread
From: Michael Tremer @ 2017-07-13 23:25 UTC (permalink / raw)
To: network
[-- Attachment #1: Type: text/plain, Size: 2321 bytes --]
Hi,
On Thu, 2017-07-13 at 20:33 +0200, Jonatan Schlag wrote:
> Signed-off-by: Jonatan Schlag <jonatan.schlag(a)ipfire.org>
> ---
> src/network | 67
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 65 insertions(+), 2 deletions(-)
>
> diff --git a/src/network b/src/network
> index 154d253..e7b637c 100644
> --- a/src/network
> +++ b/src/network
> @@ -1194,7 +1194,6 @@ cli_reset() {
> fi
>
> warning_log "Will reset the whole network configuration!!!"
> -
> # Force mode is disabled by default
> local force=0
>
This change doesn't have anything to do with the sec pols.
> @@ -1384,13 +1383,77 @@ cli_raw() {
> exit ${EXIT_OK}
> }
>
> +cli_vpn() {
> +
> + local action
> + action=${1}
> + shift 1
Just no :)
> +
> + case "${action}" in
> + security-policies)
> + cli_vpn_security-policies $@
> + ;;
> + *)
> + error "Unrecognized argument: ${action}"
> + exit ${EXIT_ERROR}
> + ;;
> + esac
> +}
> +
> +cli_vpn_security-policies() {
Try to avoid a dash in the function name.
> +
> + local action
> + local security_policy
> +
> + if vpn_security_policy_exists ${1}; then
> +
> + security_policy=${1}
> + key=${2}
> + shift 2
> +
> + case "${key}" in
> + cipher|compression|integrity|lifetime|pfs|sh
> ow)
> + vpn_security_policies_${key}
> ${security_policy} $@
> + ;;
> + group-type)
> + vpn_security_policies_group_type
> ${security_policy} $@
> + ;;
> + key-exchange)
> + vpn_security_policies_key_exchange
> ${security_policy} $@
> + ;;
> + *)
> + error "Unrecognized argument:
> ${key}"
> + exit ${EXIT_ERROR}
> + ;;
> + esac
> + else
> + action=${1}
> + shift
> +
> + case "${action}" in
> + new)
> + vpn_security_policies_new $@
> + ;;
> + destroy)
> + vpn_security_policies_destroy $@
> + ;;
> + ""|*)
> + if [ -n "${action}" ]; then
> + error "Unrecognized
> argument: '${action}'"
> + fi
> + exit ${EXIT_ERROR}
> + ;;
> + esac
> + fi
> +}
> +
> # Process the given action
> case "${action}" in
> init)
> init_run
> ;;
>
> - settings|hostname|port|device|zone|start|stop|restart|status
> |reset|route)
> + settings|hostname|port|device|zone|start|stop|restart|status
> |reset|route|vpn)
> cli_${action} $@
> ;;
>
-Michael
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [RFC 2/2] network: add vpn security policies commands
2017-07-13 18:33 new feature vpn-security-policies Jonatan Schlag
@ 2017-07-13 18:33 ` Jonatan Schlag
2017-07-13 23:25 ` Michael Tremer
0 siblings, 1 reply; 3+ messages in thread
From: Jonatan Schlag @ 2017-07-13 18:33 UTC (permalink / raw)
To: network
[-- Attachment #1: Type: text/plain, Size: 2008 bytes --]
Signed-off-by: Jonatan Schlag <jonatan.schlag(a)ipfire.org>
---
src/network | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 65 insertions(+), 2 deletions(-)
diff --git a/src/network b/src/network
index 154d253..e7b637c 100644
--- a/src/network
+++ b/src/network
@@ -1194,7 +1194,6 @@ cli_reset() {
fi
warning_log "Will reset the whole network configuration!!!"
-
# Force mode is disabled by default
local force=0
@@ -1384,13 +1383,77 @@ cli_raw() {
exit ${EXIT_OK}
}
+cli_vpn() {
+
+ local action
+ action=${1}
+ shift 1
+
+ case "${action}" in
+ security-policies)
+ cli_vpn_security-policies $@
+ ;;
+ *)
+ error "Unrecognized argument: ${action}"
+ exit ${EXIT_ERROR}
+ ;;
+ esac
+}
+
+cli_vpn_security-policies() {
+
+ local action
+ local security_policy
+
+ if vpn_security_policy_exists ${1}; then
+
+ security_policy=${1}
+ key=${2}
+ shift 2
+
+ case "${key}" in
+ cipher|compression|integrity|lifetime|pfs|show)
+ vpn_security_policies_${key} ${security_policy} $@
+ ;;
+ group-type)
+ vpn_security_policies_group_type ${security_policy} $@
+ ;;
+ key-exchange)
+ vpn_security_policies_key_exchange ${security_policy} $@
+ ;;
+ *)
+ error "Unrecognized argument: ${key}"
+ exit ${EXIT_ERROR}
+ ;;
+ esac
+ else
+ action=${1}
+ shift
+
+ case "${action}" in
+ new)
+ vpn_security_policies_new $@
+ ;;
+ destroy)
+ vpn_security_policies_destroy $@
+ ;;
+ ""|*)
+ if [ -n "${action}" ]; then
+ error "Unrecognized argument: '${action}'"
+ fi
+ exit ${EXIT_ERROR}
+ ;;
+ esac
+ fi
+}
+
# Process the given action
case "${action}" in
init)
init_run
;;
- settings|hostname|port|device|zone|start|stop|restart|status|reset|route)
+ settings|hostname|port|device|zone|start|stop|restart|status|reset|route|vpn)
cli_${action} $@
;;
--
2.6.3
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-07-14 17:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <1500033485.2029.0@mail01.ipfire.org>
2017-07-14 17:51 ` [RFC 2/2] network: add vpn security policies commands Michael Tremer
2017-07-13 18:33 new feature vpn-security-policies Jonatan Schlag
2017-07-13 18:33 ` [RFC 2/2] network: add vpn security policies commands Jonatan Schlag
2017-07-13 23:25 ` Michael Tremer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox