miniupnpd: fix processing of v4 M-SEARCH received on v6 socket

So we don't answer with the v6 LOCATION to v4 clients anymore !

should fix #467
see #461
This commit is contained in:
Thomas Bernard 2020-06-05 22:39:59 +02:00
parent 029383e5f4
commit 0af141d9c5
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C
2 changed files with 17 additions and 1 deletions

View File

@ -1,5 +1,8 @@
$Id: Changelog.txt,v 1.464 2020/05/10 17:57:56 nanard Exp $
2020/06/05:
fix handling of ipv4 M-SEARCH received on ipv6 sockets
2020/06/03:
configure --disable-fork to disable going to background
improve upnp_get_portmapping_number_of_entries()

View File

@ -1126,7 +1126,13 @@ ProcessSSDPData(int s, const char *bufr, int n,
syslog(LOG_INFO, "SSDP M-SEARCH from %s ST: %.*s",
sender_str, st_len, st);
/* find in which sub network the client is */
#ifdef ENABLE_IPV6
if((sender->sa_family == AF_INET) ||
(sender->sa_family == AF_INET6 &&
IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)sender)->sin6_addr)))
#else
if(sender->sa_family == AF_INET)
#endif
{
if (lan_addr == NULL)
{
@ -1138,7 +1144,7 @@ ProcessSSDPData(int s, const char *bufr, int n,
announced_host = lan_addr->str;
}
#ifdef ENABLE_IPV6
else
else if(sender->sa_family == AF_INET6)
{
/* IPv6 address with brackets */
#ifdef UPNP_STRICT
@ -1178,6 +1184,13 @@ ProcessSSDPData(int s, const char *bufr, int n,
#endif
}
#endif
else
{
syslog(LOG_ERR,
"Unknown address family %d for client %s",
sender->sa_family, sender_str);
return;
}
/* Responds to request with a device as ST header */
for(i = 0; known_service_types[i].s; i++)
{