minissdpd: set SO_REUSEADDR on SSDP socket.
see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=644511
This commit is contained in:
parent
fd96a3ddcd
commit
5e69a32343
|
@ -1,7 +1,8 @@
|
|||
$Id: Changelog.txt,v 1.19 2011/07/30 13:16:22 nanard Exp $
|
||||
$Id: Changelog.txt,v 1.20 2011/10/07 09:21:19 nanard Exp $
|
||||
|
||||
2011/10/07:
|
||||
unlink unix socket before binding.
|
||||
set SO_REUSEADDR on SSDP socket.
|
||||
|
||||
VERSION 1.1:
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: openssdpsocket.c,v 1.7 2011/07/30 13:10:06 nanard Exp $ */
|
||||
/* $Id: openssdpsocket.c,v 1.8 2011/10/07 09:21:03 nanard Exp $ */
|
||||
/* MiniUPnP project
|
||||
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
||||
* (c) 2006-2011 Thomas Bernard
|
||||
|
@ -143,8 +143,8 @@ OpenAndConfSSDPReceiveSocket(int n_listen_addr,
|
|||
int ipv6)
|
||||
{
|
||||
int s;
|
||||
int opt = 1;
|
||||
#ifdef ENABLE_IPV6
|
||||
int on = 1;
|
||||
struct sockaddr_storage sockname;
|
||||
#else
|
||||
struct sockaddr_in sockname;
|
||||
|
@ -167,7 +167,7 @@ OpenAndConfSSDPReceiveSocket(int n_listen_addr,
|
|||
{
|
||||
#ifdef IPV6_V6ONLY
|
||||
if(setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY,
|
||||
(char *)&on, sizeof(on)) < 0)
|
||||
(char *)&opt, sizeof(opt)) < 0)
|
||||
{
|
||||
syslog(LOG_WARNING, "setsockopt(IPV6_V6ONLY): %m");
|
||||
}
|
||||
|
@ -197,6 +197,11 @@ OpenAndConfSSDPReceiveSocket(int n_listen_addr,
|
|||
sockname_len = sizeof(struct sockaddr_in);
|
||||
#endif
|
||||
|
||||
if(setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) < 0)
|
||||
{
|
||||
syslog(LOG_WARNING, "setsockopt(SO_REUSEADDR): %m");
|
||||
}
|
||||
|
||||
if(bind(s, (struct sockaddr *)&sockname, sockname_len) < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "bind(udp%s): %m", ipv6 ? "6" : "");
|
||||
|
|
Loading…
Reference in New Issue