浏览代码

wl12xx: ignore sched scan match sets without SSID

For now, cfg80211 only support match sets with SSIDs, but in the
future more parameters will be added.  This patch ignores eventual
matches that do not contain SSIDs in preparation for the future.  This
change also affects the case where broadcast SSIDs are used.  Matching
a broadcast SSID will match everything, so they can be ignored.

Signed-off-by: Luciano Coelho <coelho@ti.com>
Luciano Coelho 14 年之前
父节点
当前提交
20a33e52ed
共有 1 个文件被更改,包括 12 次插入3 次删除
  1. 12 3
      drivers/net/wireless/wl12xx/scan.c

+ 12 - 3
drivers/net/wireless/wl12xx/scan.c

@@ -479,12 +479,17 @@ wl12xx_scan_sched_scan_ssid_list(struct wl1271 *wl,
 	struct wl1271_cmd_sched_scan_ssid_list *cmd = NULL;
 	struct wl1271_cmd_sched_scan_ssid_list *cmd = NULL;
 	struct cfg80211_match_set *sets = req->match_sets;
 	struct cfg80211_match_set *sets = req->match_sets;
 	struct cfg80211_ssid *ssids = req->ssids;
 	struct cfg80211_ssid *ssids = req->ssids;
-	int ret = 0, type, i, j;
+	int ret = 0, type, i, j, n_match_ssids = 0;
 
 
 	wl1271_debug(DEBUG_CMD, "cmd sched scan ssid list");
 	wl1271_debug(DEBUG_CMD, "cmd sched scan ssid list");
 
 
+	/* count the match sets that contain SSIDs */
+	for (i = 0; i < req->n_match_sets; i++)
+		if (sets[i].ssid.ssid_len > 0)
+			n_match_ssids++;
+
 	/* No filter, no ssids or only bcast ssid */
 	/* No filter, no ssids or only bcast ssid */
-	if (!req->n_match_sets &&
+	if (!n_match_ssids &&
 	    (!req->n_ssids ||
 	    (!req->n_ssids ||
 	     (req->n_ssids == 1 && req->ssids[0].ssid_len == 0))) {
 	     (req->n_ssids == 1 && req->ssids[0].ssid_len == 0))) {
 		type = SCAN_SSID_FILTER_ANY;
 		type = SCAN_SSID_FILTER_ANY;
@@ -497,7 +502,7 @@ wl12xx_scan_sched_scan_ssid_list(struct wl1271 *wl,
 		goto out;
 		goto out;
 	}
 	}
 
 
-	if (!req->n_match_sets) {
+	if (!n_match_ssids) {
 		/* No filter, with ssids */
 		/* No filter, with ssids */
 		type = SCAN_SSID_FILTER_DISABLED;
 		type = SCAN_SSID_FILTER_DISABLED;
 
 
@@ -514,6 +519,10 @@ wl12xx_scan_sched_scan_ssid_list(struct wl1271 *wl,
 
 
 		/* Add all SSIDs from the filters */
 		/* Add all SSIDs from the filters */
 		for (i = 0; i < req->n_match_sets; i++) {
 		for (i = 0; i < req->n_match_sets; i++) {
+			/* ignore sets without SSIDs */
+			if (!sets[i].ssid.ssid_len)
+				continue;
+
 			cmd->ssids[cmd->n_ssids].type = SCAN_SSID_TYPE_PUBLIC;
 			cmd->ssids[cmd->n_ssids].type = SCAN_SSID_TYPE_PUBLIC;
 			cmd->ssids[cmd->n_ssids].len = sets[i].ssid.ssid_len;
 			cmd->ssids[cmd->n_ssids].len = sets[i].ssid.ssid_len;
 			memcpy(cmd->ssids[cmd->n_ssids].ssid,
 			memcpy(cmd->ssids[cmd->n_ssids].ssid,