aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Kravtsov <Oleg.Kravtsov@oktetlabs.ru>2009-11-01 19:26:13 (GMT)
committerJouni Malinen <j@w1.fi>2009-11-25 23:01:57 (GMT)
commit0bb7739cc8a7fbb967ca84da1f8ac0e3cf6c255e (patch)
treec43d99436de645305b311e849b18548dbac4a6bd
parent8a61021e319e52e49d835dc1ca17c42561b1d6ce (diff)
downloadhostap-06-0bb7739cc8a7fbb967ca84da1f8ac0e3cf6c255e.zip
hostap-06-0bb7739cc8a7fbb967ca84da1f8ac0e3cf6c255e.tar.gz
hostap-06-0bb7739cc8a7fbb967ca84da1f8ac0e3cf6c255e.tar.bz2
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. (cherry picked from commit 63330c68321cdf275193048236fa5e4051180447)
-rw-r--r--src/wps/wps.h12
-rw-r--r--src/wps/wps_common.c18
-rw-r--r--src/wps/wps_i.h2
-rw-r--r--src/wps/wps_registrar.c3
-rw-r--r--wpa_supplicant/wps_supplicant.c4
5 files changed, 38 insertions, 1 deletions
diff --git a/src/wps/wps.h b/src/wps/wps.h
index d13db60..faf32c4 100644
--- a/src/wps/wps.h
+++ b/src/wps/wps.h
@@ -296,7 +296,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 ca760f0..4b45f00 100644
--- a/src/wps/wps_common.c
+++ b/src/wps/wps_common.c
@@ -285,3 +285,21 @@ void wps_pwd_auth_fail_event(struct wps_context *wps, int enrollee, int part)
data.pwd_auth_fail.part = part;
wps->event_cb(wps->cb_ctx, WPS_EV_PWD_AUTH_FAIL, &data);
}
+
+
+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);
+}
diff --git a/src/wps/wps_i.h b/src/wps/wps_i.h
index 95762ea..3317a2c 100644
--- a/src/wps/wps_i.h
+++ b/src/wps/wps_i.h
@@ -186,6 +186,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);
/* wps_attr_parse.c */
int wps_parse_msg(const struct wpabuf *msg, struct wps_parse_attr *attr);
diff --git a/src/wps/wps_registrar.c b/src/wps/wps_registrar.c
index 5343301..edeb421 100644
--- a/src/wps/wps_registrar.c
+++ b/src/wps/wps_registrar.c
@@ -616,6 +616,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);
}
@@ -634,6 +635,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");
@@ -1932,6 +1934,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 7953b5e..ed5ce9a 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -418,6 +418,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;
}
}