Parcourir la source

WPS ER: Refresh ER data on WPS_ER_START when already started

This sends out the AP and Enrollee notifications for all tracked
devices and generates a new SSDP search to find more APs.
Jouni Malinen il y a 15 ans
Parent
commit
b3f371cabf
3 fichiers modifiés avec 17 ajouts et 1 suppressions
  1. 1 0
      src/wps/wps.h
  2. 15 0
      src/wps/wps_er.c
  3. 1 1
      wpa_supplicant/wps_supplicant.c

+ 1 - 0
src/wps/wps.h

@@ -673,6 +673,7 @@ int wps_process_oob(struct wps_context *wps, struct oob_device_data *oob_dev,
 int wps_attr_text(struct wpabuf *data, char *buf, char *end);
 
 struct wps_er * wps_er_init(struct wps_context *wps, const char *ifname);
+void wps_er_refresh(struct wps_er *er);
 void wps_er_deinit(struct wps_er *er);
 void wps_er_set_sel_reg(struct wps_er *er, int sel_reg, u16 dev_passwd_id,
 			u16 sel_reg_config_methods);

+ 15 - 0
src/wps/wps_er.c

@@ -1235,6 +1235,21 @@ wps_er_init(struct wps_context *wps, const char *ifname)
 }
 
 
+void wps_er_refresh(struct wps_er *er)
+{
+	struct wps_er_ap *ap;
+	struct wps_er_sta *sta;
+
+	for (ap = er->ap; ap; ap = ap->next) {
+		wps_er_ap_event(er->wps, ap, WPS_EV_ER_AP_ADD);
+		for (sta = ap->sta; sta; sta = sta->next)
+			wps_er_sta_event(er->wps, sta, WPS_EV_ER_ENROLLEE_ADD);
+	}
+
+	wps_er_send_ssdp_msearch(er);
+}
+
+
 void wps_er_deinit(struct wps_er *er)
 {
 	if (er == NULL)

+ 1 - 1
wpa_supplicant/wps_supplicant.c

@@ -1124,7 +1124,7 @@ int wpas_wps_er_start(struct wpa_supplicant *wpa_s)
 {
 #ifdef CONFIG_WPS_ER
 	if (wpa_s->wps_er) {
-		/* TODO: re-send ctrl_iface events for current data? */
+		wps_er_refresh(wpa_s->wps_er);
 		return 0;
 	}
 	wpa_s->wps_er = wps_er_init(wpa_s->wps, wpa_s->ifname);