WPS: Track result of the latest WPS operation
authorJeffin Mammen <jmammen@qti.qualcomm.com>
Fri, 23 Aug 2013 13:38:16 +0000 (16:38 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 23 Aug 2013 14:48:20 +0000 (17:48 +0300)
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

src/ap/hostapd.h
src/ap/wps_hostapd.c
src/wps/wps.c
src/wps/wps_defs.h

index 75d9c66..693dad8 100644 (file)
@@ -67,6 +67,16 @@ struct hostapd_frame_info {
        int ssi_signal; /* dBm */
 };
 
+enum wps_status {
+       WPS_STATUS_SUCCESS = 1,
+       WPS_STATUS_FAILURE
+};
+
+struct wps_stat {
+       enum wps_status status;
+       enum wps_error_indication failure_reason;
+};
+
 
 /**
  * struct hostapd_data - hostapd per-BSS data structure
@@ -147,6 +157,8 @@ struct hostapd_data {
        unsigned int ap_pin_failures_consecutive;
        struct upnp_wps_device_sm *wps_upnp;
        unsigned int ap_pin_lockout_time;
+
+       struct wps_stat wps_stats;
 #endif /* CONFIG_WPS */
 
        struct hostapd_probereq_cb *probereq_cb;
index b5ecb6b..6abd437 100644 (file)
@@ -707,6 +707,11 @@ static int wps_pwd_auth_fail(struct hostapd_data *hapd, void *ctx)
 static void hostapd_pwd_auth_fail(struct hostapd_data *hapd,
                                  struct wps_event_pwd_auth_fail *data)
 {
+       /* Update WPS Status - Authentication Failure */
+       wpa_printf(MSG_DEBUG, "WPS: Authentication failure update");
+       hapd->wps_stats.status = WPS_STATUS_FAILURE;
+       hapd->wps_stats.failure_reason = WPS_EI_AUTH_FAILURE;
+
        hostapd_wps_for_each(hapd, wps_pwd_auth_fail, data);
 }
 
@@ -734,9 +739,20 @@ static void hostapd_wps_ap_pin_success(struct hostapd_data *hapd)
 }
 
 
+static void hostapd_wps_event_success(struct hostapd_data *hapd)
+{
+       /* Update WPS status - Success */
+       hapd->wps_stats.status = WPS_STATUS_SUCCESS;
+}
+
+
 static void hostapd_wps_event_fail(struct hostapd_data *hapd,
                                   struct wps_event_fail *fail)
 {
+       /* Update WPS status - Failure */
+       hapd->wps_stats.status = WPS_STATUS_FAILURE;
+       hapd->wps_stats.failure_reason = fail->error_indication;
+
        if (fail->error_indication > 0 &&
            fail->error_indication < NUM_WPS_EI_VALUES) {
                wpa_msg(hapd->msg_ctx, MSG_INFO,
@@ -764,6 +780,7 @@ static void hostapd_wps_event_cb(void *ctx, enum wps_event event,
                hostapd_wps_event_fail(hapd, &data->fail);
                break;
        case WPS_EV_SUCCESS:
+               hostapd_wps_event_success(hapd);
                wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_SUCCESS);
                break;
        case WPS_EV_PWD_AUTH_FAIL:
index 96aba4d..dd55566 100644 (file)
@@ -651,6 +651,8 @@ const char * wps_ei_str(enum wps_error_indication ei)
                return "TKIP Only Prohibited";
        case WPS_EI_SECURITY_WEP_PROHIBITED:
                return "WEP Prohibited";
+       case WPS_EI_AUTH_FAILURE:
+               return "Authentication Failure";
        default:
                return "Unknown";
        }
index 2f42603..3421ac5 100644 (file)
@@ -223,6 +223,7 @@ enum wps_error_indication {
        WPS_EI_NO_ERROR,
        WPS_EI_SECURITY_TKIP_ONLY_PROHIBITED,
        WPS_EI_SECURITY_WEP_PROHIBITED,
+       WPS_EI_AUTH_FAILURE,
        NUM_WPS_EI_VALUES
 };