if (do_next_address)
e->retry++;
if (e->retry >= s->n_addr) {
- wpa_printf(MSG_DEBUG, "WPS UPnP: Giving up on sending event");
+ wpa_printf(MSG_DEBUG, "WPS UPnP: Giving up on sending event "
+ "for %s", e->addr->domain_and_port);
return;
}
event_enqueue_at_begin(s, e);
reply_code = httpread_reply_code_get(hread);
if (reply_code == HTTP_OK) {
wpa_printf(MSG_DEBUG,
- "WPS UPnP: Got event reply OK");
+ "WPS UPnP: Got event reply OK from "
+ "%s", e->addr->domain_and_port);
event_delete(e);
goto send_more;
} else {
wpa_printf(MSG_DEBUG, "WPS UPnP: Got event "
- "error reply code %d", reply_code);
+ "error reply code %d from %s",
+ reply_code,
+ e->addr->domain_and_port);
goto bad;
}
} else {
wpa_printf(MSG_DEBUG, "WPS UPnP: Got bogus event "
- "response %d", en);
+ "response %d from %s", en,
+ e->addr->domain_and_port);
}
} else {
- wpa_printf(MSG_DEBUG, "WPS UPnP: Event response timeout/fail");
+ wpa_printf(MSG_DEBUG, "WPS UPnP: Event response timeout/fail "
+ "for %s", e->addr->domain_and_port);
goto bad;
}
event_retry(e, 1);
/* we could: Turn blocking back on? */
fcntl(e->sd, F_SETFL, 0);
#endif
+ wpa_printf(MSG_DEBUG, "WPS UPnP: Sending event to %s",
+ e->addr->domain_and_port);
if (send_wpabuf(e->sd, buf) < 0) {
event_retry(e, 1);
goto bad;
struct web_connection *prev;
struct upnp_wps_device_sm *sm; /* parent */
int sd; /* socket to read from */
+ struct sockaddr_in cli_addr;
int sd_registered; /* nonzero if we must cancel registration */
struct httpread *hread; /* state machine for reading socket */
int n_rcvd_data; /* how much data read so far */
if (filename == NULL)
filename = "(null)"; /* just in case */
if (os_strcasecmp(filename, UPNP_WPS_DEVICE_XML_FILE) == 0) {
+ wpa_printf(MSG_DEBUG, "WPS UPnP: HTTP GET for device XML");
req = GET_DEVICE_XML_FILE;
extra_len = 3000;
if (sm->wps->friendly_name)
if (sm->wps->upc)
extra_len += os_strlen(sm->wps->upc);
} else if (!os_strcasecmp(filename, UPNP_WPS_SCPD_XML_FILE)) {
+ wpa_printf(MSG_DEBUG, "WPS UPnP: HTTP GET for SCPD XML");
req = GET_SCPD_XML_FILE;
extra_len = os_strlen(wps_scpd_xml);
} else {
/* File not found */
- wpa_printf(MSG_DEBUG, "WPS UPnP: File not found: %s",
+ wpa_printf(MSG_DEBUG, "WPS UPnP: HTTP GET file not found: %s",
filename);
buf = wpabuf_alloc(200);
if (buf == NULL)
ret = HTTP_PRECONDITION_FAILED;
goto error;
}
+ wpa_printf(MSG_DEBUG, "WPS UPnP: HTTP SUBSCRIBE for event");
end = os_strchr(h, '\n');
for (; end != NULL; h = end + 1) {
/* And empty line to terminate header: */
wpabuf_put_str(buf, "\r\n");
- wpa_hexdump_ascii(MSG_MSGDUMP, "WPS UPnP SUBSCRIBE response",
- wpabuf_head(buf), wpabuf_len(buf));
send_wpabuf(c->sd, buf);
wpabuf_free(buf);
os_free(callback_urls);
ret = HTTP_PRECONDITION_FAILED;
goto send_msg;
}
+ wpa_printf(MSG_DEBUG, "WPS UPnP: HTTP UNSUBSCRIBE for event");
end = os_strchr(h, '\n');
for (; end != NULL; h = end + 1) {
while (*filename == '/')
filename++;
- wpa_printf(MSG_DEBUG, "WPS UPnP: Got HTTP request type %d", htype);
+ wpa_printf(MSG_DEBUG, "WPS UPnP: Got HTTP request type %d from %s:%d",
+ htype, inet_ntoa(c->cli_addr.sin_addr),
+ htons(c->cli_addr.sin_port));
switch (htype) {
case HTTPREAD_HDR_TYPE_GET:
/* web_connection_start - Start web connection
* @sm: WPS UPnP state machine from upnp_wps_device_init()
* @sd: Socket descriptor
- * @ip_addr: of client, in host byte order
- * @ip_port: of client, in native byte order
+ * @addr: Client address
*
- * The socket descriptor sd is handed over for ownership by the WPs UPnP
+ * The socket descriptor sd is handed over for ownership by the WPS UPnP
* state machine.
*/
static void web_connection_start(struct upnp_wps_device_sm *sm,
- int sd, unsigned ip_addr, unsigned ip_port)
+ int sd, struct sockaddr_in *addr)
{
struct web_connection *c = NULL;
c = os_zalloc(sizeof(*c));
if (c == NULL)
return;
+ os_memcpy(&c->cli_addr, addr, sizeof(c->cli_addr));
c->sm = sm;
c->sd = sd;
#if 0
errno, strerror(errno), sm->web_sd);
return;
}
- web_connection_start(sm, new_sd, addr.sin_addr.s_addr,
- htons(addr.sin_port));
+ web_connection_start(sm, new_sd, &addr);
}