diff --git a/src/wps/wps.h b/src/wps/wps.h index d02256f86..2661e941c 100644 --- a/src/wps/wps.h +++ b/src/wps/wps.h @@ -322,7 +322,17 @@ enum wps_event { /** * WPS_EV_PWD_AUTH_FAIL - Password authentication failed */ - WPS_EV_PWD_AUTH_FAIL + WPS_EV_PWD_AUTH_FAIL, + + /** + * WPS_EV_PBC_OVERLAP - PBC session overlap detected + */ + WPS_EV_PBC_OVERLAP, + + /** + * WPS_EV_PBC_TIMEOUT - PBC walktime expired before protocol run start + */ + WPS_EV_PBC_TIMEOUT }; /** diff --git a/src/wps/wps_common.c b/src/wps/wps_common.c index 8340b2771..b96af799d 100644 --- a/src/wps/wps_common.c +++ b/src/wps/wps_common.c @@ -338,6 +338,24 @@ void wps_pwd_auth_fail_event(struct wps_context *wps, int enrollee, int part) } +void wps_pbc_overlap_event(struct wps_context *wps) +{ + if (wps->event_cb == NULL) + return; + + wps->event_cb(wps->cb_ctx, WPS_EV_PBC_OVERLAP, NULL); +} + + +void wps_pbc_timeout_event(struct wps_context *wps) +{ + if (wps->event_cb == NULL) + return; + + wps->event_cb(wps->cb_ctx, WPS_EV_PBC_TIMEOUT, NULL); +} + + #ifdef CONFIG_WPS_OOB static struct wpabuf * wps_get_oob_cred(struct wps_context *wps) diff --git a/src/wps/wps_i.h b/src/wps/wps_i.h index 067758c9a..66e49dc5b 100644 --- a/src/wps/wps_i.h +++ b/src/wps/wps_i.h @@ -197,6 +197,8 @@ struct wpabuf * wps_decrypt_encr_settings(struct wps_data *wps, const u8 *encr, void wps_fail_event(struct wps_context *wps, enum wps_msg_type msg); void wps_success_event(struct wps_context *wps); void wps_pwd_auth_fail_event(struct wps_context *wps, int enrollee, int part); +void wps_pbc_overlap_event(struct wps_context *wps); +void wps_pbc_timeout_event(struct wps_context *wps); extern struct oob_device_data oob_ufd_device_data; extern struct oob_device_data oob_nfc_device_data; diff --git a/src/wps/wps_registrar.c b/src/wps/wps_registrar.c index 6f0806450..760178d73 100644 --- a/src/wps/wps_registrar.c +++ b/src/wps/wps_registrar.c @@ -692,6 +692,7 @@ static void wps_registrar_pbc_timeout(void *eloop_ctx, void *timeout_ctx) struct wps_registrar *reg = eloop_ctx; wpa_printf(MSG_DEBUG, "WPS: PBC timed out - disable PBC mode"); + wps_pbc_timeout_event(reg->wps); wps_registrar_stop_pbc(reg); } @@ -710,6 +711,7 @@ int wps_registrar_button_pushed(struct wps_registrar *reg) if (wps_registrar_pbc_overlap(reg, NULL, NULL)) { wpa_printf(MSG_DEBUG, "WPS: PBC overlap - do not start PBC " "mode"); + wps_pbc_overlap_event(reg->wps); return -1; } wpa_printf(MSG_DEBUG, "WPS: Button pushed - PBC mode started"); @@ -2015,6 +2017,7 @@ static enum wps_process_res wps_process_m1(struct wps_data *wps, "negotiation"); wps->state = SEND_M2D; wps->config_error = WPS_CFG_MULTIPLE_PBC_DETECTED; + wps_pbc_overlap_event(wps->wps); return WPS_CONTINUE; } wps_registrar_add_pbc_session(wps->wps->registrar, diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c index b5be98d3b..95f3b8853 100644 --- a/wpa_supplicant/wps_supplicant.c +++ b/wpa_supplicant/wps_supplicant.c @@ -426,6 +426,10 @@ static void wpa_supplicant_wps_event(void *ctx, enum wps_event event, break; case WPS_EV_PWD_AUTH_FAIL: break; + case WPS_EV_PBC_OVERLAP: + break; + case WPS_EV_PBC_TIMEOUT: + break; } }