WPS ER: Make sure PIN timeout does not interrupt PBC operation
authorJouni Malinen <jouni.malinen@atheros.com>
Thu, 23 Sep 2010 21:45:55 +0000 (14:45 -0700)
committerJouni Malinen <j@w1.fi>
Thu, 23 Sep 2010 21:45:55 +0000 (14:45 -0700)
We need to clear the selected registrar timeout from wps_er_learn
when stopping the protocol run at M7 (previously, this was done only
when WSC_Done was being processed). In addition, we need to cancel
the timeout when a new PBC operation is started.

src/wps/wps_er.c
src/wps/wps_registrar.c

index 4726e52..c582f4c 100644 (file)
@@ -1301,6 +1301,12 @@ static void wps_er_send_set_sel_reg(struct wps_er_ap *ap, struct wpabuf *msg)
                return;
        }
 
+       if (ap->wps) {
+               wpa_printf(MSG_DEBUG, "WPS ER: Pending WPS operation for AP - "
+                          "skip SetSelectedRegistrar");
+               return;
+       }
+
        url = http_client_url_parse(ap->control_url, &dst, &path);
        if (url == NULL) {
                wpa_printf(MSG_DEBUG, "WPS ER: Failed to parse controlURL");
index 67fe9d0..1beea75 100644 (file)
@@ -878,6 +878,7 @@ int wps_registrar_button_pushed(struct wps_registrar *reg)
        reg->pbc = 1;
        wps_registrar_selected_registrar_changed(reg);
 
+       eloop_cancel_timeout(wps_registrar_set_selected_timeout, reg, NULL);
        eloop_cancel_timeout(wps_registrar_pbc_timeout, reg, NULL);
        eloop_register_timeout(WPS_PBC_WALK_TIME, 0, wps_registrar_pbc_timeout,
                               reg, NULL);
@@ -2509,6 +2510,13 @@ static int wps_process_ap_settings_r(struct wps_data *wps,
                 * Use the AP PIN only to receive the current AP settings, not
                 * to reconfigure the AP.
                 */
+
+               /*
+                * Clear selected registrar here since we do not get to
+                * WSC_Done in this protocol run.
+                */
+               wps_registrar_pin_completed(wps->wps->registrar);
+
                if (wps->ap_settings_cb) {
                        wps->ap_settings_cb(wps->ap_settings_cb_ctx,
                                            &wps->cred);