diff --git a/minissdpd/Changelog.txt b/minissdpd/Changelog.txt index 0cf152a..db1df01 100644 --- a/minissdpd/Changelog.txt +++ b/minissdpd/Changelog.txt @@ -1,4 +1,7 @@ -$Id: Changelog.txt,v 1.33 2014/02/03 15:45:07 nanard Exp $ +$Id: Changelog.txt,v 1.34 2014/05/01 21:05:14 nanard Exp $ + +2014/05/01: + listen on only 1 IPv4 if only 1 interface is specified 2014/02/03: silently ignore EAGAIN, EWOULDBLOCK, EINTR of recv calls diff --git a/minissdpd/openssdpsocket.c b/minissdpd/openssdpsocket.c index 02de539..f97606b 100644 --- a/minissdpd/openssdpsocket.c +++ b/minissdpd/openssdpsocket.c @@ -192,7 +192,19 @@ OpenAndConfSSDPReceiveSocket(int n_listen_addr, struct sockaddr_in * sa = (struct sockaddr_in *)&sockname; sa->sin_family = AF_INET; sa->sin_port = htons(SSDP_PORT); - sa->sin_addr.s_addr = htonl(INADDR_ANY); + if(n_listen_addr == 1) + { + sa->sin_addr.s_addr = GetIfAddrIPv4(listen_addr[0]); + if(sa->sin_addr.s_addr == INADDR_NONE) + { + syslog(LOG_ERR, "no IPv4 address for interface %s", + listen_addr[0]); + close(s); + return -1; + } + } + else + sa->sin_addr.s_addr = htonl(INADDR_ANY); sockname_len = sizeof(struct sockaddr_in); } #else