-
Notifications
You must be signed in to change notification settings - Fork 37.7k
[WIP][NET] Add NATPMP support. #12288
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
Conversation
…ss, map public-private port
I assume libnatpmp should be subtree'd or we should still use the version linked-against in miniupnpc?
…On January 28, 2018 8:15:18 PM UTC, Annanay Agarwal ***@***.***> wrote:
Adds minimal support for NATPMP (and removes dependency on external
UPnP library). Reference implementation in `miniupnp/libnatpmp`.
WIP but aims to fix #11902 .
You can view, comment on, or merge this pull request online at:
#12288
-- Commit Summary --
* Add basic NATPMP support, get gateway by file parsing,
getpublicaddress, map public-private port
-- File Changes --
A src/getgateway.c (570)
A src/getgateway.h (47)
A src/natpmp.c (354)
A src/natpmp.h (182)
M src/net.cpp (187)
A src/wingettimeofday.c (60)
A src/wingettimeofday.h (36)
-- Patch Links --
https://github.com/bitcoin/bitcoin/pull/12288.patch
https://github.com/bitcoin/bitcoin/pull/12288.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#12288
|
This PR just copies 6 files from libnatpmp into the repository. Perhaps this is a sufficiently low amount of code that we want to do this (like with tinyformat), but if so, putting them in a subdirectory together may be better. I haven't checked how much changes were necessary to them, but if it was 0, perhaps we can subtree but still build them directly from our build system (as opposed to building as a library and linking statically). |
There are minor changes to the copied files, some including changing the |
libnatpmp seems to have been virtually unmaintained a while (last commit was Mar 15, 2016), so I think it doesn't matter whether we use 'subtree'. It might be easier to just include the (small) implementation files into our build system and see if we can maintain it ourselves, cutting out parts we don't need. At least now we don't have to carry the
I agree with that - whatever you do, please don't put them in |
This is failing the travis build - did you perhaps forget to add
|
Merge branch 'natpmp-support' of https://github.com/annanay25/bitcoin into natpmp-support
@laanwj ; I'm a little confused with the name mangling happening here. The |
You need the extern "C" in the header, not in the implementation files. |
The last travis run for this pull request was 101 days ago and is thus outdated. To trigger a fresh travis build, this pull request should be closed and re-opened. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Libraries should not be copied or subtree'd. There's arguably an excuse for consensus-critical libraries, but NATPMP is not that. Link to the system library if present, and if not, just don't build support for it.
|
||
/* initnatpmp() | ||
* initialize a natpmp_t object | ||
* With forcegw=1 the gateway is not detected automaticaly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo found by codespell
: automaticaly
if (r != 0) | ||
FreeUPNPUrls(&urls); | ||
LogPrintf("Mapped public port %hu protocol %s to local port %hu " | ||
"liftime %u\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo found by codespell
: liftime
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
@annanay25 It seems like the work on this PR has stalled somewhat. Do you have time to continue working on this PR? :-) |
Is this PR still relevant? I'm not sure if I will be able to continue working on it. @practicalswift |
I think it's still relevant, but closing if you're not able to work on it anymore. Will add "up for grabs" tag. |
Can someone please re-assign #11902 to me? I would like to take this PR forward. |
a191e23 doc: Add release notes (Hennadii Stepanov) ae749d1 doc: Add libnatpmp stuff (Hennadii Stepanov) e28f9be ci: Add libnatpmp-dev package to some builds (Hennadii Stepanov) 5a0185b gui: Add NAT-PMP network option (Hennadii Stepanov) a39f733 net: Add -natpmp command line option (Hennadii Stepanov) 28acffd net: Add NAT-PMP to port mapping loop (Hennadii Stepanov) a8d9f27 net: Add libnatpmp support (Hennadii Stepanov) 58e8364 gui: Apply port mapping changes on dialog exit (Hennadii Stepanov) cf151cc scripted-diff: Rename UPnP stuff (Hennadii Stepanov) 4e91b1e net: Add flags for port mapping protocols (Hennadii Stepanov) 8b50d1b net: Keep trying to use UPnP when -upnp=1 (Hennadii Stepanov) 28e2961 refactor: Replace magic number with named constant (Hennadii Stepanov) 02ccf69 refactor: Move port mapping code to its own module (Hennadii Stepanov) Pull request description: Close #11902 This PR is an alternative to: - #12288 - #15717 To compile with NAT-PMP support on Ubuntu [`libnatpmp-dev`](https://packages.ubuntu.com/source/bionic/libnatpmp) should be available. Log excerpt: ``` 2020-02-05T20:12:28Z [mapport] NAT-PMP: public address = 95.164.65.194 2020-02-05T20:12:28Z [mapport] AddLocal(95.164.65.194:18333,3) 2020-02-05T20:12:28Z [mapport] NAT-PMP: port mapping successful. ``` See: [`libnatpmp`](https://miniupnp.tuxfamily.org/libnatpmp.html) --- Some follow-ups are out of this PR's scope: - mention NAT-PMP library in the version message - ~integrate NAT-PMP into the GUI~ (already [added](#18077 (comment))) ACKs for top commit: laanwj: Tested and code review ACK a191e23 Tree-SHA512: 10e19267c21bf30f20ff1abfc882d526049f0e790b95e12f109dc2bed7c0aef45de03eaf967f4e667e7509be04f1873a5c508087393d947205f3aab2ad6d7cf1
Adds minimal support for NATPMP (and removes dependency on external UPnP library). Reference implementation in
miniupnp/libnatpmp
.WIP but aims to fix #11902 .