WPS ER: Add more debug info on initialization errors
[libeap.git] / src / wps / wps_er.c
index da19600..f573d62 100644 (file)
@@ -763,7 +763,7 @@ static void wps_er_process_wlanevent_probe_req(struct wps_er_ap *ap,
        }
 
        wps_er_add_sta_data(ap, addr, &attr, 1);
-       wps_registrar_probe_req_rx(ap->er->wps->registrar, addr, msg);
+       wps_registrar_probe_req_rx(ap->er->wps->registrar, addr, msg, 0);
 }
 
 
@@ -1195,6 +1195,7 @@ wps_er_init(struct wps_context *wps, const char *ifname, const char *filter)
        }
 
        if (wps_er_ssdp_init(er) < 0) {
+               wpa_printf(MSG_INFO, "WPS UPnP: SSDP initialization failed");
                wps_er_deinit(er, NULL, NULL);
                return NULL;
        }
@@ -1202,6 +1203,7 @@ wps_er_init(struct wps_context *wps, const char *ifname, const char *filter)
        addr.s_addr = er->ip_addr;
        er->http_srv = http_server_init(&addr, -1, wps_er_http_req, er);
        if (er->http_srv == NULL) {
+               wpa_printf(MSG_INFO, "WPS UPnP: HTTP initialization failed");
                wps_er_deinit(er, NULL, NULL);
                return NULL;
        }
@@ -1301,6 +1303,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");
@@ -1563,6 +1571,10 @@ static void wps_er_ap_process(struct wps_er_ap *ap, struct wpabuf *msg)
                        wps_deinit(ap->wps);
                        ap->wps = NULL;
                }
+       } else if (res == WPS_DONE) {
+               wpa_printf(MSG_DEBUG, "WPS ER: Protocol run done");
+               wps_deinit(ap->wps);
+               ap->wps = NULL;
        } else {
                wpa_printf(MSG_DEBUG, "WPS ER: Failed to process message from "
                           "AP (res=%d)", res);