UPNP_GetValidIGD() checks external ip address = 0.0.0.0

(or empty string)
This commit is contained in:
Thomas Bernard 2016-01-24 17:33:42 +01:00
parent 4f0e9d20e5
commit d274456d07
1 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $Id: miniupnpc.c,v 1.146 2016/01/22 15:19:42 nanard Exp $ */ /* $Id: miniupnpc.c,v 1.147 2016/01/24 16:32:24 nanard Exp $ */
/* vim: tabstop=4 shiftwidth=4 noexpandtab /* vim: tabstop=4 shiftwidth=4 noexpandtab
* Project : miniupnp * Project : miniupnp
* Web : http://miniupnp.free.fr/ * Web : http://miniupnp.free.fr/
@ -643,7 +643,8 @@ UPNP_GetValidIGD(struct UPNPDev * devlist,
/* checks that status is connected AND there is a external IP address assigned */ /* checks that status is connected AND there is a external IP address assigned */
if(is_connected && if(is_connected &&
(UPNP_GetExternalIPAddress(urls->controlURL, data->first.servicetype, extIpAddr) == 0)) { (UPNP_GetExternalIPAddress(urls->controlURL, data->first.servicetype, extIpAddr) == 0)) {
if(!is_rfc1918addr(extIpAddr)) if(!is_rfc1918addr(extIpAddr) && (extIpAddr[0] != '\0')
&& (0 != strcmp(extIpAddr, "0.0.0.0")))
goto free_and_return; goto free_and_return;
} }
FreeUPNPUrls(urls); FreeUPNPUrls(urls);
@ -664,7 +665,8 @@ UPNP_GetValidIGD(struct UPNPDev * devlist,
#endif #endif
if(is_connected && if(is_connected &&
(UPNP_GetExternalIPAddress(urls->controlURL, data->first.servicetype, extIpAddr) == 0)) { (UPNP_GetExternalIPAddress(urls->controlURL, data->first.servicetype, extIpAddr) == 0)) {
if(!is_rfc1918addr(extIpAddr)) if(!is_rfc1918addr(extIpAddr) && (extIpAddr[0] != '\0')
&& (0 != strcmp(extIpAddr, "0.0.0.0")))
goto free_and_return; goto free_and_return;
} }
FreeUPNPUrls(urls); FreeUPNPUrls(urls);