View previous topic :: View next topic |
Author |
Message |
ramytabet
Joined: 14 May 2007 Posts: 12
|
Posted: Mon May 14, 2007 8:29 am Post subject: UPNP_AddPortMapping fails but returns success |
|
|
Hi all,
First of all, i want to thank you guys for this library coz i have been
looking for over a month for a portable IGD upnp port forwarder
library before i came across this extra compact library WITH sample
code of how to use it.
However,
I think there is a bug in the "UPNP_AddPortMapping" function as the return
is 1 even when the port mapping has failed (for example if the port is
reserved by another PC on the LAN). After some debugging i guess that
the ParseNameValue(buffer, bufsize, &pdata) function isn't parsing
correctly but i haven't been able to know exactly where, so if anyone
knows how to fix it, plz let me know.
Thanks in advance,
ramy |
|
Back to top |
|
|
ramytabet
Joined: 14 May 2007 Posts: 12
|
Posted: Mon May 14, 2007 9:54 am Post subject: |
|
|
I forgot to add that i am using Windows XP SP2 (ICS) as IGD and
the latest version of miniupnp (RC5 - May 10th 2007).
Maybe there is a known issue with this framework ? |
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1589
|
Posted: Mon May 14, 2007 12:47 pm Post subject: Re: UPNP_AddPortMapping fails but returns success |
|
|
ramytabet wrote: | Hi all,
However,
I think there is a bug in the "UPNP_AddPortMapping" function as the return
is 1 even when the port mapping has failed (for example if the port is
reserved by another PC on the LAN). After some debugging i guess that
the ParseNameValue(buffer, bufsize, &pdata) function isn't parsing
correctly but i haven't been able to know exactly where, so if anyone
knows how to fix it, plz let me know.
|
I'm going to check this problem. |
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1589
|
Posted: Tue May 15, 2007 8:58 am Post subject: Re: UPNP_AddPortMapping fails but returns success |
|
|
miniupnp wrote: | ramytabet wrote: | Hi all,
However,
I think there is a bug in the "UPNP_AddPortMapping" function as the return
is 1 even when the port mapping has failed (for example if the port is
reserved by another PC on the LAN). After some debugging i guess that
the ParseNameValue(buffer, bufsize, &pdata) function isn't parsing
correctly but i haven't been able to know exactly where, so if anyone
knows how to fix it, plz let me know.
|
I'm going to check this problem. |
It returned 0 for me with the same test as you (port already redirected).
As I'm not using Windows as IGD, could you please post the UPnP response sent by windows to the AddPortMapping ?
You could also send me a wireshark capture of the whole UPnP communication. _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
|
ramytabet
Joined: 14 May 2007 Posts: 12
|
Posted: Tue May 15, 2007 11:37 am Post subject: |
|
|
Here is the result i got in the buffer variable after calling
simpleUPnPCommand() inside UPNP_AddPortMapping() :
//---------------------------------------------------------------------------
HTTP/1.1 500 Internal Server Error
Content-Length: 499
Content-Type: text/xml; charset="utf-8"
Server: Microsoft-Windows-NT/5.1 UPnP/1.0 UPnP-Device-Host/1.0 Microsoft-HTTPAPI/1.0
Date: Tue, 15 May 2007 11:19:31 GMT
Connection: close
<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Client</faultcode><faultstring>UPnPError</faultstring><detail><u:UPnPError xmlns:u="urn:schemas-upnp-org:control-1-0"><u:errorCode>718</u:errorCode><u:errorDescription>Action Failed</u:errorDescription></u:UPnPError></detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
//---------------------------------------------------------------------------
Clearly the error code is 718 and the description is ActionFailed.
But i just want to stress out again that the port must be reserved by
another PC on the LAN (a different ip address that the one trying
to add a port map). I am testing using TCP mode. |
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1589
|
Posted: Tue May 15, 2007 6:19 pm Post subject: |
|
|
I think I have found and fixed the bug.
Go to the download page and get new sources from the file miniupnpc-20070515.tar.gz. _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
|
ramytabet
Joined: 14 May 2007 Posts: 12
|
Posted: Wed May 16, 2007 8:16 am Post subject: |
|
|
Hi man i think u got something messed up while fixing the bug coz
the new code is not working anymore as you can see from this
screenshot
and here is the state of the variable when i was still using the previous
version:
More in details, the simpleUpnpCommand is not filling the buffer variable as
the while loop at the end of the function is not looping as i noticed.
Hope this will help your fix. |
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1589
|
Posted: Fri May 18, 2007 9:16 pm Post subject: |
|
|
The problem seems to be related to windows, everything is fine on my linux.
The error code is :
Quote: | WSAECONNABORTED (10053) Software caused connection abort.
The error can occur when the local network system aborts a connection. This would occur if WinSock aborts an established connection after data retransmission fails (receiver never acknowledges data sent on a datastream socket). |
I dont know why the the recv in the ReceiveData() function fails, I need to test under windows.
But I dont understand why it is now failing, nothing has been changed in this part of the code. |
|
Back to top |
|
|
hcg
Joined: 08 Apr 2009 Posts: 2
|
Posted: Wed Apr 08, 2009 7:11 am Post subject: my edimax br-6504n router have the same issue |
|
|
my edimax br-6504n have this issue
it return success redirected, but it didn't
my screen shows:
Code: | [localhost bin]$ ./upnpc -m 192.168.1.6 -r 8080 tcp
upnpc : miniupnpc library test client. (c) 2006-2008 Thomas Bernard
for more information.
List of UPNP devices found on the network :
desc: http://192.168.1.1:49153/gatedesc.xml
st: urn:schemas-upnp-org:device:InternetGatewayDevice:1
desc: http://192.168.1.1:49153/gatedesc.xml
st: urn:schemas-upnp-org:device:InternetGatewayDevice:1
Found valid IGD : http://192.168.1.1:49153/upnp/control/WANIPConn1
Local LAN ip address : 192.168.1.6
GetExternalIPAddress failed.
InternalIP:Port = 192.168.1.6:8080
external :8080 TCP is redirected to internal 192.168.1.6:8080 |
i use miniupnpc-1.2 |
|
Back to top |
|
|
|