From: Jeffin Mammen Date: Fri, 23 Aug 2013 13:51:27 +0000 (+0300) Subject: WPS: Track PBC status X-Git-Tag: aosp-kk-from-upstream~86 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae23935e7d68561524a2a387bedc3e700f73d67b;p=thirdparty%2Fhostap.git WPS: Track PBC status Signed-hostap: Jouni Malinen --- diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h index 693dad879..250231714 100644 --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h @@ -72,9 +72,17 @@ enum wps_status { WPS_STATUS_FAILURE }; +enum pbc_status { + WPS_PBC_STATUS_DISABLE, + WPS_PBC_STATUS_ACTIVE, + WPS_PBC_STATUS_TIMEOUT, + WPS_PBC_STATUS_OVERLAP +}; + struct wps_stat { enum wps_status status; enum wps_error_indication failure_reason; + enum pbc_status pbc_status; }; diff --git a/src/ap/wps_hostapd.c b/src/ap/wps_hostapd.c index 6abd437f4..2930b7d86 100644 --- a/src/ap/wps_hostapd.c +++ b/src/ap/wps_hostapd.c @@ -739,9 +739,38 @@ static void hostapd_wps_ap_pin_success(struct hostapd_data *hapd) } +static void hostapd_wps_event_pbc_overlap(struct hostapd_data *hapd) +{ + /* Update WPS Status - PBC Overlap */ + hapd->wps_stats.pbc_status = WPS_PBC_STATUS_OVERLAP; +} + + +static void hostapd_wps_event_pbc_timeout(struct hostapd_data *hapd) +{ + /* Update WPS PBC Status:PBC Timeout */ + hapd->wps_stats.pbc_status = WPS_PBC_STATUS_TIMEOUT; +} + + +static void hostapd_wps_event_pbc_active(struct hostapd_data *hapd) +{ + /* Update WPS PBC status - Active */ + hapd->wps_stats.pbc_status = WPS_PBC_STATUS_ACTIVE; +} + + +static void hostapd_wps_event_pbc_disable(struct hostapd_data *hapd) +{ + /* Update WPS PBC status - Active */ + hapd->wps_stats.pbc_status = WPS_PBC_STATUS_DISABLE; +} + + static void hostapd_wps_event_success(struct hostapd_data *hapd) { /* Update WPS status - Success */ + hapd->wps_stats.pbc_status = WPS_PBC_STATUS_DISABLE; hapd->wps_stats.status = WPS_STATUS_SUCCESS; } @@ -787,15 +816,19 @@ static void hostapd_wps_event_cb(void *ctx, enum wps_event event, hostapd_pwd_auth_fail(hapd, &data->pwd_auth_fail); break; case WPS_EV_PBC_OVERLAP: + hostapd_wps_event_pbc_overlap(hapd); wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_OVERLAP); break; case WPS_EV_PBC_TIMEOUT: + hostapd_wps_event_pbc_timeout(hapd); wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_TIMEOUT); break; case WPS_EV_PBC_ACTIVE: + hostapd_wps_event_pbc_active(hapd); wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_ACTIVE); break; case WPS_EV_PBC_DISABLE: + hostapd_wps_event_pbc_disable(hapd); wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_DISABLE); break; case WPS_EV_ER_AP_ADD: