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

UPNP port mapping fails on routers that only support permanent lease #16732

Open
abdes opened this issue May 11, 2018 · 5 comments
Open

UPNP port mapping fails on routers that only support permanent lease #16732

abdes opened this issue May 11, 2018 · 5 comments
Assignees

Comments

@abdes
Copy link

abdes commented May 11, 2018

Hi there,

please note that this is an issue tracker reserved for bug reports and feature requests.

For general questions please use the gitter channel or the Ethereum stack exchange at https://ethereum.stackexchange.com.

System information

Geth version: geth version
Geth
Version: 1.8.8-unstable
Git Commit: 784aa83
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.10.2
Operating System: linux
GOPATH=
GOROOT=/usr/lib/go

OS & Version: Windows/Linux/OSX
Linux

Commit hash : (if develop)
Git Commit: 784aa83

Expected behaviour

At startup geth attempts to add a port mapping using UPNP. Some routers only support permanent leases (i.e. lifetime = 0). In such scenario, it is expected that geth understands the returned HTTP response and the error in the SOAP message and re-attempts the port mapping with a permanent lease.

Actual behaviour

If the router only supports permanent leases (i.e. lifetime = 0), geth fails to handle the HTTP error response and just abandons the port mapping.

Steps to reproduce the behaviour

Start get behind a NAT using NetGear router R8000 or R6300 or any other router that only supports permanent lease for UPNP port mapping.

Changing p2p/nat.go mapTimeout to 0 results in the UPNP request succeeding.

Backtrace

POST /Public_UPNP_C3 HTTP/1.1
Host: 192.168.1.1:5000
User-Agent: Go-http-client/1.1
Content-Length: 619
CONTENT-TYPE: text/xml; charset="utf-8"
SOAPACTION: "urn:schemas-upnp-org:service:WANIPConnection:1#AddPortMapping"
Accept-Encoding: gzip

<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:AddPortMapping xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1"><NewRemoteHost></NewRemoteHost><NewExternalPort>30303</NewExternalPort><NewProtocol>UDP</NewProtocol><NewInternalPort>30303</NewInternalPort><NewInternalClient>192.168.1.49</NewInternalClient><NewEnabled>1</NewEnabled><NewPortMappingDescription>ethereum discovery</NewPortMappingDescription><NewLeaseDuration>1200</NewLeaseDuration></u:AddPortMapping></s:Body></s:Envelope>

HTTP/1.1 500 Internal Server Error
EXT:
CONTENT-TYPE:text/xml
SERVER:Linux/2.6.12 UPnP/1.0 NETGEAR-UPNP/1.0
CONTENT-LENGTH:438

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring>UPnPError</faultstring>
<detail>
<UPnPError xmlns="urn:schemas-upnp-org:control-1-0">
<errorCode>725</errorCode>
<errorDescription>OnlyPermanentLeasesSupported</errorDescription></UPnPError>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>

@stale
Copy link

stale bot commented May 12, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@abdes
Copy link
Author

abdes commented May 14, 2019

This is still a bug

@anjmao
Copy link

anjmao commented Jan 30, 2020

In Mysterium we solved this issue by retrying with 0 lifetime https://github.com/mysteriumnetwork/node/blob/master/nat/mapping/port_mapping.go#L113

@fjl
Copy link
Contributor

fjl commented Feb 2, 2020

Probably a good idea for us too.

@fjl
Copy link
Contributor

fjl commented Feb 2, 2020

There is also #2380 which could be tackled at the same time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants