WPS ER: Add more debug info on initialization errors
authorJouni Malinen <jouni.malinen@atheros.com>
Fri, 24 Sep 2010 23:05:58 +0000 (16:05 -0700)
committerJouni Malinen <j@w1.fi>
Fri, 24 Sep 2010 23:05:58 +0000 (16:05 -0700)
src/wps/wps_er.c
src/wps/wps_er_ssdp.c
src/wps/wps_upnp_ssdp.c

index c582f4c..f573d62 100644 (file)
@@ -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;
        }
index 55cd105..abcb91d 100644 (file)
@@ -165,16 +165,25 @@ void wps_er_send_ssdp_msearch(struct wps_er *er)
 
 int wps_er_ssdp_init(struct wps_er *er)
 {
-       if (add_ssdp_network(er->ifname))
+       if (add_ssdp_network(er->ifname)) {
+               wpa_printf(MSG_INFO, "WPS ER: Failed to add routing entry for "
+                          "SSDP");
                return -1;
+       }
 
        er->multicast_sd = ssdp_open_multicast_sock(er->ip_addr);
-       if (er->multicast_sd < 0)
+       if (er->multicast_sd < 0) {
+               wpa_printf(MSG_INFO, "WPS ER: Failed to open multicast socket "
+                          "for SSDP");
                return -1;
+       }
 
        er->ssdp_sd = ssdp_listener_open();
-       if (er->ssdp_sd < 0)
+       if (er->ssdp_sd < 0) {
+               wpa_printf(MSG_INFO, "WPS ER: Failed to open SSDP listener "
+                          "socket");
                return -1;
+       }
 
        if (eloop_register_sock(er->multicast_sd, EVENT_TYPE_READ,
                                wps_er_ssdp_rx, er, NULL) ||
index 8505d05..c1b2193 100644 (file)
@@ -875,11 +875,17 @@ int ssdp_open_multicast_sock(u32 ip_addr)
 #endif
 
        if (setsockopt(sd, IPPROTO_IP, IP_MULTICAST_IF,
-                      &ip_addr, sizeof(ip_addr)))
+                      &ip_addr, sizeof(ip_addr))) {
+               wpa_printf(MSG_DEBUG, "WPS: setsockopt(IP_MULTICAST_IF) %x: "
+                          "%d (%s)", ip_addr, errno, strerror(errno));
                return -1;
+       }
        if (setsockopt(sd, IPPROTO_IP, IP_MULTICAST_TTL,
-                      &ttl, sizeof(ttl)))
+                      &ttl, sizeof(ttl))) {
+               wpa_printf(MSG_DEBUG, "WPS: setsockopt(IP_MULTICAST_TTL): "
+                          "%d (%s)", errno, strerror(errno));
                return -1;
+       }
 
 #if 0   /* not needed, because we don't receive using multicast_sd */
        {