-
Notifications
You must be signed in to change notification settings - Fork 20k
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
p2p/nat: handle responses with alternative port in NAT-PMP #26321
Conversation
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.
Good catch! I've changed the wording from 'preempted' to 'already mapped'.
Thanks, that's more neat. |
You're right, it's better to mention the external port. I got confused. |
Another thing, while this is a good fix, it'd be so much nicer to actually handle the alternative port returned by the router and use it, instead of abandoning the mapping. Same for UPnP. At the time when p2p/nat was introduced we had no way of doing that, but things have changed. Nowadays the announced endpoint is managed by |
Nice. I would like to implement that. Shall I close this PR and make a new one? |
Nice that you want to look into it. Let's just merge this fix now, and then see how it goes with the other idea. |
…26321) Co-authored-by: Felix Lange <fjl@twurst.com>
…26321) Co-authored-by: Felix Lange <fjl@twurst.com>
For NAT-PMP, returns success with an available port if the requested port is already preempted. If this situation occurs, the current implementation considers it a success and performs the remaining tasks, but in practice, communication with external network nodes is impossible, and it is difficult to track down this issue.
This PR adds check logic for preempted ports and define this situation as an error.
ref: rfc6886 p.12, p.29