]> git.ipfire.org Git - people/stevee/network.git/blobdiff - src/functions/functions.wireless-networks
wpa_supplicant: Add ctrl_interface
[people/stevee/network.git] / src / functions / functions.wireless-networks
index d2a81ac0a0eb0f5cf6df42bd11e37cdc3bb3b3b3..5a0900256a54d58fd50826486b16557138b46a59 100644 (file)
@@ -333,6 +333,32 @@ wireless_network_priority() {
        fi
 }
 
+wireless_networks_write_wpa_supplicant_configuration() {
+       local device="${1}"
+
+       local file="${WPA_SUPPLICANT_CONF_DIR}/${device}.conf"
+
+       # Ensure we can write the file
+       make_parent_directory "${file}"
+
+       local country="$(wireless_get_reg_domain)"
+
+       (
+               config_header "WPA supplicant configuration file"
+
+               # Set control socket directory.
+               print "ctrl_interface=${WPA_SUPPLICANT_SOCKET_DIR}"
+
+               # Honour country
+               if isset country; then
+                       print "country=${country}"
+                       print
+               fi
+
+               wireless_networks_to_wpa_supplicant
+       ) > ${file}
+}
+
 wireless_networks_to_wpa_supplicant() {
        local handle
        for handle in $(wireless_network_list); do
@@ -411,6 +437,11 @@ wireless_network_to_wpa_supplicant() {
        print_indent 0 "# ${SSID}"
        print_indent 0 "network = {"
        print_indent 1 "ssid=\"${SSID}\""
+
+       # Priority
+       if isinteger PRIORITY; then
+               print_indent 1 "priority=${PRIORITY}"
+       fi
        print
 
        # Authentication