[PATCH 3/3] scan: Use specified legacy rateset in probe requests.

greearb at candelatech.com greearb at candelatech.com
Fri Sep 18 17:06:35 EDT 2015


From: Ben Greear <greearb at candelatech.com>

If user has specified a legacy rateset, then use that in
probe requests so that the proper rates are advertised on
the air.

Could do the same with HT/VHT rates someday perhaps.

Signed-off-by: Ben Greear <greearb at candelatech.com>
---
 src/drivers/driver_nl80211_scan.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/drivers/driver_nl80211_scan.c b/src/drivers/driver_nl80211_scan.c
index 4b762ea..b2c27cc 100644
--- a/src/drivers/driver_nl80211_scan.c
+++ b/src/drivers/driver_nl80211_scan.c
@@ -111,6 +111,8 @@ nl80211_scan_common(struct i802_bss *bss, u8 cmd,
 	struct nl_msg *msg;
 	size_t i;
 	u32 scan_flags = 0;
+	struct nlattr *nlrates;
+	unsigned char rates[12];
 
 	msg = nl80211_cmd_msg(bss, 0, cmd);
 	if (!msg)
@@ -133,6 +135,20 @@ nl80211_scan_common(struct i802_bss *bss, u8 cmd,
 		nla_nest_end(msg, ssids);
 	}
 
+	i = nl80211_build_legacy_rateset(bss->legacy_rates, 0, rates);
+	if (bss->legacy_rates & (1<<31)) {
+		/* User has specified a legacy rateset, use it. */
+		nlrates = nla_nest_start(msg, NL80211_ATTR_SCAN_SUPP_RATES);
+		if (!nlrates)
+			goto fail;
+
+		if (nla_put(msg, NL80211_BAND_2GHZ, i, rates))
+			goto fail;
+
+		/* TODO:  Someday pay attention to HT/VHT rates as well? */
+		nla_nest_end(msg, nlrates);
+	}
+
 	if (params->extra_ies) {
 		wpa_hexdump(MSG_MSGDUMP, "nl80211: Scan extra IEs",
 			    params->extra_ies, params->extra_ies_len);
-- 
1.9.3



More information about the HostAP mailing list