WPS ER: Refresh ER data on WPS_ER_START when already started
authorJouni Malinen <j@w1.fi>
Fri, 20 Nov 2009 19:57:30 +0000 (21:57 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 20 Nov 2009 19:57:30 +0000 (21:57 +0200)
This sends out the AP and Enrollee notifications for all tracked
devices and generates a new SSDP search to find more APs.

src/wps/wps.h
src/wps/wps_er.c
wpa_supplicant/wps_supplicant.c

index a85d600..5f1b729 100644 (file)
@@ -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);
index 4a6e6f7..f2fa9c5 100644 (file)
@@ -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)
index 5f1a3c6..28b961c 100644 (file)
@@ -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);