aboutsummaryrefslogtreecommitdiffstats
path: root/src/ap/hs20.c
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2014-02-26 10:55:25 -0800
committerDmitry Shmidt <dimitrysh@google.com>2014-02-26 10:55:25 -0800
commitf21452aea786ac056eb01f1cbba4f553bd502747 (patch)
tree52237fc49df86428cba18241051a3bf1936c1c5c /src/ap/hs20.c
parent0970157a386c5a37a66ed762ef127ed329b478f3 (diff)
downloadandroid_external_wpa_supplicant_8-f21452aea786ac056eb01f1cbba4f553bd502747.tar.gz
android_external_wpa_supplicant_8-f21452aea786ac056eb01f1cbba4f553bd502747.tar.bz2
android_external_wpa_supplicant_8-f21452aea786ac056eb01f1cbba4f553bd502747.zip
Cumulative patch from commit 5e32f8256f5fcce8b70a95e070375ac549ac935a
5e32f82 tests: Verify HS 2.0R2 deauthentication request b61e70c HS 2.0R2: Add WFA server-only EAP-TLS server method 8d2a992 HS 2.0R2: RADIUS server support to request Subscr Remediation ae6d15c HS 2.0R2 AP: Add OSU Providers list ANQP element f7bd7a0 HS 2.0R2 AP: Add Icon Request and Icon binary File ANQP elements 97596f8 HS 2.0R2 AP: Add support for Session Info URL RADIUS AVP 8e1146d HS 2.0R2 AP: Add support for deauthentication request a14896e HS 2.0R2 AP: Add OSEN implementation 6ca0853 HS 2.0R2 AP: Use Subscr Remediation request from RADIUS server 7bc9c25 HS 2.0R2 AP: Add STA's Hotspot 2.0 Release Number into Access-Request 76579ec HS 2.0R2 AP: Add AP Hotspot 2.0 Release Number as WFA RADIUS VSA 0dd100f HS 2.0R2 AP: Add definition and helper function for WFA RADIUS VSA 3fb17a9 HS 2.0R2 AP: Add WNM-Notification Request for Subscription Remediation d5d2478 HS 2.0R2 AP: Update HS 2.0 Indication element to Release 2 a6739e1 HS 2.0R2: Try to scan multiple times for OSU providers cf6d08a Interworking: Add OCSP parameter to the cred block 6402f2f Interworking: Add more debug info on roaming partner preferences 7479489 Interworking: Add sp_priority cred parameter 751ac99 Interworking: Use a helper function to compare cred priority aff419f Interworking: Remove separate credential priority tracking 533536d HS 2.0R2: Disable full ESS for as a workaround for per-BSS issues 8a77f1b HS 2.0R2: Slow down connection attempts on EAP failures 76a55a8 HS 2.0R2: Add more debug to network selection 8b4b9fb HS 2.0R2: Fix bandwidth policy BSS selection 28f2a7c HS 2.0R2: Allow excluded network to be selected based on user override 33fb8c5 HS 2.0R2: Add support for Policy/RequiredProtoPortTuple a45b2dc HS 2.0R2: Add support for Policy/MaximumBSSLoadValue 4cad9df HS 2.0R2: Add support for Policy/MinBackhaulThreshold aa26ba6 HS 2.0R2: Add tracking of provisioning SP 8e5fdfa HS 2.0R2: Add WFA server-only EAP-TLS peer method df0f01d HS 2.0R2: Add OSEN client implementation a5d7563 HS 2.0R2: Add common OSEN definitions 230e373 HS 2.0R2: Add GAS operation duration statistics into debug b572df8 HS 2.0R2: Add routine for fetching OSU provider information 1d2215f HS 2.0R2: Add OSU Providers list ANQP element 184e110 HS 2.0R2: Add Icon Request and Icon binary File ANQP elements 7ef6947 HS 2.0R2: Add STA support for Deauthentication Request notification 95a3ea9 HS 2.0R2: Add WNM-Notification Request for Subscription Remediation f9cd147 HS 2.0R2: Update Indication element to Release 2 bc00053 Interworking: Allow roaming partner configuration ae6f927 nl80211: Add driver capability for GTK_NOT_USED 2c49d04 Do not clear global pmf setting on FLUSH eef7235 Only try fast reconnect if network is not disabled 3d910ef Interworking: Prefer last added network during network selection 2a33687 P2P: Remove unnecessary ifdef CONFIG_NO_CONFIG_WRITE 050d8b5 Fix documentation for wpa_supplicant_global_ctrl_iface_process() 8c9cb81 DFS: Fix coding style (missing whitespace) 4f1e01b DFS: Add VHT160 available channels b8058a6 hostapd: DFS allow mixed channels 4db216f wpa_supplicant: Add support for IPv6 with UDP ctrl_iface e2364d1 hostapd: Deauthenticate clients forbidden by maclist changes 1748f1d hostapd: Make it possible to remove addresses from maclists 064eb05 Add os_remove_in_array() c1151e4 Force OFDM/HT/VHT to be disabled on channel 14 bfb79dd nl80211: Show regulatory rule flags in debug output 3d7ad2f hostapd: Configure spectrum management capability e0392f8 hostapd: Add Power Constraint element 891330f Fix spelling s/algorith/algorithm/ f0e30c8 Do not start another connect work while one is pending 3290398 WPS: Fix UNSUBSCRIBE error returns if NT or CALLBACK header is used f34df28 WPS: Fix UNSUBSCRIBE to return 412 if no SID match found 80f256a WPS: Remove unnecessary filename NULL check Change-Id: I7dc25a8bb0074f4970ade8d42dfa60da166baf96 Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Diffstat (limited to 'src/ap/hs20.c')
-rw-r--r--src/ap/hs20.c154
1 files changed, 150 insertions, 4 deletions
diff --git a/src/ap/hs20.c b/src/ap/hs20.c
index 45d518bc..d7909fad 100644
--- a/src/ap/hs20.c
+++ b/src/ap/hs20.c
@@ -1,7 +1,7 @@
/*
* Hotspot 2.0 AP ANQP processing
* Copyright (c) 2009, Atheros Communications, Inc.
- * Copyright (c) 2011-2012, Qualcomm Atheros, Inc.
+ * Copyright (c) 2011-2013, Qualcomm Atheros, Inc.
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
@@ -13,19 +13,165 @@
#include "common/ieee802_11_defs.h"
#include "hostapd.h"
#include "ap_config.h"
+#include "ap_drv_ops.h"
#include "hs20.h"
u8 * hostapd_eid_hs20_indication(struct hostapd_data *hapd, u8 *eid)
{
+ u8 conf;
if (!hapd->conf->hs20)
return eid;
*eid++ = WLAN_EID_VENDOR_SPECIFIC;
- *eid++ = 5;
+ *eid++ = 7;
WPA_PUT_BE24(eid, OUI_WFA);
eid += 3;
*eid++ = HS20_INDICATION_OUI_TYPE;
- /* Hotspot Configuration: DGAF Enabled */
- *eid++ = hapd->conf->disable_dgaf ? 0x01 : 0x00;
+ conf = HS20_VERSION; /* Release Number */
+ conf |= HS20_ANQP_DOMAIN_ID_PRESENT;
+ if (hapd->conf->disable_dgaf)
+ conf |= HS20_DGAF_DISABLED;
+ *eid++ = conf;
+ WPA_PUT_LE16(eid, hapd->conf->anqp_domain_id);
+ eid += 2;
+
return eid;
}
+
+
+u8 * hostapd_eid_osen(struct hostapd_data *hapd, u8 *eid)
+{
+ u8 *len;
+ u16 capab;
+
+ if (!hapd->conf->osen)
+ return eid;
+
+ *eid++ = WLAN_EID_VENDOR_SPECIFIC;
+ len = eid++; /* to be filled */
+ WPA_PUT_BE24(eid, OUI_WFA);
+ eid += 3;
+ *eid++ = HS20_OSEN_OUI_TYPE;
+
+ /* Group Data Cipher Suite */
+ RSN_SELECTOR_PUT(eid, RSN_CIPHER_SUITE_NO_GROUP_ADDRESSED);
+ eid += RSN_SELECTOR_LEN;
+
+ /* Pairwise Cipher Suite Count and List */
+ WPA_PUT_LE16(eid, 1);
+ eid += 2;
+ RSN_SELECTOR_PUT(eid, RSN_CIPHER_SUITE_CCMP);
+ eid += RSN_SELECTOR_LEN;
+
+ /* AKM Suite Count and List */
+ WPA_PUT_LE16(eid, 1);
+ eid += 2;
+ RSN_SELECTOR_PUT(eid, RSN_AUTH_KEY_MGMT_OSEN);
+ eid += RSN_SELECTOR_LEN;
+
+ /* RSN Capabilities */
+ capab = 0;
+ if (hapd->conf->wmm_enabled) {
+ /* 4 PTKSA replay counters when using WMM */
+ capab |= (RSN_NUM_REPLAY_COUNTERS_16 << 2);
+ }
+#ifdef CONFIG_IEEE80211W
+ if (hapd->conf->ieee80211w != NO_MGMT_FRAME_PROTECTION) {
+ capab |= WPA_CAPABILITY_MFPC;
+ if (hapd->conf->ieee80211w == MGMT_FRAME_PROTECTION_REQUIRED)
+ capab |= WPA_CAPABILITY_MFPR;
+ }
+#endif /* CONFIG_IEEE80211W */
+ WPA_PUT_LE16(eid, capab);
+ eid += 2;
+
+ *len = eid - len - 1;
+
+ return eid;
+}
+
+
+int hs20_send_wnm_notification(struct hostapd_data *hapd, const u8 *addr,
+ u8 osu_method, const char *url)
+{
+ struct wpabuf *buf;
+ size_t len = 0;
+ int ret;
+
+ /* TODO: should refuse to send notification if the STA is not associated
+ * or if the STA did not indicate support for WNM-Notification */
+
+ if (url) {
+ len = 1 + os_strlen(url);
+ if (5 + len > 255) {
+ wpa_printf(MSG_INFO, "HS 2.0: Too long URL for "
+ "WNM-Notification: '%s'", url);
+ return -1;
+ }
+ }
+
+ buf = wpabuf_alloc(4 + 7 + len);
+ if (buf == NULL)
+ return -1;
+
+ wpabuf_put_u8(buf, WLAN_ACTION_WNM);
+ wpabuf_put_u8(buf, WNM_NOTIFICATION_REQ);
+ wpabuf_put_u8(buf, 1); /* Dialog token */
+ wpabuf_put_u8(buf, 1); /* Type - 1 reserved for WFA */
+
+ /* Subscription Remediation subelement */
+ wpabuf_put_u8(buf, WLAN_EID_VENDOR_SPECIFIC);
+ wpabuf_put_u8(buf, 5 + len);
+ wpabuf_put_be24(buf, OUI_WFA);
+ wpabuf_put_u8(buf, HS20_WNM_SUB_REM_NEEDED);
+ if (url) {
+ wpabuf_put_u8(buf, len - 1);
+ wpabuf_put_data(buf, url, len - 1);
+ wpabuf_put_u8(buf, osu_method);
+ } else {
+ /* Server URL and Server Method fields not included */
+ wpabuf_put_u8(buf, 0);
+ }
+
+ ret = hostapd_drv_send_action(hapd, hapd->iface->freq, 0, addr,
+ wpabuf_head(buf), wpabuf_len(buf));
+
+ wpabuf_free(buf);
+
+ return ret;
+}
+
+
+int hs20_send_wnm_notification_deauth_req(struct hostapd_data *hapd,
+ const u8 *addr,
+ const struct wpabuf *payload)
+{
+ struct wpabuf *buf;
+ int ret;
+
+ /* TODO: should refuse to send notification if the STA is not associated
+ * or if the STA did not indicate support for WNM-Notification */
+
+ buf = wpabuf_alloc(4 + 6 + wpabuf_len(payload));
+ if (buf == NULL)
+ return -1;
+
+ wpabuf_put_u8(buf, WLAN_ACTION_WNM);
+ wpabuf_put_u8(buf, WNM_NOTIFICATION_REQ);
+ wpabuf_put_u8(buf, 1); /* Dialog token */
+ wpabuf_put_u8(buf, 1); /* Type - 1 reserved for WFA */
+
+ /* Deauthentication Imminent Notice subelement */
+ wpabuf_put_u8(buf, WLAN_EID_VENDOR_SPECIFIC);
+ wpabuf_put_u8(buf, 4 + wpabuf_len(payload));
+ wpabuf_put_be24(buf, OUI_WFA);
+ wpabuf_put_u8(buf, HS20_WNM_DEAUTH_IMMINENT_NOTICE);
+ wpabuf_put_buf(buf, payload);
+
+ ret = hostapd_drv_send_action(hapd, hapd->iface->freq, 0, addr,
+ wpabuf_head(buf), wpabuf_len(buf));
+
+ wpabuf_free(buf);
+
+ return ret;
+}