From 9f78015a5b71f77132f310e53c3d5c8cdd1a8148 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Thu, 22 May 2014 01:12:06 +0200 Subject: [PATCH] miniupnpd/minissdp.c: also listen on global SSDP multicast address FF0E::C Add comments about also sending the NOTIFY to this address --- miniupnpd/minissdp.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/miniupnpd/minissdp.c b/miniupnpd/minissdp.c index 7392069..b89f821 100644 --- a/miniupnpd/minissdp.c +++ b/miniupnpd/minissdp.c @@ -32,6 +32,7 @@ #define SSDP_MCAST_ADDR ("239.255.255.250") #define LL_SSDP_MCAST_ADDR "FF02::C" #define SL_SSDP_MCAST_ADDR "FF05::C" +#define GL_SSDP_MCAST_ADDR "FF0E::C" /* maximum lenght of SSDP packets we are generating * (reception is done in a 1500byte buffer) */ @@ -92,6 +93,12 @@ AddMulticastMembershipIPv6(int s) syslog(LOG_ERR, "setsockopt(udp, IPV6_ADD_MEMBERSHIP): %m"); return -1; } + inet_pton(AF_INET6, GL_SSDP_MCAST_ADDR, &mr.ipv6mr_multiaddr); + if(setsockopt(s, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, &mr, sizeof(struct ipv6_mreq)) < 0) + { + syslog(LOG_ERR, "setsockopt(udp, IPV6_ADD_MEMBERSHIP): %m"); + return -1; + } return 0; } #endif @@ -587,6 +594,15 @@ SendSSDPNotifies(int s, const char * host, unsigned short http_port, p->sin6_family = AF_INET6; p->sin6_port = htons(SSDP_PORT); inet_pton(AF_INET6, LL_SSDP_MCAST_ADDR, &(p->sin6_addr)); + /* TODO : also send to SL_SSDP_MCAST_ADDR and GL_SSDP_MCAST_ADDR ? */ + /* UPnP Device Architecture 1.1 : + * Devices MUST multicast SSDP messages for each of the UPnP-enabled + * interfaces. The scope of multicast SSDP messages MUST be + * link local FF02::C if the message is sent from a link local address. + * If the message is sent from a global address it MUST be multicast + * using either global scope FF0E::C or site local scope FF05::C. + * In networks with complex topologies and overlapping sites, use of + * global scope is RECOMMENDED. */ } else #endif