]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
printers do not route to the internet, in fact, all printers do is kill trees, killer...
authorMichael Jerris <mike@jerris.com>
Thu, 11 Feb 2010 08:33:03 +0000 (08:33 +0000)
committerMichael Jerris <mike@jerris.com>
Thu, 11 Feb 2010 08:33:03 +0000 (08:33 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16601 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_nat.c

index 9dc89b82381fa782885966ffe1a18b726b0576ff..0f618efeac6d574ab1f4b31226218a56b418b0b6 100644 (file)
@@ -83,7 +83,8 @@ static switch_status_t get_upnp_pubaddr(char *pub_addr)
 static int init_upnp(void)
 {
        struct UPNPDev *devlist;
-       struct UPNPDev *dev;
+       struct UPNPDev *dev = NULL;
+       struct UPNPDev *trydev = NULL;
        char *descXML;
        int descXMLsize = 0;
        const char *multicastif = 0;
@@ -99,13 +100,23 @@ static int init_upnp(void)
                        if (strstr(dev->st, "InternetGatewayDevice")) {
                                break;
                        }
+                       if (!trydev && !switch_stristr("printer", dev->descURL)) {
+                               trydev = dev;
+                       }
+
                        dev = dev->pNext;
                }
-               if (!dev) {
-                       dev = devlist;          /* defaulting to first device */
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No InternetGatewayDevice, using first entry as default (%s).\n", dev->descURL);
-               }
 
+       }
+
+       if (!dev && trydev) {
+               dev = trydev; /* defaulting to first device */
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No InternetGatewayDevice, using first entry as default (%s).\n", dev->descURL);
+       } else if (devlist && !dev && !trydev) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No InternetGatewayDevice found and I am NOT going to try your printer because printers should not route to the internet, that would be DAFT\n");
+       }
+       
+       if (dev) {
                descXML = miniwget(dev->descURL, &descXMLsize);
 
                nat_globals.descURL = strdup(dev->descURL);