Skip to content

Commit

Permalink
UPNP_GetValidIGD() checks external ip address = 0.0.0.0
Browse files Browse the repository at this point in the history
(or empty string)
  • Loading branch information
miniupnp committed Jan 24, 2016
1 parent 4f0e9d2 commit 1c61d33
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions miniupnpc/miniupnpc.c
@@ -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
* Project : miniupnp
* Web : http://miniupnp.free.fr/
Expand Down Expand Up @@ -643,7 +643,8 @@ UPNP_GetValidIGD(struct UPNPDev * devlist,
/* checks that status is connected AND there is a external IP address assigned */
if(is_connected &&
(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;
}
FreeUPNPUrls(urls);
Expand All @@ -664,8 +665,8 @@ UPNP_GetValidIGD(struct UPNPDev * devlist,
#endif
if(is_connected &&
(UPNP_GetExternalIPAddress(urls->controlURL, data->first.servicetype, extIpAddr) == 0)) {
if(!is_rfc1918addr(extIpAddr))
goto free_and_return;
if(!is_rfc1918addr(extIpAddr) && (extIpAddr[0] != '\0')
&& (0 != strcmp(extIpAddr, "0.0.0.0"))
}
FreeUPNPUrls(urls);
}
Expand Down

0 comments on commit 1c61d33

Please sign in to comment.