]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WPS: Add PBC overlap and timeout events from WPS module
authorOleg Kravtsov <Oleg.Kravtsov@oktetlabs.ru>
Sun, 1 Nov 2009 19:26:13 +0000 (21:26 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 1 Nov 2009 19:26:13 +0000 (21:26 +0200)
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.

src/wps/wps.h
src/wps/wps_common.c
src/wps/wps_i.h
src/wps/wps_registrar.c
wpa_supplicant/wps_supplicant.c

index d02256f869d164eb5db681ef2b385a9ad103845e..2661e941c514220dfb60b751a33a0d73be279bcf 100644 (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
 };
 
 /**
index 8340b2771fabbb5eafc4149d648d307ae90973c2..b96af799dac5721679a00506c38bf2c3747cbeca 100644 (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)
index 067758c9a70e6fd23a34ed33287bef0ba7fa326d..66e49dc5b386186895633b828cb4781cb3d6e68b 100644 (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;
index 6f08064506cccc9345761eff7255ae2f81b5c997..760178d73822be81cc2b1ad4910430eded62c8ae 100644 (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,
index b5be98d3b268ff92af91b7dee925bf98a72308dc..95f3b8853efe019fbc29cf830c56e75e23a3e9ce 100644 (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;
        }
 }