WPS: Add PBC overlap and timeout events from WPS module

This provides information about PBC mode result from the WPS Registrar
module. This could be used, e.g., to provide a user notification on the
AP UI on PBC failures.
This commit is contained in:
Oleg Kravtsov 2009-11-01 21:26:13 +02:00 committed by Jouni Malinen
parent 7e3a67514f
commit 63330c6832
5 changed files with 38 additions and 1 deletions

View file

@ -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
};
/**

View file

@ -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)

View file

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

View file

@ -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,

View file

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