[PATCH] nl80211: Make use of the ht opmode bss attribute

Helmut Schaa helmut.schaa
Fri Jan 7 03:13:52 PST 2011


In order to enable protection mechanisms for different HT opmodes the
driver needs to be aware of the current HT opmode that is calculated by
hostapd. Hence, pass the current opmode to the nl80211 driver via
the bss attribute NL80211_ATTR_BSS_HT_OPMODE.

Signed-off-by: Helmut Schaa <helmut.schaa at googlemail.com>
---
 src/drivers/driver_nl80211.c |   27 ++++++++++++++++++++++-----
 1 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 328e063..d6e3943 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -5260,7 +5260,8 @@ static int i802_set_tx_queue_params(void *priv, int queue, int aifs,
 }
 
 
-static int i802_set_bss(void *priv, int cts, int preamble, int slot)
+static int i802_set_bss(void *priv, int cts, int preamble, int slot,
+			int ht_opmode)
 {
 	struct i802_bss *bss = priv;
 	struct wpa_driver_nl80211_data *drv = bss->drv;
@@ -5279,7 +5280,8 @@ static int i802_set_bss(void *priv, int cts, int preamble, int slot)
 		NLA_PUT_U8(msg, NL80211_ATTR_BSS_SHORT_PREAMBLE, preamble);
 	if (slot >= 0)
 		NLA_PUT_U8(msg, NL80211_ATTR_BSS_SHORT_SLOT_TIME, slot);
-
+	if (ht_opmode >= 0)
+		NLA_PUT_U16(msg, NL80211_ATTR_BSS_HT_OPMODE, ht_opmode);
 	NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, if_nametoindex(bss->ifname));
 
 	return send_and_recv_msgs(drv, msg, NULL, NULL);
@@ -5290,19 +5292,19 @@ static int i802_set_bss(void *priv, int cts, int preamble, int slot)
 
 static int i802_set_cts_protect(void *priv, int value)
 {
-	return i802_set_bss(priv, value, -1, -1);
+	return i802_set_bss(priv, value, -1, -1, -1);
 }
 
 
 static int i802_set_preamble(void *priv, int value)
 {
-	return i802_set_bss(priv, -1, value, -1);
+	return i802_set_bss(priv, -1, value, -1, -1);
 }
 
 
 static int i802_set_short_slot_time(void *priv, int value)
 {
-	return i802_set_bss(priv, -1, -1, value);
+	return i802_set_bss(priv, -1, -1, value, -1);
 }
 
 
@@ -5370,6 +5372,20 @@ static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val,
 }
 
 
+static int i802_set_ht_params(void *priv, const u8 *ht_capab,
+			      size_t ht_capab_len, const u8 *ht_oper,
+			      size_t ht_oper_len)
+{
+	if (ht_oper_len >= 6) {
+		/* ht opmode uses 16bit in octet 5 & 6 */
+		u16 ht_opmode = le_to_host16(((u16 *)ht_oper)[2]);
+		return i802_set_bss(priv, -1, -1, -1, ht_opmode);
+	}
+	else
+		return -1;
+}
+
+
 static void handle_eapol(int sock, void *eloop_ctx, void *sock_ctx)
 {
 	struct wpa_driver_nl80211_data *drv = eloop_ctx;
@@ -6370,6 +6386,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
 	.set_tx_queue_params = i802_set_tx_queue_params,
 	.set_sta_vlan = i802_set_sta_vlan,
 	.set_wds_sta = i802_set_wds_sta,
+	.set_ht_params = i802_set_ht_params,
 #endif /* HOSTAPD */
 	.set_freq = i802_set_freq,
 	.send_action = wpa_driver_nl80211_send_action,
-- 
1.7.1




More information about the Hostap mailing list