[PATCH 2/2] p2p: Use scan supported rate attr for p2p probing

Rajkumar Manoharan rmanohar at qca.qualcomm.com
Sat Sep 3 12:51:51 EDT 2011


This patch ensures that p2p probing does not use
11b rates by setting supported rates in the scan
attributes.

Signed-off-by: Rajkumar Manoharan <rmanohar at qca.qualcomm.com>
---
 src/drivers/driver.h            |    4 ++++
 src/drivers/driver_nl80211.c    |   17 +++++++++++++++--
 wpa_supplicant/mlme.c           |    4 ++--
 wpa_supplicant/p2p_supplicant.c |    2 ++
 4 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 822dc21..1c16228 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -242,6 +242,10 @@ struct wpa_driver_scan_params {
 	int *freqs;
 
 	/**
+	 * p2p_probe - Used to disables 11b rates for P2P probes
+	 */
+	u8 p2p_probe;
+	/**
 	 * filter_ssids - Filter for reporting SSIDs
 	 *
 	 * This optional parameter can be used to request the driver wrapper to
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 19dcc85..06f7709 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -2361,16 +2361,18 @@ static int wpa_driver_nl80211_scan(void *priv,
 	struct i802_bss *bss = priv;
 	struct wpa_driver_nl80211_data *drv = bss->drv;
 	int ret = 0, timeout;
-	struct nl_msg *msg, *ssids, *freqs;
+	struct nl_msg *msg, *ssids, *freqs, *rates;
 	size_t i;
 
 	msg = nlmsg_alloc();
 	ssids = nlmsg_alloc();
 	freqs = nlmsg_alloc();
-	if (!msg || !ssids || !freqs) {
+	rates = nlmsg_alloc();
+	if (!msg || !ssids || !freqs || !rates) {
 		nlmsg_free(msg);
 		nlmsg_free(ssids);
 		nlmsg_free(freqs);
+		nlmsg_free(rates);
 		return -1;
 	}
 
@@ -2410,6 +2412,16 @@ static int wpa_driver_nl80211_scan(void *priv,
 		nla_put_nested(msg, NL80211_ATTR_SCAN_FREQUENCIES, freqs);
 	}
 
+	if (params->p2p_probe) {
+		/*
+		 * Disable 2 GHz rates 1, 2, 5.5, 11 Mbps by masking out
+		 * everything else apart from 6, 9, 12, 18, 24, 36, 48, 54 Mbps
+		 * from non-MCS rates. All 5 GHz rates are left enabled.
+		 */
+		NLA_PUT(rates, NL80211_BAND_2GHZ, 8,
+				"\x0c\x12\x18\x24\x30\x48\x60\x6c");
+		nla_put_nested(msg, NL80211_ATTR_SCAN_SUPP_RATES, rates);
+	}
 	ret = send_and_recv_msgs(drv, msg, NULL, NULL);
 	msg = NULL;
 	if (ret) {
@@ -2461,6 +2473,7 @@ nla_put_failure:
 	nlmsg_free(ssids);
 	nlmsg_free(msg);
 	nlmsg_free(freqs);
+	nlmsg_free(rates);
 	return ret;
 }
 
diff --git a/wpa_supplicant/mlme.c b/wpa_supplicant/mlme.c
index 49713f5..9a221a8 100644
--- a/wpa_supplicant/mlme.c
+++ b/wpa_supplicant/mlme.c
@@ -2864,8 +2864,8 @@ int ieee80211_sta_req_scan(struct wpa_supplicant *wpa_s,
 		os_memcpy(wpa_s->mlme.scan_ssid, ssid, ssid_len);
 	} else
 		wpa_s->mlme.scan_ssid_len = 0;
-	wpa_s->mlme.scan_skip_11b = 1; /* FIX: clear this is 11g is not
-					* supported */
+	if (params->p2p_probe)
+		wpa_s->mlme.scan_skip_11b = 1;
 	wpa_s->mlme.scan_state = SCAN_SET_CHANNEL;
 	wpa_s->mlme.scan_hw_mode_idx = 0;
 	wpa_s->mlme.scan_channel_idx = 0;
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index cf4900c..c1a31fd 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -120,6 +120,7 @@ static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq,
 
 	p2p_scan_ie(wpa_s->global->p2p, ies);
 
+	params.p2p_probe = 1;
 	params.extra_ies = wpabuf_head(ies);
 	params.extra_ies_len = wpabuf_len(ies);
 
@@ -2785,6 +2786,7 @@ static void wpas_p2p_join_scan(void *eloop_ctx, void *timeout_ctx)
 
 	p2p_scan_ie(wpa_s->global->p2p, ies);
 
+	params.p2p_probe = 1;
 	params.extra_ies = wpabuf_head(ies);
 	params.extra_ies_len = wpabuf_len(ies);
 
-- 
1.7.6.1



More information about the HostAP mailing list