Skip to content
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

Closed
wants to merge 5 commits into from
Closed

Add UPnP support. #969

wants to merge 5 commits into from

Conversation

shaunren
Copy link

Added UPnP support using libminiupnpc.

@irungentoo
Copy link
Owner

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.

@shaunren
Copy link
Author

You can disable UPnP support in ./configure (./configure --disable-miniupnp).

@fcore117
Copy link

UPnP as optional library is good choice for lot of routers so people without knowledge can be directly connected if ISP has open ports.

@shaunren
Copy link
Author

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?

@irungentoo
Copy link
Owner

even if upnp is enabled in the build tox needs to work if the NAT doesn't support upnp.

@shaunren
Copy link
Author

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.

@iShift
Copy link

iShift commented Jul 14, 2014

And what about NAT PMP (Apple UPNP)?

@fcore117
Copy link

MiniUPnP C library should support NAT-PNP too or i am wrong?

@nurupo
Copy link
Contributor

nurupo commented Jul 14, 2014

@fcore117 you are wrong. see http://miniupnp.tuxfamily.org/

@irungentoo
Copy link
Owner

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.

@shaunren
Copy link
Author

I have tested it on a few computers running on different routers, and it works well. I have only tested on Linux though.

@ittner
Copy link
Contributor

ittner commented Aug 30, 2014

@fcore117 @nurupo

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.

@cebe
Copy link

cebe commented Nov 24, 2014

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...

@irungentoo
Copy link
Owner

you need to confirm that it does actually forward the port and keeps it forwarded for the time Tox is running.

@cebe
Copy link

cebe commented Nov 25, 2014

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?

@irungentoo
Copy link
Owner

It might improve performance of Tox on some routers.

@towlie
Copy link

towlie commented Dec 12, 2014

It works on windows.

@LittleVulpix
Copy link
Contributor

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?

@BiTOk
Copy link

BiTOk commented Nov 27, 2015

Why this PR was not merged to master?

@GrayHatter
Copy link
Collaborator

@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

@towlie
Copy link

towlie commented Nov 27, 2015

I tested it on windows and it worked. I saw that it forwarded ports via UPnP.

@GrayHatter
Copy link
Collaborator

@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?
If so just use git format-patch and past the output here.

@nurupo
Copy link
Contributor

nurupo commented Nov 27, 2015

If so just use git format-patch and past the output here.

What about running Travis on it? A separate cross-referenced PR might be better.

@towlie
Copy link

towlie commented Nov 27, 2015

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.

@LittleVulpix
Copy link
Contributor

I'll try to see if I can get it going somehow.

@GrayHatter
Copy link
Collaborator

@nurupo is right, a separate PR would be best

@GrayHatter
Copy link
Collaborator

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?

@BiTOk
Copy link

BiTOk commented Nov 27, 2015

Maybe present it as a setting "Enable UPnP" and disable it by default?

@GrayHatter
Copy link
Collaborator

@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

@BiTOk
Copy link

BiTOk commented Nov 27, 2015

@GrayHatter I said about client setting, not about compiling setting.

@nurupo
Copy link
Contributor

nurupo commented Nov 27, 2015

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).

@nurupo
Copy link
Contributor

nurupo commented Nov 27, 2015

Also, there must be a way to enable/disable it, so a new field in Tox_Options struct would be required. (That essentially means that a Tox must be restarted in order to enable/disable it.)

@GrayHatter GrayHatter removed the STALE label Nov 27, 2015
@LittleVulpix
Copy link
Contributor

@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.

@GrayHatter
Copy link
Collaborator

@nurupo much more reliable then UDP hole punching

@nurupo
Copy link
Contributor

nurupo commented Nov 27, 2015

Ok, then I have misunderstood it. Sounds good to me, the dependency is justified :)

@BiTOk
Copy link

BiTOk commented Nov 27, 2015

As I can understand, this can increase file transfer speed and decrease tox network load (transfer without tcp relay. I correctly understood?

@fcore117
Copy link

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.

@towlie
Copy link

towlie commented Nov 27, 2015

@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.

@LittleVulpix
Copy link
Contributor

I've been defeated by rebasing, I can't do it. It's up to @shaunren or the other warriors now!

@GrayHatter
Copy link
Collaborator

Closing as stale, I'll re-open this if anyone wants to take over. @irungentoo @shaunren

@GrayHatter GrayHatter closed this Jan 2, 2016
This was referenced Mar 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.