Reload this Page

UPnP workaround for Belkin F5D8233-4-v1(01)


Reply
Thread Tools
Search this Thread
Display Modes
  #1  
Old May 7th, 2009, 02:36 PM
zab_ zab_ is offline
Junior Member
 
Join Date: May 2009
Posts: 1
Default UPnP workaround for Belkin F5D8233-4-v1(01)

My Belkin N router has a bug in the UPnP actions. It appends a whitespace at the end of the port mapping action and it becomes "AddPortMapping " instead of "AddPortMapping".

Below is a workaround for this.

Code:
Index: components/gnutella-core/src/main/java/com/limegroup/gnutella/UPnPManager.java
===================================================================
RCS file: /cvs/limewire/components/gnutella-core/src/main/java/com/limegroup/gnutella/UPnPManager.java,v
retrieving revision 1.40
diff -u -r1.40 UPnPManager.java
--- components/gnutella-core/src/main/java/com/limegroup/gnutella/UPnPManager.java      19 Mar 2009 18:28:23 -0000      1.40
+++ components/gnutella-core/src/main/java/com/limegroup/gnutella/UPnPManager.java      7 May 2009 14:27:05 -0000
@@ -329,10 +329,23 @@
                
                Action add = _service.getAction("AddPortMapping");
                
-               if(add == null) {
-                   LOG.debug("Couldn't find AddPortMapping action!");
-                   return false;
-               }
+               if(add == null) {
+               LOG.debug("Couldn't find AddPortMapping action! Will iterate...");
+               for (Object action : _service.getActionList()) {
+                   Action a = (Action)action;
+                   if (a == null || a.getName() == null)
+                       continue;
+                   if ("AddPortMapping".equals(a.getName().trim())) {
+                       add = a;
+                       break;
+                   } 
+               }
+                
+               if (add == null) {
+                   LOG.debug("Really couldn't find action.  Giving up.");
+                   return false;
+               }
+        }
                    
                
                add.setArgumentValue("NewRemoteHost",m._externalAddress);
Reply With Quote
  #2  
Old May 7th, 2009, 02:52 PM
Sam's Avatar
Sam Sam is offline
software developer
 
Join Date: Mar 2006
Location: new york
Posts: 1,613
Default

Thanks for the patch. :-)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Forum Jump


All times are GMT. The time now is 05:09 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.