From 5446a009aa33f53d58ee2dfb099ea1edcc877036 Mon Sep 17 00:00:00 2001 From: Jouke Witteveen Date: Fri, 29 Mar 2013 12:05:01 +0100 Subject: Simplify wpa network block creation It had grown a little diffuse. --- src/lib/8021x | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/lib/8021x b/src/lib/8021x index 7a841a4..65ef8f9 100644 --- a/src/lib/8021x +++ b/src/lib/8021x @@ -195,23 +195,6 @@ wpa_make_config_file() { ## Generate a network block for wpa_supplicant # $Security: type of wireless security wpa_make_config_block() { - case $Security in - none|wep|wpa) - echo "ssid=$(wpa_quote "$ESSID")" - [[ $AP ]] && echo "bssid=${AP,,}" - is_yes "${AdHoc:-no}" && echo "mode=1" - ;; - wpa-configsection) - printf "%s\n" "${WPAConfigSection[@]}" - return - ;; - *) - report_error "Unsupported security setting: '$Security'" - return 1 - ;; - esac - - # Key management case $Security in none) echo "key_mgmt=NONE" @@ -229,12 +212,20 @@ wpa_make_config_block() { echo "psk=$(wpa_quote "$Key")" fi ;; + wpa-configsection) + printf "%s\n" "${WPAConfigSection[@]}" + return + ;; + *) + report_error "Unsupported security setting: '$Security'" + return 1 + ;; esac - # Hidden SSID + echo "ssid=$(wpa_quote "$ESSID")" + [[ $AP ]] && echo "bssid=${AP,,}" is_yes "${Hidden:-no}" && echo "scan_ssid=1" - - # Priority group for the network + is_yes "${AdHoc:-no}" && echo "mode=1" [[ $Priority ]] && echo "priority=$Priority" } -- cgit v1.2.3-24-g4f1b