miniupnpd/pcpserver.c: Fix CheckExternalAddress() for working with 0 IPv4 mapped address

fixes #69
This commit is contained in:
Thomas Bernard 2014-04-21 19:32:09 +02:00
parent 8be1cc55c2
commit ca9b8217b4
1 changed files with 5 additions and 3 deletions

View File

@ -582,10 +582,12 @@ static int CheckExternalAddress(pcp_info_t* pcp_msg_info)
}
}
if (pcp_msg_info->ext_ip == NULL || IN6_IS_ADDR_UNSPECIFIED(pcp_msg_info->ext_ip)) {
if (pcp_msg_info->ext_ip == NULL ||
IN6_IS_ADDR_UNSPECIFIED(pcp_msg_info->ext_ip) ||
(IN6_IS_ADDR_V4MAPPED(pcp_msg_info->ext_ip)
&& ((uint32_t *)pcp_msg_info->ext_ip->s6_addr)[3] == INADDR_ANY)) {
/* no suggested external address : use real external address */
pcp_msg_info->ext_ip = &external_addr;
return 0;
}