diff mbox

[NetworkManager-1.0.8] wpa_supplicant: request ACS if channel==0

Message ID 1448624573-12147-1-git-send-email-u.oelmann@pengutronix.de
State Not Applicable
Headers show

Commit Message

Ulrich Ölmann Nov. 27, 2015, 11:42 a.m. UTC
By analogy to wpa_supplicant.conf Active Channel Selection (ACS) is coded as
"channel=0" within a connection.

Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
---
 src/supplicant-manager/nm-supplicant-config.c          | 13 +++++++++++++
 src/supplicant-manager/nm-supplicant-settings-verify.c |  1 +
 2 files changed, 14 insertions(+)

Comments

Jouni Malinen Dec. 24, 2015, 8:19 p.m. UTC | #1
On Fri, Nov 27, 2015 at 12:42:53PM +0100, Ulrich Ölmann wrote:
> By analogy to wpa_supplicant.conf Active Channel Selection (ACS) is coded as
> "channel=0" within a connection.

That sounds strange, but I guess there could be a separate frequency
parameter since wpa_supplicant will need that.. Anyway, this is an NM
patch, so not really applicable for this mailing list.
diff mbox

Patch

diff --git a/src/supplicant-manager/nm-supplicant-config.c b/src/supplicant-manager/nm-supplicant-config.c
index 692efef..c722966 100644
--- a/src/supplicant-manager/nm-supplicant-config.c
+++ b/src/supplicant-manager/nm-supplicant-config.c
@@ -381,6 +381,19 @@  nm_supplicant_config_add_setting_wireless (NMSupplicantConfig * self,
 			nm_log_warn (LOGD_SUPPLICANT, "Error adding mode=2 (ap) to supplicant config.");
 			return FALSE;
 		}
+
+		/* By analogy to wpa_supplicant.conf Active Channel Selection (ACS) has
+		 * to be coded as "channel=0" within the connection - wpa_supplicant
+		 * does not need a frequency then.
+		 */
+		if (!nm_setting_wireless_get_channel (setting)) {
+			if (!nm_supplicant_config_add_option (self, "acs", "1", -1, FALSE)) {
+				nm_log_warn (LOGD_SUPPLICANT, "Error adding acs=1 (enable active channel selection) to supplicant config.");
+				return FALSE;
+			}
+
+			fixed_freq = 0;
+		}
 	}
 
 	if ((is_adhoc || is_ap) && fixed_freq) {
diff --git a/src/supplicant-manager/nm-supplicant-settings-verify.c b/src/supplicant-manager/nm-supplicant-settings-verify.c
index 1328fd5..68bc66b 100644
--- a/src/supplicant-manager/nm-supplicant-settings-verify.c
+++ b/src/supplicant-manager/nm-supplicant-settings-verify.c
@@ -94,6 +94,7 @@  static const struct Opt opt_table[] = {
 	{ "bssid",              TYPE_KEYWORD, 0, 0, FALSE,  NULL },
 	{ "scan_ssid",          TYPE_INT,     0, 1, FALSE,  NULL },
 	{ "mode",               TYPE_INT,     0, 2, FALSE,  NULL },
+	{ "acs",                TYPE_INT,     0, 1, FALSE,  NULL },
 	{ "frequency",          TYPE_INT,     2412, 5825, FALSE,  NULL },
 	{ "auth_alg",           TYPE_KEYWORD, 0, 0, FALSE,  auth_alg_allowed },
 	{ "psk",                TYPE_BYTES,   0, 0, FALSE,  NULL },