View previous topic :: View next topic |
Author |
Message |
striner
Joined: 20 Mar 2011 Posts: 7
|
Posted: Mon Mar 21, 2011 6:33 pm Post subject: AddPortMapping failed with code 501 (Action Failed) |
|
|
Hi all,
as stated in the title, when I run MiniUPnP in Nicotine+, it gives me an error 501. Since this is my first post on this forum, I am not allowed to post any links, so please see my full story below  |
|
Back to top |
|
 |
striner
Joined: 20 Mar 2011 Posts: 7
|
Posted: Mon Mar 21, 2011 6:34 pm Post subject: |
|
|
Hi all,
I have been using Windows Soulseek for a while, and it always worked perfect with UPnP. I made a dual-boot with Ubuntu 10.10 and installed Nicotine+. I installed MiniUPnP as stated in the options menu.
From the beginning on, it gave me this error:
Code: |
19:10:26 Figuring out UPnP...
19:10:30 UPnPc binary failed, could not parse output: upnpc : miniupnpc library test client. (c) 2006-2011 Thomas Bernard
Go to http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
for more information.
List of UPNP devices found on the network :
desc: http://192.168.1.254:80/upnp/IGD.xml
st: urn:schemas-upnp-org:device:InternetGatewayDevice:1
Found valid IGD : http://192.168.1.254:80/upnp/control/igd/wanpppcInternet
Local LAN ip address : 192.168.1.91
ExternalIPAddress = 86.92.43.48
AddPortMapping(2234, 2234, 192.168.1.91) failed with code 501 (Action Failed)
GetSpecificPortMappingEntry() failed with code 714 (NoSuchEntryInArray)
19:10:30 Failed to automate port forwarding, sorry.
|
I installed Python and Pythonmodules, but it still gives me this error. I Googled for a bit, but the only related thing I found was a Nicotine+ ticket http://www.nicotine-plus.org/ticket/593
I did what they said on that website, I typed "upnpc -r 9999 9999" and it said:
Code: |
upnpc : miniupnpc library test client. (c) 2006-2011 Thomas Bernard
Go to http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
for more information.
List of UPNP devices found on the network :
desc: http://192.168.1.254:80/upnp/IGD.xml
st: urn:schemas-upnp-org:device:InternetGatewayDevice:1
Found valid IGD : http://192.168.1.254:80/upnp/control/igd/wanpppcInternet
Local LAN ip address : 192.168.1.91
invalid protocol
|
So then I tried the next statement "upnpc -r 9999 tcp" and it gave me this:
Code: |
upnpc : miniupnpc library test client. (c) 2006-2011 Thomas Bernard
Go to http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
for more information.
List of UPNP devices found on the network :
desc: http://192.168.1.254:80/upnp/IGD.xml
st: urn:schemas-upnp-org:device:InternetGatewayDevice:1
Found valid IGD : http://192.168.1.254:80/upnp/control/igd/wanpppcInternet
Local LAN ip address : 192.168.1.91
ExternalIPAddress = 86.92.43.48
AddPortMapping(9999, 9999, 192.168.1.91) failed with code 501 (Action Failed)
GetSpecificPortMappingEntry() failed with code 714 (NoSuchEntryInArray)
|
Can you tell me if I'm doing something wrong and if yes, what it is?
I have enabled UPnP on my router. I use these versions of software:
Python 2.7.1
Nicotine-plus 1.2.16
miniupnpc-1.5.20110314
If there is anything else you need to know, just ask
Many thanks in advance!
Danny |
|
Back to top |
|
 |
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1594
|
|
Back to top |
|
 |
striner
Joined: 20 Mar 2011 Posts: 7
|
Posted: Tue Mar 22, 2011 12:37 pm Post subject: |
|
|
ah yes, sorry, forgot about that one. I have a Thomson780, which is in your compatibility list if I'm correct. At least, that's what it says in big red letters at the top when I type 192.168.1.254
Also, yesterday I found out that when trying to install an HP wireless printer, it failed on me because somehow I have 2 versions of Python installed. I once installed 2.7.1 via a tarball, and HP started looking in Python 2.6 folder, which is apparently also on my system. I'm fairly new to Linux/Ubuntu, but could this maybe be the/a source of this problem? |
|
Back to top |
|
 |
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1594
|
Posted: Tue Mar 22, 2011 1:20 pm Post subject: |
|
|
I think the problem has nothing to do with python...
1st try to see if the port 9999 is not already used.
./upnpc-static -l
Then could you try to compile miniupnpc in debug mode ?
just Edit the Makefile to have CFLAGS = -O -Wall -g -DDEBUG
uncommented (and comment the "release" CFLAGS line)
and then make clean && make
Miniupnpc with then give a lot of debug output when executing
./upnpc-static -r 9999 tcp _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
 |
striner
Joined: 20 Mar 2011 Posts: 7
|
Posted: Tue Mar 22, 2011 6:30 pm Post subject: |
|
|
Hi,
first of all, thanks for your help.
I could not find the "releases" CFLAGS line in the makefile, however I did manage to uncomment the debug line.
Here is the output to "./upnpc-static -l" (a link to my public dropbox folder, a file named "log", no extension)
http://dl.dropbox.com/u/3938005/log1
And here is the output to "./unpnc-static -r 9999 tcp"
http://dl.dropbox.com/u/3938005/log3
hope this is of any help! |
|
Back to top |
|
 |
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1594
|
Posted: Tue Mar 22, 2011 7:13 pm Post subject: |
|
|
thanks a lot !
I dont see anything wrong...
Maybe we could see better if the log included the SOAP request body.
could you patch minisoap.c with the following and then "make" then "./upnpc-static -r 9999 tcp" ???
(If you dont knwo how to use the patch utility, just edit minisoap.c around line 115 and add the two printf() lines.
Code: | --- minisoap.c 11 Dec 2010 17:56:51 -0000 1.20
+++ minisoap.c 22 Mar 2011 19:10:15 -0000
@@ -112,7 +112,8 @@
printf("SOAP request : POST %s HTTP/%s - Host: %s%s\n",
url, httpversion, host, portstr);
printf("SOAPAction: \"%s\" - Content-Length: %d\n", action, bodysize);
- /*printf("%s", headerbuf);*/
+ printf("Headers :\n%s", headerbuf);
+ printf("Body :\n%s\n", body);
#endif
return httpWrite(fd, body, bodysize, headerbuf, headerssize);
}
|
_________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
 |
striner
Joined: 20 Mar 2011 Posts: 7
|
Posted: Tue Mar 22, 2011 7:34 pm Post subject: |
|
|
thanks again.
Here is the output from your requested actions
http://dl.dropbox.com/u/3938005/log4
it still fails with 501, but still don't know why. |
|
Back to top |
|
 |
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1594
|
Posted: Tue Mar 22, 2011 7:42 pm Post subject: |
|
|
thanks.
the AddPortMapping SOAP request looks ok
Headers :
POST /upnp/control/igd/wanpppcInternet HTTP/1.1
Host: 192.168.1.254
User-Agent: Ubuntu/10.10, UPnP/1.0, MiniUPnPc/1.5
Content-Length: 595
Content-Type: text/xml
SOAPAction: "urn:schemas-upnp-org:service:WANPPPConnection:1#AddPortMapping"
Connection: Close
Cache-Control: no-cache
Pragma: no-cache
Body :
<?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:WANPPPConnection:1">
<NewRemoteHost></NewRemoteHost>
<NewExternalPort>9999</NewExternalPort>
<NewProtocol>TCP</NewProtocol>
<NewInternalPort>9999</NewInternalPort>
<NewInternalClient>192.168.1.91</NewInternalClient>
<NewEnabled>1</NewEnabled>
<NewPortMappingDescription>libminiupnpc</NewPortMappingDescription>
<NewLeaseDuration>0</NewLeaseDuration>
</u:AddPortMapping>
</s:Body>
</s:Envelope> _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
 |
striner
Joined: 20 Mar 2011 Posts: 7
|
Posted: Tue Mar 22, 2011 8:21 pm Post subject: |
|
|
thwn why does it still fail with error 501 (action failed)? |
|
Back to top |
|
 |
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1594
|
Posted: Wed Mar 23, 2011 7:54 am Post subject: |
|
|
striner wrote: | thwn why does it still fail with error 501 (action failed)? |
I dont know. You should capture a SOAP request that is succeding (with another software) so we could compare and find what doesn't like your router.
It should work... _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
 |
striner
Joined: 20 Mar 2011 Posts: 7
|
Posted: Wed Mar 23, 2011 8:10 am Post subject: |
|
|
thanks a lot for helping!
I don't know exactly how SOAP works, but I have some people at my school who can help me (I study computer science after all, just not the part about web technology and stuff, more technical stuff like embedded systems).
I've solved it for now by just opening a port on my router and not using UPnP. Too bad UPnP doesn't work now, but thanks again for the help! |
|
Back to top |
|
 |
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1594
|
Posted: Wed Mar 23, 2011 9:05 am Post subject: |
|
|
If someone understand what is wrong (for this router) in the AddPortmapping Soap request I could see if I can do something.
Here is the "server" string for this thomson router :
SpeedTouch 780 7.4.5.1 UPnP/1.0 (0619JTG0K)
The strange thing is it works with other softwares, but not with miniupnpc. _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
 |
fuzzywzhe
Joined: 19 Feb 2025 Posts: 1 Location: silly con valley
|
Posted: Wed Feb 19, 2025 12:47 am Post subject: I think I know the problem, or at least I solved MY problem. |
|
|
My router's IP address is 192.168.1.1 and my machine's IP address is 192.168.1.7
I was attempting to do this:
Code: | upnpc -a 192.168.1.1 22 22 tcp
|
This returns "AddPortMapping(22, 22, 192.168.1.1) failed with code 501 (Action Failed)"
I was assuming I needed to specify the router's IP, you don't, you need to specify YOUR IP:
Code: | upnpc -a 192.168.1.7 22 22 tcp
|
The gateway's address (or router) is done through either some sort of self discovery, broadcast, or by checking the gateway.
The result of this kind of syntax is presumably you can setup a passthrough for devices other than your own, which seems like a security flaw, but whatever. UPNP isn't really that concerned about security internal to the network - not that setting up pinholes in general are any better.
A better way of doing the same thing might be:
Code: | upnpc -a `hostname -I | cut -f 1 -d " "` 22 22 tcp
|
Which will pull out your IPV4 address automatically.
That gets the IP4 address, and (if you have IPV6 enabled) removes the IPV6 portion of it, isolating your IPV4 address. IPV6 is a mess, don't bother with it, I'm talking as a network engineer - IPV6 was invented in around 1985, and it's still not global. It's not generally routeable outside of a limited network. "Global" addresses are not global, they are generally limited to your ISP, you will not be able to use it to connect to a machine across an ocean, generally. There hasn't been any advancement in IPV6 adoption since the 1980's, so ignore it and it's stupid anyhow, the number of addresses is a bit ridiculous - we should move to a combination of ATM and IPV6 and IPV4. ATM sets up a connection first, using 16 bits, it's low packet overhead but it starts with a much larger number, but it doesn't just magically re-route like IPV4 will or IPV6 is supposed to. |
|
Back to top |
|
 |
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1594
|
Posted: Thu Feb 20, 2025 8:02 am Post subject: |
|
|
Code: | @ can be used in option -a, -n, -A and -G to represent local LAN address.
|
also
Code: |
upnpc [options] -r port1 [external_port1] protocol1 [port2 [external_port2] protocol2] [...]
Add multiple port mappings to the current host
|
so instead of
Code: | upnpc -a 192.168.1.7 22 22 tcp
|
you can do either
or
Code: | upnpc -a @ 22 22 tcp
|
_________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
 |
|