[or-cvs] r14234: Add UPnP forwarding for servers (works but is rough) (torbrowser/trunk/src/current-patches)

sjm217 at seul.org sjm217 at seul.org
Sat Mar 29 21:31:11 UTC 2008


Author: sjm217
Date: 2008-03-29 17:31:10 -0400 (Sat, 29 Mar 2008)
New Revision: 14234

Modified:
   torbrowser/trunk/src/current-patches/vidalia-miniupnp.patch
Log:
Add UPnP forwarding for servers (works but is rough)

Modified: torbrowser/trunk/src/current-patches/vidalia-miniupnp.patch
===================================================================
--- torbrowser/trunk/src/current-patches/vidalia-miniupnp.patch	2008-03-29 05:43:04 UTC (rev 14233)
+++ torbrowser/trunk/src/current-patches/vidalia-miniupnp.patch	2008-03-29 21:31:10 UTC (rev 14234)
@@ -69,7 +69,6 @@
 +ServerSettings::init_upnp()
 +{
 +  struct UPNPDev * devlist;
-+  char lanaddr[256];
 +  int retval;
 +
 +  printf("TB : init_upnp()\n");
@@ -78,7 +77,7 @@
 +  memset(&data, 0, sizeof(struct IGDdatas));
 +
 +  devlist = upnpDiscover(2000, NULL, NULL);
-+  retval = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, 256);
++  retval = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr));
 +  printf("UPNP: %d", retval);
 +
 +  freeUPNPDevlist(devlist);
@@ -127,6 +126,7 @@
 +ServerSettings::configurePortForwarding()
 +{
 +  init_upnp();
++  upnp_add_redir(lanaddr, getORPort());
 +}
 +
  /** Virtual method called when we retrieve a server-related setting from Tor.
@@ -152,13 +152,14 @@
  
  class ServerSettings : public AbstractTorSettings
  {
-@@ -89,9 +93,20 @@
+@@ -89,9 +93,21 @@
    virtual QVariant torValue(const QString &key) const;
  
  private:
 +  /** Used by miniupnpc library */
 +  struct UPNPUrls urls;
 +  struct IGDdatas data;
++  char lanaddr[16];
 +  void init_upnp();
 +  void upnp_add_redir (const char * addr, int port);
 +  void upnp_rem_redir(int port);



More information about the tor-commits mailing list