From fb09ed338919db09f3990196171fa73b37e7a17f Mon Sep 17 00:00:00 2001 From: ASHUTOSH NARAYAN Date: Sun, 18 Jan 2015 20:45:02 -0500 Subject: [PATCH] Interworking: Notify the ANQP parsing status 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. Add an ANQP-QUERY-DONE event that reports the status of the ANQP parsing. Signed-off-by: ASHUTOSH NARAYAN --- src/common/wpa_ctrl.h | 3 +++ wpa_supplicant/interworking.c | 17 +++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/common/wpa_ctrl.h b/src/common/wpa_ctrl.h index bc5dd7c35..59a34126e 100644 --- a/src/common/wpa_ctrl.h +++ b/src/common/wpa_ctrl.h @@ -196,6 +196,9 @@ extern "C" { /* parameters: */ #define GAS_QUERY_DONE "GAS-QUERY-DONE " +/* parameters: */ +#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 cae1f7566..3e919bd24 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,8 @@ void anqp_resp_cb(void *ctx, const u8 *dst, u8 dialog_token, if (left < 4) { wpa_printf(MSG_DEBUG, "ANQP: Invalid element"); - break; + anqp_result = "INVALID_FRAME"; + goto out_parse_done; } info_id = WPA_GET_LE16(pos); pos += 2; @@ -2838,14 +2842,19 @@ 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; + anqp_result = "INVALID_FRAME"; + goto out_parse_done; } interworking_parse_rx_anqp_resp(wpa_s, bss, dst, info_id, pos, slen); pos += slen; } +out_parse_done: hs20_notify_parse_done(wpa_s); +out: + wpa_msg(wpa_s, MSG_INFO, ANQP_QUERY_DONE "addr=" MACSTR " result=%s", + MAC2STR(dst), anqp_result); }