miniupnpd/minissdp.c: bind the SSDP IPv6 sending socket

This commit is contained in:
Thomas Bernard 2014-05-23 17:03:56 +02:00
parent 6bf84dc834
commit 4069d9633c
1 changed files with 13 additions and 0 deletions

View File

@ -263,6 +263,7 @@ OpenAndConfSSDPNotifySocketIPv6(unsigned int if_index)
{ {
int s; int s;
unsigned int loop = 0; unsigned int loop = 0;
struct sockaddr_in6 sockname;
s = socket(PF_INET6, SOCK_DGRAM, 0); s = socket(PF_INET6, SOCK_DGRAM, 0);
if(s < 0) if(s < 0)
@ -282,6 +283,18 @@ OpenAndConfSSDPNotifySocketIPv6(unsigned int if_index)
close(s); close(s);
return -1; return -1;
} }
memset(&sockname, 0, sizeof(sockname));
sockname.sin6_family = AF_INET6;
sockname.sin6_addr = in6addr_any;
/*sockname.sin6_scope_id = if_index;*/
if(bind(s, (struct sockaddr *)&sockname, sizeof(sockname)) < 0)
{
syslog(LOG_ERR, "bind(udp_notify IPv6): %m");
close(s);
return -1;
}
return s; return s;
} }
#endif #endif