public inbox for network@lists.ipfire.org
 help / color / mirror / Atom feed
* [PATCH 1/2] raw: add command vpn-security-policy-exists
@ 2017-08-04  8:32 Jonatan Schlag
  2017-08-04  8:32 ` [PATCH 2/2] bash-autocompletion: add basic security-policy support Jonatan Schlag
  0 siblings, 1 reply; 2+ messages in thread
From: Jonatan Schlag @ 2017-08-04  8:32 UTC (permalink / raw)
  To: network

[-- Attachment #1: Type: text/plain, Size: 459 bytes --]

Signed-off-by: Jonatan Schlag <jonatan.schlag(a)ipfire.org>
---
 src/network | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/network b/src/network
index 1c3e2c5..109c106 100644
--- a/src/network
+++ b/src/network
@@ -1325,6 +1325,9 @@ cli_raw() {
 		list-zone-config-hids)
 			zone_config_list_hids $@
 			;;
+		vpn-security-policy-exists)
+			vpn_security_policy_exists $@
+			;;
 		zone-name-is-valid)
 			zone_name_is_valid $@
 			;;
-- 
2.6.3


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 2/2] bash-autocompletion: add basic security-policy support
  2017-08-04  8:32 [PATCH 1/2] raw: add command vpn-security-policy-exists Jonatan Schlag
@ 2017-08-04  8:32 ` Jonatan Schlag
  0 siblings, 0 replies; 2+ messages in thread
From: Jonatan Schlag @ 2017-08-04  8:32 UTC (permalink / raw)
  To: network

[-- Attachment #1: Type: text/plain, Size: 3027 bytes --]

Signed-off-by: Jonatan Schlag <jonatan.schlag(a)ipfire.org>
---
 src/bash-completion/network | 92 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 91 insertions(+), 1 deletion(-)

diff --git a/src/bash-completion/network b/src/bash-completion/network
index 5fd6191..668c699 100644
--- a/src/bash-completion/network
+++ b/src/bash-completion/network
@@ -343,7 +343,7 @@ _network_settings() {
 _network_vpn() {
 	local words=( $@ )
 
-	local commands="ipsec"
+	local commands="ipsec security-policies"
 	local cmd="$(_network_find_on_cmdline "${commands}")"
 	if [[ -z "${cmd}" ]]; then
 		COMPREPLY=( $(compgen -W "${commands}" -- "${cur}") )
@@ -356,6 +356,9 @@ _network_vpn() {
 		ipsec)
 			_network_vpn_ipsec ${args}
 			;;
+		security-policies)
+			_network_vpn_security_policies ${args}
+			;;
 		esac
 }
 
@@ -520,6 +523,93 @@ _network_vpn_ipsec_connection_subcommands_security_policy() {
 	fi
 }
 
+_network_vpn_security_policies() {
+	local words=( $@ )
+
+	local commands="destroy new $(network raw list-vpn-security-policies-all)"
+	local cmd="$(_network_find_on_cmdline "${commands}")"
+	if [[ -z "${cmd}" ]]; then
+		COMPREPLY=( $(compgen -W "${commands}" -- "${cur}") )
+		return 0
+	fi
+
+
+	local args="${words[@]:1}"
+	case "${cmd}" in
+		destroy)
+			:
+			;;
+		new)
+			:
+			;;
+		*)
+			if network raw vpn-security-policy-exists ${cmd}; then
+				_network_vpn_security_policies_subcommands ${cmd} ${args}
+			fi
+			;;
+		esac
+}
+
+_network_vpn_security_policies_subcommands() {
+	local policy=${1}
+	shift
+	local words=( $@ )
+
+	local commands="cipher compression group-type integrity key-exchange lifetime pfs show"
+	local cmd="$(_network_find_on_cmdline "${commands}")"
+	if [[ -z "${cmd}" ]]; then
+		COMPREPLY=( $(compgen -W "${commands}" -- "${cur}") )
+		return 0
+	fi
+
+
+	local args="${words[@]:1}"
+	case "${cmd}" in
+		cipher)
+			_network_vpn_security_policies_subcommands_cipher ${policy} ${args}
+			;;
+		compression)
+			_network_vpn_security_policies_subcommands_compression ${policy} ${args}
+			;;
+		group-type)
+			_network_vpn_security_policies_subcommands_group_type ${policy} ${args}
+			;;
+		integrity)
+			_network_vpn_security_policies_subcommands_integrity ${policy} ${args}
+			;;
+		key-exchange)
+			_network_vpn_security_policies_subcommands_key_exchange ${policy} ${args}
+			;;
+		pfs)
+			_network_vpn_security_policies_subcommands_pfs ${policy} ${args}
+			;;
+		esac
+}
+
+_network_vpn_security_policies_subcommands_cipher() {
+	:
+}
+
+_network_vpn_security_policies_subcommands_compression() {
+	:
+}
+
+_network_vpn_security_policies_subcommands_group_type() {
+	:
+}
+
+_network_vpn_security_policies_subcommands_integrity() {
+	:
+}
+
+_network_vpn_security_policies_subcommands_key_exchange() {
+	:
+}
+
+_network_vpn_security_policies_subcommands_pfs() {
+	:
+}
+
 _network_zone() {
 	local words=( $@ )
 
-- 
2.6.3


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-04  8:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-04  8:32 [PATCH 1/2] raw: add command vpn-security-policy-exists Jonatan Schlag
2017-08-04  8:32 ` [PATCH 2/2] bash-autocompletion: add basic security-policy support Jonatan Schlag

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox