Interworking: Notify the ANQP parsing status
authorASHUTOSH NARAYAN <ashutoshx.narayan@intel.com>
Mon, 19 Jan 2015 01:45:02 +0000 (20:45 -0500)
committerJouni Malinen <j@w1.fi>
Tue, 20 Jan 2015 00:26:21 +0000 (02:26 +0200)
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 <ashutoshx.narayan@intel.com>
src/common/wpa_ctrl.h
wpa_supplicant/interworking.c

index bc5dd7c..59a3412 100644 (file)
@@ -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 "
 
index cae1f75..3e919bd 100644 (file)
@@ -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);
 }