minissdpd: disable multicast loop

This commit is contained in:
Thomas Bernard 2015-08-06 16:07:07 +02:00
parent 8e5d55a7e8
commit 6ddb505f68
2 changed files with 11 additions and 2 deletions

View File

@ -1,4 +1,7 @@
$Id: Changelog.txt,v 1.42 2015/08/06 13:16:58 nanard Exp $ $Id: Changelog.txt,v 1.43 2015/08/06 14:05:49 nanard Exp $
2015/08/06:
disable multicast loop
VERSION 1.4: VERSION 1.4:

View File

@ -1,4 +1,4 @@
/* $Id: openssdpsocket.c,v 1.16 2015/07/21 15:39:37 nanard Exp $ */ /* $Id: openssdpsocket.c,v 1.17 2015/08/06 14:05:37 nanard Exp $ */
/* MiniUPnP project /* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2015 Thomas Bernard * (c) 2006-2015 Thomas Bernard
@ -106,6 +106,7 @@ OpenAndConfSSDPReceiveSocket(int ipv6, unsigned char ttl)
{ {
int s; int s;
int opt = 1; int opt = 1;
unsigned char loopchar = 0;
#ifdef ENABLE_IPV6 #ifdef ENABLE_IPV6
struct sockaddr_storage sockname; struct sockaddr_storage sockname;
#else /* ENABLE_IPV6 */ #else /* ENABLE_IPV6 */
@ -196,6 +197,11 @@ OpenAndConfSSDPReceiveSocket(int ipv6, unsigned char ttl)
sockname_len = sizeof(struct sockaddr_in); sockname_len = sizeof(struct sockaddr_in);
#endif /* ENABLE_IPV6 */ #endif /* ENABLE_IPV6 */
if(setsockopt(s, IPPROTO_IP, IP_MULTICAST_LOOP, (char *)&loopchar, sizeof(loopchar)) < 0)
{
syslog(LOG_WARNING, "setsockopt(IP_MULTICAST_LOOP): %m");
}
if(setsockopt(s, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl)) < 0) if(setsockopt(s, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl)) < 0)
{ {
syslog(LOG_WARNING, "setsockopt(IP_MULTICAST_TTL): %m"); syslog(LOG_WARNING, "setsockopt(IP_MULTICAST_TTL): %m");