HS 2.0: Add Hotspot 2.0 Indication for AP
authorJay Katabathuni <jkatabat@qca.qualcomm.com>
Thu, 8 Sep 2011 17:52:23 +0000 (20:52 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 30 Jul 2012 15:23:38 +0000 (18:23 +0300)
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

hostapd/Makefile
src/ap/ap_drv_ops.c
src/ap/beacon.c
src/ap/hs20.c [new file with mode: 0644]
src/ap/hs20.h [new file with mode: 0644]
wpa_supplicant/Makefile

index aed4b89..d33a9a7 100644 (file)
@@ -772,6 +772,7 @@ endif
 
 ifdef CONFIG_HS20
 CFLAGS += -DCONFIG_HS20
+OBJS += ../src/ap/hs20.o
 CONFIG_INTERWORKING=y
 endif
 
index 859b529..36c000b 100644 (file)
@@ -17,6 +17,7 @@
 #include "sta_info.h"
 #include "ap_config.h"
 #include "p2p_hostapd.h"
+#include "hs20.h"
 #include "ap_drv_ops.h"
 
 
@@ -147,6 +148,20 @@ int hostapd_build_ap_extra_ies(struct hostapd_data *hapd,
        }
 #endif /* CONFIG_P2P_MANAGER */
 
+#ifdef CONFIG_HS20
+       pos = buf;
+       pos = hostapd_eid_hs20_indication(hapd, pos);
+       if (pos != buf) {
+               if (wpabuf_resize(&beacon, pos - buf) != 0)
+                       goto fail;
+               wpabuf_put_data(beacon, buf, pos - buf);
+
+               if (wpabuf_resize(&proberesp, pos - buf) != 0)
+                       goto fail;
+               wpabuf_put_data(proberesp, buf, pos - buf);
+       }
+#endif /* CONFIG_HS20 */
+
        *beacon_ret = beacon;
        *proberesp_ret = proberesp;
        *assocresp_ret = assocresp;
index 0f29ccd..31dbcff 100644 (file)
@@ -33,6 +33,7 @@
 #include "p2p_hostapd.h"
 #include "ap_drv_ops.h"
 #include "beacon.h"
+#include "hs20.h"
 
 
 #ifdef NEED_AP_MLME
@@ -292,6 +293,10 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
                pos = hostapd_eid_p2p_manage(hapd, pos);
 #endif /* CONFIG_P2P_MANAGER */
 
+#ifdef CONFIG_HS20
+       pos = hostapd_eid_hs20_indication(hapd, pos);
+#endif /* CONFIG_HS20 */
+
        *resp_len = pos - (u8 *) resp;
        return (u8 *) resp;
 }
@@ -629,6 +634,10 @@ void ieee802_11_set_beacon(struct hostapd_data *hapd)
                tailpos = hostapd_eid_p2p_manage(hapd, tailpos);
 #endif /* CONFIG_P2P_MANAGER */
 
+#ifdef CONFIG_HS20
+       tailpos = hostapd_eid_hs20_indication(hapd, tailpos);
+#endif /* CONFIG_HS20 */
+
        tail_len = tailpos > tail ? tailpos - tail : 0;
 
        resp = hostapd_probe_resp_offloads(hapd, &resp_len);
diff --git a/src/ap/hs20.c b/src/ap/hs20.c
new file mode 100644 (file)
index 0000000..c99db58
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Hotspot 2.0 AP ANQP processing
+ * Copyright (c) 2009, Atheros Communications, Inc.
+ * Copyright (c) 2011-2012, Qualcomm Atheros, Inc.
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+#include "includes.h"
+
+#include "common.h"
+#include "common/ieee802_11_defs.h"
+#include "hostapd.h"
+#include "ap_config.h"
+#include "hs20.h"
+
+
+u8 * hostapd_eid_hs20_indication(struct hostapd_data *hapd, u8 *eid)
+{
+       if (!hapd->conf->hs20)
+               return eid;
+       *eid++ = WLAN_EID_VENDOR_SPECIFIC;
+       *eid++ = 5;
+       WPA_PUT_BE24(eid, OUI_WFA);
+       eid += 3;
+       *eid++ = HS20_INDICATION_OUI_TYPE;
+       *eid++ = 0x00; /* Hotspot Configuration: DGAF Enabled */
+       return eid;
+}
diff --git a/src/ap/hs20.h b/src/ap/hs20.h
new file mode 100644 (file)
index 0000000..98698ce
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * Hotspot 2.0 AP ANQP processing
+ * Copyright (c) 2011-2012, Qualcomm Atheros, Inc.
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+#ifndef HS20_H
+#define HS20_H
+
+struct hostapd_data;
+
+u8 * hostapd_eid_hs20_indication(struct hostapd_data *hapd, u8 *eid);
+
+#endif /* HS20_H */
index 6756e54..73a339d 100644 (file)
@@ -741,6 +741,9 @@ endif
 ifdef CONFIG_INTERWORKING
 OBJS += ../src/ap/gas_serv.o
 endif
+ifdef CONFIG_HS20
+OBJS += ../src/ap/hs20.o
+endif
 endif
 
 ifdef NEED_RSN_AUTHENTICATOR