Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#471 closed Enhancement (invalid)

Abstract away NAT Traversal stuff

Reported by: tiennou Owned by: tiennou
Priority: Normal Milestone: None Set
Component: libtransmission Version: 0.95
Severity: Normal Keywords: upnp nat-pmp traversal


Here is a patch abstracting away the separation between UPnP & NAT-PMP, so that when miniupnpc (or another library) get NAT-PMP support, we can easily modify the nat stuff without completely breaking libT. Also supports opening more than 1 port (on the UPnP side only), so that DHT integration will have it available ;-). Sorry for the non-natpmp support, but adding this require hacking the existing code, which will probably disappear when we add the aforementionned library, and opening multiple ports is not used in code right now. ATTENTION, I have tested UPnP, but not NAT-PMP (altough I just rerouted calls, do it *should* work). Also I made a tweak to miniupnpc code to get a return at port unmapping.

Attachments (1)

nat-rework.diff (74.5 KB) - added by tiennou 14 years ago.
Patch v2 : +NAT-PMP

Download all attachments as: .zip

Change History (7)

comment:1 Changed 14 years ago by charles

I'm extremely hesitant to commit any code changes in third-party that don't come from upstream... because whenever we upgrade to the next version of miniupnp, we'll either have to re-patch or lose the changes. Could you please submit a patch upstream for your miniupnp changes?

Changed 14 years ago by tiennou

Patch v2 : +NAT-PMP

comment:2 Changed 14 years ago by tiennou

  • Owner changed from somebody to tiennou

Ok some more rework ;-). Regarding miniupnp modifications, I'll send a patch to the miniupnp developer concerning the changes I made to his code.

So now we got NAT-PMP using PMPMyApp (, but since I can't test it, I'm not sure it works. If someone with a NAT-PMP device can apply this patch and test, I'll love to hear successful stories ;-).

Now there's still room for improvement, because we still don't care about reboots, and since I made discovery async, sometime the port map fails because the discovery process is still running...

comment:3 Changed 14 years ago by tiennou

  • Status changed from new to assigned

comment:4 Changed 14 years ago by tiennou

  • Keywords upnp nat-pmp traversal added

comment:5 Changed 14 years ago by charles

  • Resolution set to invalid
  • Status changed from assigned to closed

tiennou: I like this patch a lot, but I think it overlaps with the current abstraction in pre-1.0 builds wrt upnp.c/natpmp.c/shared.c, which seems to be working (finally). So I'm not going to use this patch, but don't let that discourage you from future patches...

comment:6 Changed 14 years ago by charles

  • Component changed from Transmission to libtransmission
Note: See TracTickets for help on using tickets.