aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorArik Nemtsov <arik@wizery.com>2011-12-10 18:58:59 (GMT)
committerJouni Malinen <j@w1.fi>2011-12-10 19:11:32 (GMT)
commit5b99e21a141931389308979069cd9c5f6bebe8bb (patch)
treeca56df5db802a1cb0230396b7fe1788c87dfe1b0 /src
parenteacc6b24783313e7a1a0936d4d55b5e0ae50a6bf (diff)
downloadhostap-5b99e21a141931389308979069cd9c5f6bebe8bb.zip
hostap-5b99e21a141931389308979069cd9c5f6bebe8bb.tar.gz
hostap-5b99e21a141931389308979069cd9c5f6bebe8bb.tar.bz2
Set driver Probe Response template for AP mode offload
Configure a Probe Response template for drivers that support it. The template is updated when the Beacon template is updated. The Probe Response template is propagated to the driver via the set_ap() callback. Signed-hostap: Arik Nemtsov <arik@wizery.com> Signed-off-by: Arik Nemtsov <arik@wizery.com>
Diffstat (limited to 'src')
-rw-r--r--src/ap/beacon.c42
-rw-r--r--src/drivers/driver.h13
2 files changed, 55 insertions, 0 deletions
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 44f99ff..4d8b277 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -436,6 +436,42 @@ void handle_probe_req(struct hostapd_data *hapd,
elems.ssid_len == 0 ? "broadcast" : "our");
}
+
+static u8 * hostapd_probe_resp_offloads(struct hostapd_data *hapd,
+ size_t *resp_len)
+{
+ /* check probe response offloading caps and print warnings */
+ if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_PROBE_RESP_OFFLOAD))
+ return NULL;
+
+#ifdef CONFIG_WPS
+ if (hapd->conf->wps_state && hapd->wps_probe_resp_ie &&
+ (!(hapd->iface->probe_resp_offloads &
+ (WPA_DRIVER_PROBE_RESP_OFFLOAD_WPS |
+ WPA_DRIVER_PROBE_RESP_OFFLOAD_WPS2))))
+ wpa_printf(MSG_WARNING, "Device is trying to offload WPS "
+ "Probe Response while not supporting this");
+#endif /* CONFIG_WPS */
+
+#ifdef CONFIG_P2P
+ if ((hapd->conf->p2p & P2P_ENABLED) && hapd->p2p_probe_resp_ie &&
+ !(hapd->iface->probe_resp_offloads &
+ WPA_DRIVER_PROBE_RESP_OFFLOAD_P2P))
+ wpa_printf(MSG_WARNING, "Device is trying to offload P2P "
+ "Probe Response while not supporting this");
+#endif /* CONFIG_P2P */
+
+ if (hapd->conf->interworking &&
+ !(hapd->iface->probe_resp_offloads &
+ WPA_DRIVER_PROBE_RESP_OFFLOAD_INTERWORKING))
+ wpa_printf(MSG_WARNING, "Device is trying to offload "
+ "Interworking Probe Response while not supporting "
+ "this");
+
+ /* Generate a Probe Response template for the non-P2P case */
+ return hostapd_gen_probe_resp(hapd, NULL, NULL, 0, resp_len);
+}
+
#endif /* NEED_AP_MLME */
@@ -444,6 +480,8 @@ void ieee802_11_set_beacon(struct hostapd_data *hapd)
struct ieee80211_mgmt *head = NULL;
u8 *tail = NULL;
size_t head_len = 0, tail_len = 0;
+ u8 *resp = NULL;
+ size_t resp_len = 0;
struct wpa_driver_ap_params params;
struct wpabuf *beacon, *proberesp, *assocresp;
#ifdef NEED_AP_MLME
@@ -570,6 +608,7 @@ void ieee802_11_set_beacon(struct hostapd_data *hapd)
tail_len = tailpos > tail ? tailpos - tail : 0;
+ resp = hostapd_probe_resp_offloads(hapd, &resp_len);
#endif /* NEED_AP_MLME */
os_memset(&params, 0, sizeof(params));
@@ -577,6 +616,8 @@ void ieee802_11_set_beacon(struct hostapd_data *hapd)
params.head_len = head_len;
params.tail = tail;
params.tail_len = tail_len;
+ params.proberesp = resp;
+ params.proberesp_len = resp_len;
params.dtim_period = hapd->conf->dtim_period;
params.beacon_int = hapd->iconf->beacon_int;
params.basic_rates = hapd->iconf->basic_rates;
@@ -635,6 +676,7 @@ void ieee802_11_set_beacon(struct hostapd_data *hapd)
os_free(tail);
os_free(head);
+ os_free(resp);
}
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index b07b3a3..76c4e8c 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -564,6 +564,19 @@ struct wpa_driver_ap_params {
int *basic_rates;
/**
+ * proberesp - Probe Response template
+ *
+ * This is used by drivers that reply to Probe Requests internally in
+ * AP mode and require the full Probe Response template.
+ */
+ const u8 *proberesp;
+
+ /**
+ * proberesp_len - Length of the proberesp buffer in octets
+ */
+ size_t proberesp_len;
+
+ /**
* ssid - The SSID to use in Beacon/Probe Response frames
*/
const u8 *ssid;