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 support problem #1620

Closed
ghost opened this issue Feb 16, 2019 · 3 comments · Fixed by #2566 or #2571
Closed

--upnp support problem #1620

ghost opened this issue Feb 16, 2019 · 3 comments · Fixed by #2566 or #2571

Comments

@ghost
Copy link

ghost commented Feb 16, 2019

My network is Dynamic Internet IP and Regular changes for 1 or 2 days, So I need upnp to auto mapping port for decred public node.
I found a problem that dcrd's upnp don't work well, but bitcoind's upnp have no problem.
I change three router for this problem, But it don't work.
The dcrd log is[WRN] SRVR: can't add UPnP port mapping: error 500 for AddPortMapping
And then I captured the data packet for upnp, the following information:
ps:192.168.1.1 is my router and 192.168.1.4 is a running dcrd's raspberrypi.
Here is the pcap https://mega.nz/#!Uz5iAQKK!lpDskeUkflZ0ExwicsdYwkhaH-3wNHm7I3HLfk4VQpc

POST /upnp/control/WANIPConn1 HTTP/1.1
Host: 192.168.1.1:49652
User-Agent: Darwin/10.0.0, UPnP/1.0, MiniUPnPc/1.3
Content-Length: 590
Cache-Control: no-cache
Connection: Close
Content-Type: text/xml ; charset="utf-8"
Pragma: no-cache
Soapaction: "urn:schemas-upnp-org:service:WANIPConnection:1#AddPortMapping"
Accept-Encoding: gzip

<?xml version="1.0" ?><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>9108</NewExternalPort><NewProtocol>TCP</N:ewProtocol><NewInternalPort>9108</NewInternalPort><NewInternalClient></NewInternalClient><NewEnabled>1</NewEnabled><NewPortMappingDescription>dcrd listen port</NewPortMappingDescription><NewLeaseDuration>1200</NewLeaseDuration></u:AddPortMapping></s:Body></s:Envelope>HTTP/1.1 500 Internal Server Error
CONTENT-LENGTH: 410
CONTENT-TYPE: text/xml; charset="utf-8"
DATE: Sat, 16 Feb 2019 06:13:45 GMT
EXT:
SERVER: Linux/3.10.53-HULK2, UPnP/1.0, Portable SDK for UPnP devices/1.6.18
X-User-Agent: UPnP/1.0 DLNADOC/1.50
CONNECTION: close

<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>402</errorCode>
<errorDescription>Invalid Args</errorDescription>
</UPnPError>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
@ghost
Copy link
Author

ghost commented Apr 19, 2020

Need we update the decred's upnp code to https://gitlab.com/NebulousLabs/go-upnp/-/tree/master?
keep in sync with dcrlnd https://github.com/decred/dcrlnd/blob/master/nat/upnp.go.
The upnp function of dcrd still don't work now.

@ghost
Copy link
Author

ghost commented Jun 28, 2020

@dajohi Hi I tested https://gitlab.com/NebulousLabs/go-upnp module, It works fine. I think we need replace dcrd's upnp to this code.

root@N1Kit:~/go/src/upnp# go run upnp.go
Your external IP is: 116.xx.xx.xx

@ghost
Copy link
Author

ghost commented Aug 2, 2020

I edited the line 369 of upnp.go from
"<NewInternalClient>" + n.ourIP + "</NewInternalClient>" +
to
"<NewInternalClient>192.168.1.100</NewInternalClient>"
And rebuild dcrd, it works! [WRN] SRVR: Successfully bound via UPnP to *.*.*.*:9108
I think there is something wrong with n.ourIP

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

Successfully merging a pull request may close this issue.

1 participant