From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonatan Schlag To: network@lists.ipfire.org Subject: [PATCH] wireless-network: add enable and disable commands Date: Thu, 24 Aug 2017 15:05:42 +0200 Message-ID: <1503579942-7810-1-git-send-email-jonatan.schlag@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0660113693509232635==" List-Id: --===============0660113693509232635== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Signed-off-by: Jonatan Schlag --- src/functions/functions.wireless-networks | 33 +++++++++++++++++++++++++++++= -- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/src/functions/functions.wireless-networks b/src/functions/functi= ons.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=3D"WPA2-PSK-SHA256 WPA= 2-PSK WPA-PSK-SHA256 WP WIRELESS_NETWORK_SUPPORTED_MODES=3D"${WIRELESS_NETWORK_SUPPORTED_PSK_MODES} \ 802.1X WPA-EAP NONE" =20 -WIRELESS_NETWORK_CONFIG_SETTINGS=3D"ANONYMOUS_IDENTITY EAP_MODES HIDDEN \ +WIRELESS_NETWORK_CONFIG_SETTINGS=3D"ANONYMOUS_IDENTITY EAP_MODES ENABLED HID= DEN \ IDENTITY MODES PASSWORD PRIORITY PSK SSID" =20 cli_wireless_network() { @@ -49,7 +49,7 @@ cli_wireless_network() { local handle=3D"$(wireless_network_hash "${ssid}")" =20 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 =20 local ${WIRELESS_NETWORK_CONFIG_SETTINGS} + ENABLED=3D"true" MODES=3D"${WIRELESS_NETWORK_SUPPORTED_MODES}" SSID=3D"${ssid}" PRIORITY=3D0 @@ -251,6 +252,34 @@ wireless_network_destroy() { return ${EXIT_OK} } =20 +wireless_network_enable() { + if [ ! $# -eq 1 ]; then + log ERROR "Not enough arguments" + return ${EXIT_ERROR} + fi + + local handle=3D"${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=3D"${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=3D${1} --=20 2.6.3 --===============0660113693509232635==--