WPS: Track result of the latest WPS operation

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jeffin Mammen 2013-08-23 16:38:16 +03:00 committed by Jouni Malinen
parent 50396e29da
commit 61b6520e16
4 changed files with 32 additions and 0 deletions

View 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;

View 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:

View 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";
}

View 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
};