[PATCH 4/4] interworking: Notify the ANQP parsing status

Ilan Peer ilan.peer
Sun Jan 18 17:45:02 PST 2015


From: ASHUTOSH NARAYAN <ashutoshx.narayan at intel.com>

The ANQP verification/parsing is done only after the GAS_DONE indication is sent
over the control interface. This means that in case the ANQP parsing fails there
is no indication to the upper layers. Fix this by adding an EVENT that reports
the status of the ANQP parsing.

Signed-off-by: ASHUTOSH NARAYAN <ashutoshx.narayan at intel.com>
---
 src/common/wpa_ctrl.h         |  3 +++
 wpa_supplicant/interworking.c | 18 ++++++++++++++----
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/src/common/wpa_ctrl.h b/src/common/wpa_ctrl.h
index bc5dd7c..59a3412 100644
--- a/src/common/wpa_ctrl.h
+++ b/src/common/wpa_ctrl.h
@@ -196,6 +196,9 @@ extern "C" {
 /* parameters: <addr> <dialog_token> <freq> <status_code> <result> */
 #define GAS_QUERY_DONE "GAS-QUERY-DONE "
 
+/* parameters: <addr> <result> */
+#define ANQP_QUERY_DONE "ANQP-QUERY-DONE "
+
 #define HS20_SUBSCRIPTION_REMEDIATION "HS20-SUBSCRIPTION-REMEDIATION "
 #define HS20_DEAUTH_IMMINENT_NOTICE "HS20-DEAUTH-IMMINENT-NOTICE "
 
diff --git a/wpa_supplicant/interworking.c b/wpa_supplicant/interworking.c
index cae1f75..cf1fffa 100644
--- a/wpa_supplicant/interworking.c
+++ b/wpa_supplicant/interworking.c
@@ -2785,6 +2785,7 @@ void anqp_resp_cb(void *ctx, const u8 *dst, u8 dialog_token,
 	u16 info_id;
 	u16 slen;
 	struct wpa_bss *bss = NULL, *tmp;
+	const char *anqp_result = "SUCCESS";
 
 	wpa_printf(MSG_DEBUG, "Interworking: anqp_resp_cb dst=" MACSTR
 		   " dialog_token=%u result=%d status_code=%u",
@@ -2792,7 +2793,8 @@ void anqp_resp_cb(void *ctx, const u8 *dst, u8 dialog_token,
 	if (result != GAS_QUERY_SUCCESS) {
 		if (wpa_s->fetch_osu_icon_in_progress)
 			hs20_icon_fetch_failed(wpa_s);
-		return;
+		anqp_result = "FAILURE";
+		goto out;
 	}
 
 	pos = wpabuf_head(adv_proto);
@@ -2802,7 +2804,8 @@ void anqp_resp_cb(void *ctx, const u8 *dst, u8 dialog_token,
 			   "Protocol in response");
 		if (wpa_s->fetch_osu_icon_in_progress)
 			hs20_icon_fetch_failed(wpa_s);
-		return;
+		anqp_result = "INVALID FRAME";
+		goto out;
 	}
 
 	/*
@@ -2828,7 +2831,9 @@ void anqp_resp_cb(void *ctx, const u8 *dst, u8 dialog_token,
 
 		if (left < 4) {
 			wpa_printf(MSG_DEBUG, "ANQP: Invalid element");
-			break;
+			hs20_notify_parse_done(wpa_s);
+			anqp_result = "INVALID FRAME";
+			goto out;
 		}
 		info_id = WPA_GET_LE16(pos);
 		pos += 2;
@@ -2838,7 +2843,9 @@ void anqp_resp_cb(void *ctx, const u8 *dst, u8 dialog_token,
 		if (left < slen) {
 			wpa_printf(MSG_DEBUG, "ANQP: Invalid element length "
 				   "for Info ID %u", info_id);
-			break;
+			hs20_notify_parse_done(wpa_s);
+			anqp_result = "INVALID FRAME";
+			goto out;
 		}
 		interworking_parse_rx_anqp_resp(wpa_s, bss, dst, info_id, pos,
 						slen);
@@ -2846,6 +2853,9 @@ void anqp_resp_cb(void *ctx, const u8 *dst, u8 dialog_token,
 	}
 
 	hs20_notify_parse_done(wpa_s);
+out:
+	wpa_msg(wpa_s, MSG_INFO, ANQP_QUERY_DONE "addr=" MACSTR
+		" result=%s", MAC2STR(dst), anqp_result);
 }
 
 
-- 
1.8.3.2




More information about the Hostap mailing list