[PATCH 3/3] hostap-driver_nl80211: allow setting probe-resp template using SET_BSS

Guy Eilam guy
Sat Oct 22 06:08:47 PDT 2011


Pass the raw probe response template to kernel via netlink using the
SET_BSS command and the new PROBE_RESP attribute

Signed-off-by: Guy Eilam <guy at wizery.com>
---
 src/drivers/driver_nl80211.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index bdc2e97..fd8aff2 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4190,7 +4190,8 @@ static int nl80211_set_ap_isolate(struct i802_bss *bss, int enabled)
 
 
 static int nl80211_set_bss(struct i802_bss *bss, int cts, int preamble,
-			   int slot, int ht_opmode)
+			   int slot, int ht_opmode,
+			   int probe_resp_len, const u8* probe_resp)
 {
 	struct wpa_driver_nl80211_data *drv = bss->drv;
 	struct nl_msg *msg;
@@ -4209,6 +4210,10 @@ static int nl80211_set_bss(struct i802_bss *bss, int cts, int preamble,
 		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);
+	if (probe_resp_len > 0)
+		NLA_PUT(msg, NL80211_ATTR_PROBE_RESP, probe_resp_len,
+			probe_resp);
+
 	NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, if_nametoindex(bss->ifname));
 
 	return send_and_recv_msgs(drv, msg, NULL, NULL);
@@ -4217,6 +4222,13 @@ static int nl80211_set_bss(struct i802_bss *bss, int cts, int preamble,
 }
 
 
+static int i802_set_probe_resp(void *priv, const u8* resp, size_t resp_len)
+{
+	return nl80211_set_bss((struct i802_bss *)priv, -1, -1,
+				-1, -1, resp_len, resp);
+}
+
+
 static int wpa_driver_nl80211_set_ap(void *priv,
 				     struct wpa_driver_ap_params *params)
 {
@@ -4357,7 +4369,8 @@ static int wpa_driver_nl80211_set_ap(void *priv,
 		}
 
 		nl80211_set_bss(bss, params->cts_protect, params->preamble,
-				params->short_slot_time, params->ht_opmode);
+				params->short_slot_time, params->ht_opmode,
+				-1, NULL);
 	}
 	return ret;
  nla_put_failure:
@@ -7413,6 +7426,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
 	.set_rate_sets = i802_set_rate_sets,
 	.sta_deauth = i802_sta_deauth,
 	.sta_disassoc = i802_sta_disassoc,
+	.set_probe_resp = i802_set_probe_resp,
 #endif /* HOSTAPD || CONFIG_AP */
 	.set_freq = i802_set_freq,
 	.send_action = wpa_driver_nl80211_send_action,
-- 
1.7.4.1




More information about the Hostap mailing list