Author: brian Date: Tue Jun 9 09:40:27 2009 New Revision: 13720 Log: don't let 0.0.0.0 be valid for upnp because some devices that are not internet gateways will return this ie printers Modified: freeswitch/trunk/src/switch_nat.c Modified: freeswitch/trunk/src/switch_nat.c ============================================================================== --- freeswitch/trunk/src/switch_nat.c (original) +++ freeswitch/trunk/src/switch_nat.c Tue Jun 9 09:40:27 2009 @@ -74,6 +74,7 @@ } 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 @@ 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; }