don't let 0.0.0.0 be valid for upnp because some devices that are not internet gateways will return this ie printers

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13720 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Brian West 2009-06-09 14:40:27 +00:00
parent 5be36368c3
commit 7d597b996b
1 changed files with 7 additions and 0 deletions

View File

@ -74,6 +74,7 @@ static int init_upnp (void)
}
if (!dev) {
dev = devlist; /* defaulting to first device */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No InternetGatewayDevice, using first entry as default.\n");
}
descXML = miniwget(dev->descURL, &descXMLsize);
@ -91,6 +92,12 @@ static int init_upnp (void)
nat_globals.data.servicetype,
nat_globals.pub_addr)) == UPNPCOMMAND_SUCCESS) {
if (!strcmp(nat_globals.pub_addr, "0.0.0.0")) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"uPNP Device (url: %s) returned an invalid external address of 0.0.0.0. Disabling uPNP\n", nat_globals.urls.controlURL);
return -2;
}
nat_globals.nat_type = SWITCH_NAT_TYPE_UPNP;
return 0;
}