From d274456d0730a4543ef6039396f476f0b1142ff4 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Sun, 24 Jan 2016 17:33:42 +0100 Subject: [PATCH] UPNP_GetValidIGD() checks external ip address = 0.0.0.0 (or empty string) --- miniupnpc/miniupnpc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/miniupnpc/miniupnpc.c b/miniupnpc/miniupnpc.c index 5705985..9cf999d 100644 --- a/miniupnpc/miniupnpc.c +++ b/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/ @@ -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); @@ -664,7 +665,8 @@ UPNP_GetValidIGD(struct UPNPDev * devlist, #endif 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);