-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add UPnP support. #969
Add UPnP support. #969
Conversation
An issue I see about this pull request is that upnp should be optional (travis is failing because configure can't find the upnp library). I also need someone to test it and confirm that it works. @mk21 upnp is a clusterfuck so we kind of have to depend on a library to support it. |
You can disable UPnP support in ./configure (./configure --disable-miniupnp). |
UPnP as optional library is good choice for lot of routers so people without knowledge can be directly connected if ISP has open ports. |
Some of the tests fail currently because it times out on allocating UPnP ports. Should there be an argument in new_networking that disables UPnP port mapping? |
even if upnp is enabled in the build tox needs to work if the NAT doesn't support upnp. |
Tox does work when NAT doesn't support UPnP. However, the function upnpDiscover will block for 1 second before it gives up searching for UPnP devices. For the same reason the tests timeout, since new_networking was called many times on those tests. |
And what about NAT PMP (Apple UPNP)? |
MiniUPnP C library should support NAT-PNP too or i am wrong? |
@fcore117 you are wrong. see http://miniupnp.tuxfamily.org/ |
Has anyone tested this and can confirm that it works? uPnP support on my router is broken so unfortunately I can't really test it. |
I have tested it on a few computers running on different routers, and it works well. I have only tested on Linux though. |
miniupnp have a companion library to support NAT-PMP: http://miniupnp.tuxfamily.org/libnatpmp.html . Transmission uses both (https://trac.transmissionbt.com/browser/trunk/third-party?order=name), so we can consider them well tested. |
I could help testing this if someone can write a little bit about what needs to be done and how to verify that it works... |
you need to confirm that it does actually forward the port and keeps it forwarded for the time Tox is running. |
okay but tox works without uPNP currently, what is the point of adding it? Or does it not work in all environments and uPNP will enable that? |
It might improve performance of Tox on some routers. |
It works on windows. |
What's happening with this one? In general, tox (udp) seems to work better when ports are opened. Can I help with testing this? What needs to be done to merge this? |
Why this PR was not merged to master? |
@BiTOk for a few reasons. The first few that comes to mind is that it merge conflics. no one else has tested it and posted here that it works. It's been silent for almost a year. And the submitter hasn't done anything with it for awhile |
I tested it on windows and it worked. I saw that it forwarded ports via UPnP. |
@shaunren any chance we could get you to rebase or merge master into this PR? @towlie @BiTOk @LittleVulpix @cebe any of you want to take a stab at it if shaunren isn't around? |
What about running Travis on it? A separate cross-referenced PR might be better. |
The only problem I saw with this was that static linking failed. I could only use shared dll for linking. The static .a file was never used/found by toxcore configure. |
I'll try to see if I can get it going somehow. |
@nurupo is right, a separate PR would be best |
And now that I think about it. What do you think about defaulting to compiling without this? Tox isn't exactly quiet on a network. But UPnP broadcasts would be quite telling as to who's running what on the network... Thoughts? |
Maybe present it as a setting "Enable UPnP" and disable it by default? |
@BiTOk yeah, there's already a flag to disable it, just need to make that the default, and change the flag to optionally enable it |
@GrayHatter I said about client setting, not about compiling setting. |
What does this UPnP support actually bring to Tox? How it is useful? As far as I understand, it's used only for discovery of Tox nodes/clients running in LAN, i.e. it's functionality greatly overlaps with the one of LAN discovery Tox currently has. If so, then I don't see it bringing anything useful to justify a new library dependency (perhaps optional one). |
Also, there must be a way to enable/disable it, so a new field in |
@nurupo upnp configures upnp-compatible(and enabled) routers for port forwarding. In other words, it will automatically make your router forward 33445 to you (or whichever port your tox decides to use), which improves tox networking, especially in udp mode. |
@nurupo much more reliable then UDP hole punching |
Ok, then I have misunderstood it. Sounds good to me, the dependency is justified :) |
As I can understand, this can increase file transfer speed and decrease tox network load (transfer without tcp relay. I correctly understood? |
towlie: what do you mean cannot statically linked? does it mean we should forget single .exe or binary releases or it is something else? i am not programmer. |
@fcore117 It means that I had to use an extra dll file. So no single .exe binary. I assume that this is fixable with some research. Because it produces an static linkable .a file but somehow toxcore wasn't able to use it. |
I've been defeated by rebasing, I can't do it. It's up to @shaunren or the other warriors now! |
Closing as stale, I'll re-open this if anyone wants to take over. @irungentoo @shaunren |
Added UPnP support using libminiupnpc.