minissdpd/openssdpsocket.c: listen on only 1 IPv4 if only 1 interface is specified
This commit is contained in:
parent
69dac1ef50
commit
6d379d54f5
|
@ -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
|
||||
|
|
|
@ -192,6 +192,18 @@ OpenAndConfSSDPReceiveSocket(int n_listen_addr,
|
|||
struct sockaddr_in * sa = (struct sockaddr_in *)&sockname;
|
||||
sa->sin_family = AF_INET;
|
||||
sa->sin_port = htons(SSDP_PORT);
|
||||
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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue