* [PATCH] wireless-network: add enable and disable commands
@ 2017-08-24 13:05 Jonatan Schlag
0 siblings, 0 replies; only message in thread
From: Jonatan Schlag @ 2017-08-24 13:05 UTC (permalink / raw)
To: network
[-- Attachment #1: Type: text/plain, Size: 2169 bytes --]
Signed-off-by: Jonatan Schlag <jonatan.schlag(a)ipfire.org>
---
src/functions/functions.wireless-networks | 33 +++++++++++++++++++++++++++++--
1 file changed, 31 insertions(+), 2 deletions(-)
diff --git a/src/functions/functions.wireless-networks b/src/functions/functions.wireless-networks
index 4fedcb9..b1d65f9 100644
--- a/src/functions/functions.wireless-networks
+++ b/src/functions/functions.wireless-networks
@@ -24,7 +24,7 @@ WIRELESS_NETWORK_SUPPORTED_PSK_MODES="WPA2-PSK-SHA256 WPA2-PSK WPA-PSK-SHA256 WP
WIRELESS_NETWORK_SUPPORTED_MODES="${WIRELESS_NETWORK_SUPPORTED_PSK_MODES} \
802.1X WPA-EAP NONE"
-WIRELESS_NETWORK_CONFIG_SETTINGS="ANONYMOUS_IDENTITY EAP_MODES HIDDEN \
+WIRELESS_NETWORK_CONFIG_SETTINGS="ANONYMOUS_IDENTITY EAP_MODES ENABLED HIDDEN \
IDENTITY MODES PASSWORD PRIORITY PSK SSID"
cli_wireless_network() {
@@ -49,7 +49,7 @@ cli_wireless_network() {
local handle="$(wireless_network_hash "${ssid}")"
case "${key}" in
- modes|pre_shared_key|priority)
+ disable|enable|modes|pre_shared_key|priority)
wireless_network_${key} "${handle}" "$@"
;;
show)
@@ -220,6 +220,7 @@ wireless_network_new() {
fi
local ${WIRELESS_NETWORK_CONFIG_SETTINGS}
+ ENABLED="true"
MODES="${WIRELESS_NETWORK_SUPPORTED_MODES}"
SSID="${ssid}"
PRIORITY=0
@@ -251,6 +252,34 @@ wireless_network_destroy() {
return ${EXIT_OK}
}
+wireless_network_enable() {
+ if [ ! $# -eq 1 ]; then
+ log ERROR "Not enough arguments"
+ return ${EXIT_ERROR}
+ fi
+
+ local handle="${1}"
+
+ if ! wireless_network_write_config_key "${handle}" "ENABLED" "true"; then
+ log ERROR "Could not write configuration settings"
+ return ${EXIT_ERROR}
+ fi
+}
+
+wireless_network_disable() {
+ if [ ! $# -eq 1 ]; then
+ log ERROR "Not enough arguments"
+ return ${EXIT_ERROR}
+ fi
+
+ local handle="${1}"
+
+ if ! wireless_network_write_config_key "${handle}" "ENABLED" "false"; then
+ log ERROR "Could not write configuration settings"
+ return ${EXIT_ERROR}
+ fi
+}
+
wireless_networks_mode_is_valid() {
assert [ $# -eq 1 ]
local mode=${1}
--
2.6.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-08-24 13:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-24 13:05 [PATCH] wireless-network: add enable and disable commands Jonatan Schlag
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox