Parcourir la source

privsep: Support frequency list for scan requests

Signed-off-by: Jouni Malinen <j@w1.fi>
Jouni Malinen il y a 8 ans
Parent
commit
865081c307
3 fichiers modifiés avec 21 ajouts et 0 suppressions
  1. 4 0
      src/common/privsep_commands.h
  2. 5 0
      src/drivers/driver_privsep.c
  3. 12 0
      wpa_supplicant/wpa_priv.c

+ 4 - 0
src/common/privsep_commands.h

@@ -30,10 +30,14 @@ enum privsep_cmd {
 	PRIVSEP_CMD_AUTHENTICATE,
 };
 
+#define PRIVSEP_MAX_SCAN_FREQS 50
+
 struct privsep_cmd_scan {
 	unsigned int num_ssids;
 	u8 ssids[WPAS_MAX_SCAN_SSIDS][32];
 	u8 ssid_lens[WPAS_MAX_SCAN_SSIDS];
+	unsigned int num_freqs;
+	u16 freqs[PRIVSEP_MAX_SCAN_FREQS];
 };
 
 struct privsep_cmd_authenticate {

+ 5 - 0
src/drivers/driver_privsep.c

@@ -116,6 +116,11 @@ static int wpa_driver_privsep_scan(void *priv,
 			  scan.ssid_lens[i]);
 	}
 
+	for (i = 0; i < PRIVSEP_MAX_SCAN_FREQS &&
+		     params->freqs && params->freqs[i]; i++)
+		scan.freqs[i] = params->freqs[i];
+	scan.num_freqs = i;
+
 	return wpa_priv_cmd(drv, PRIVSEP_CMD_SCAN, &scan, sizeof(scan),
 			    NULL, NULL);
 }

+ 12 - 0
wpa_supplicant/wpa_priv.c

@@ -139,6 +139,7 @@ static void wpa_priv_cmd_scan(struct wpa_priv_interface *iface,
 	struct wpa_driver_scan_params params;
 	struct privsep_cmd_scan *scan;
 	unsigned int i;
+	int freqs[PRIVSEP_MAX_SCAN_FREQS + 1];
 
 	if (iface->drv_priv == NULL)
 		return;
@@ -161,6 +162,17 @@ static void wpa_priv_cmd_scan(struct wpa_priv_interface *iface,
 		params.ssids[i].ssid_len = scan->ssid_lens[i];
 	}
 
+	if (scan->num_freqs > PRIVSEP_MAX_SCAN_FREQS) {
+		wpa_printf(MSG_DEBUG, "Invalid scan request (num_freqs)");
+		return;
+	}
+	if (scan->num_freqs) {
+		for (i = 0; i < scan->num_freqs; i++)
+			freqs[i] = scan->freqs[i];
+		freqs[i] = 0;
+		params.freqs = freqs;
+	}
+
 	if (iface->driver->scan2)
 		iface->driver->scan2(iface->drv_priv, &params);
 }