Browse Source

WPS ER: Make sure PIN timeout does not interrupt PBC operation

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.
Jouni Malinen 14 years ago
parent
commit
a9d69254e3
2 changed files with 14 additions and 0 deletions
  1. 6 0
      src/wps/wps_er.c
  2. 8 0
      src/wps/wps_registrar.c

+ 6 - 0
src/wps/wps_er.c

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

+ 8 - 0
src/wps/wps_registrar.c

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