miniupnp.tuxfamily.org Forum Index miniupnp.tuxfamily.org
The forum about miniupnp and libnatpmp
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

need to remove before add ...

 
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpc Bugs
View previous topic :: View next topic  
Author Message
vesellov



Joined: 02 Nov 2010
Posts: 3

PostPosted: Tue Nov 02, 2010 12:22 pm    Post subject: need to remove before add ... Reply with quote

Hello.

I am using upnpc-static.exe to communicate with my wi-fi router WL520gc with Firmware Version:2.0.1.1 .
My python application are calling upnpc-static.exe from shell (command line).
There is a problem.
I found that sometimes I can add port mapping (using option -r ) only after delete port mapping (using option -d ). So I wrote python function "update(port)" wich scans all port mappings and search for some port to remove if "add(port)" fails.

I suspect there is some hardware protection on the router wich prevent to create too many port mappings. But I am not sure.

And I am not sure I wrote method "update(port)" correct.
Do not know where to ask.
You must know about those things more.

Tested on Linux and Windows XP.


Any ideas?
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Tue Dec 14, 2010 10:59 am    Post subject: Reply with quote

this looks like a problem specific to your router.
Do you know what is the maximum of redirection it supports ?
What is the error returned when this limit is reached ?
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
JessHessing1989
Guest





PostPosted: Fri Mar 18, 2011 6:45 pm    Post subject: Reply with quote

resolve?
Back to top
vesellov



Joined: 02 Nov 2010
Posts: 3

PostPosted: Wed Nov 23, 2011 1:54 pm    Post subject: Reply with quote

... sorry for my silence, I was working with anoter part of my project.

miniupnp wrote:
this looks like a problem specific to your router.
Do you know what is the maximum of redirection it supports ?
What is the error returned when this limit is reached ?


I was googling for some info about UPnP for my router but not found anything interesting. No info about any limits for port forwarding tables or something like this.
Asus wl520gc is very common router so it should not be a hardware error. This seems like a feature, sort of protection.

Here is my log output:

Code:
C:\work\datahaven\lib>miniupnpc-win32.exe -r 7772 TCP
upnpc : miniupnpc library test client. (c) 2006-2008 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.1:5431/dyndev/uuid:0023546b-bc70-0023-546b-bc700032a7a0
 st: urn:schemas-upnp-org:device:InternetGatewayDevice:1

Found a (not connected?) IGD : http://192.168.1.1:5431/uuid:0023546b-bc70-0023-546b-bc700232a7a0/WANPPPConnection:1
Trying to continue anyway
Local LAN ip address : 192.168.1.3
ExternalIPAddress = 91.203.188.111
GetSpecificPortMappingEntry() failed with code 714



However after I run a command ...

Code:
C:\work\datahaven\lib>miniupnpc-win32.exe -d 22 TCP
upnpc : miniupnpc library test client. (c) 2006-2008 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.1:5431/dyndev/uuid:0023546b-bc70-0023-546b-bc700032a7a0
 st: urn:schemas-upnp-org:device:InternetGatewayDevice:1

Found a (not connected?) IGD : http://192.168.1.1:5431/uuid:0023546b-bc70-0023-546b-bc700232a7a0/WANPPPConnection:1
Trying to continue anyway
Local LAN ip address : 192.168.1.3
UPNP_DeletePortMapping() returned : 0


... I can add port 7772 again:

Code:
C:\work\datahaven\lib>miniupnpc-win32.exe -r 7772 TCP
upnpc : miniupnpc library test client. (c) 2006-2008 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.1:5431/dyndev/uuid:0023546b-bc70-0023-546b-bc700032a7a0
 st: urn:schemas-upnp-org:device:InternetGatewayDevice:1

Found a (not connected?) IGD : http://192.168.1.1:5431/uuid:0023546b-bc70-0023-546b-bc700232a7a0/WANPPPConnection:1
Trying to continue anyway
Local LAN ip address : 192.168.1.3
ExternalIPAddress = 91.203.188.111
InternalIP:Port = 192.168.1.3:7772
external 91.203.188.111:7772 TCP is redirected to internal 192.168.1.3:7772



Here is a full list:


Code:
C:\work\datahaven\lib>miniupnpc-win32.exe -l
upnpc : miniupnpc library test client. (c) 2006-2008 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.1:5431/dyndev/uuid:0023546b-bc70-0023-546b-bc700032a7a0
 st: urn:schemas-upnp-org:device:InternetGatewayDevice:1

Found a (not connected?) IGD : http://192.168.1.1:5431/uuid:0023546b-bc70-0023-546b-bc700232a7a0/WANPPPConnection:1
Trying to continue anyway
Local LAN ip address : 192.168.1.3
Connection Type : IP_Routed
Status : Unconfigured, uptime=196608, LastConnectionError :
MaxBitRateDown : 100000000 bps   MaxBitRateUp 100000000 bps
ExternalIPAddress = 91.203.188.111
 0 UDP  2935->192.168.1.5:2935  'Skype UDP at 192.168.1.5:2935 (1784)' ''
 1 TCP  2935->192.168.1.5:2935  'Skype TCP at 192.168.1.5:2935 (1784)' ''
 2 UDP  6112->192.168.1.2:6112  'EA Tunnel' ''
 3 UDP 26221->192.168.1.5:26221 'Skype UDP at 192.168.1.5:26221 (1787)' ''
 4 UDP 23935->192.168.1.5:23935 'uTorrent (UDP)' ''
 5 TCP  7772->192.168.1.3:7772  'libminiupnpc' ''
 6 UDP 28093->192.168.1.8:28093 'Skype UDP at 192.168.1.8:28093 (1787)' ''
 7 UDP 47409->192.168.1.8:47409 'Skype UDP at 192.168.1.8:47409 (1612)' ''
 8 TCP 47409->192.168.1.8:47409 'Skype TCP at 192.168.1.8:47409 (1612)' ''
 9 TCP 26221->192.168.1.5:26221 'Skype TCP at 192.168.1.5:26221 (1787)' ''
10 UDP 23936->192.168.1.4:23935 'uTorrent (UDP)' ''
11 TCP 10494->192.168.1.5:10494 'uTorrent (TCP)' ''
12 UDP 10494->192.168.1.5:10494 'uTorrent (UDP)' ''
13 UDP  2936->192.168.1.9:2935  'Skype UDP at 192.168.1.9:2935 (1609)' ''
14 TCP 10495->192.168.1.8:10494 'uTorrent (TCP)' ''
15 UDP 10495->192.168.1.8:10494 'uTorrent (UDP)' ''
16 UDP 48638->192.168.1.7:48638 'Skype UDP at 192.168.1.7:48638 (1784)' ''
17 UDP 26222->192.168.1.9:26221 'Skype UDP at 192.168.1.9:26221 (1610)' ''
18 TCP 48638->192.168.1.7:48638 'Skype TCP at 192.168.1.7:48638 (1784)' ''
19 TCP  7116->192.168.1.3:7116  'libminiupnpc' ''
20 TCP 38634->192.168.1.4:38634 'Skype' ''
21 TCP  7771->192.168.1.3:7771  'libminiupnpc' ''
22 TCP  9186->192.168.1.3:9186  'libminiupnpc' ''
23 TCP 28093->192.168.1.8:28093 'Skype TCP at 192.168.1.8:28093 (1787)' ''
24 UDP  1410->192.168.1.3:1410  'Skype UDP at 192.168.1.3:1410 (1787)' ''
25 TCP 17171->192.168.1.2:17171 'libminiupnpc' ''
26 TCP  9803->192.168.1.6:9803  'libminiupnpc' ''
27 TCP  8219->192.168.1.5:8219  'libminiupnpc' ''
28 TCP  7171->192.168.1.4:7171  'libminiupnpc' ''
29 TCP 51413->192.168.1.4:51413 'Transmission at 51413' ''
30 TCP 32915->192.168.1.8:32915 'uTorrent (TCP)' ''
31 UDP 14391->192.168.1.4:14391 'uTorrent (UDP)' ''
GetGenericPortMappingEntry() returned 713 (SpecifiedArrayIndexInvalid)


Please send me some ideas if you have. I can do tests for you.
At the moment I made my software work in this way (let's say we need to configure port 7777):
1. get list off all port forwards [-l]
2. check if port 7777 is forwarded to the current IP address
3. if not - try to add port forwarding [-r 7777 TCP]
4. get list off all port forwards [-l]
5. check if port 7777 is forwarded to the current IP address
6. if not - try to remove closest value in the list (in my case it should be 7771) [-d 7771 TCP]
7. try to add port forwarding [-r 7777 TCP]
8. get list off all port forwards [-l] and finally check what we have

But this is not best algorithm of course. So I am looking for better solution.
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Wed Nov 23, 2011 5:37 pm    Post subject: Reply with quote

My guess is that your router support only 32 port mappings, but fails to return an error when the 33rd is requested...
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
vesellov



Joined: 02 Nov 2010
Posts: 3

PostPosted: Mon Nov 28, 2011 8:28 am    Post subject: Reply with quote

Hm...
I just downloaded the latest version of miniupnpc and remove all my port mappings.
And now I can add new ports with no problem.

So I made a test - start adding new ports ... more and more ...
Finally I got this message:

Quote:
C:\work\datahaven\lib>upnpc.exe -r 7791 TCP
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.1:5431/dyndev/uuid:0023546b-bc70-0023-546b-bc700032a7a0
st: urn:schemas-upnp-org:device:InternetGatewayDevice:1

Found valid IGD : http://192.168.1.1:5431/uuid:0023546b-bc70-0023-546b-bc700232a7a0/WANIPConnection:1
Local LAN ip address : 192.168.1.100
ExternalIPAddress = 10.1.1.180
GetSpecificPortMappingEntry() failed with code 714 (NoSuchEntryInArray)



And I have total 32 port maps:

Quote:
C:\work\datahaven\lib>upnpc.exe -l
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.1:5431/dyndev/uuid:0023546b-bc70-0023-546b-bc700032a7a0
st: urn:schemas-upnp-org:device:InternetGatewayDevice:1

Found valid IGD : http://192.168.1.1:5431/uuid:0023546b-bc70-0023-546b-bc700232a7a0/WANIPConnection:1
Local LAN ip address : 192.168.1.100
Connection Type : IP_Routed
Status : Connected, uptime=404s, LastConnectionError :
Time started : Mon Nov 28 12:06:04 2011
MaxBitRateDown : 100000000 bps (100.0 Mbps) MaxBitRateUp 100000000 bps (100.0 Mbps)
ExternalIPAddress = 10.1.1.180
0 TCP 7771->192.168.1.100:7771 'libminiupnpc' '' 0
1 TCP 38634->192.168.1.3:38634 'Skype' '' 0
2 UDP 38634->192.168.1.3:38634 'Skype' '' 0
3 UDP 1410->192.168.1.100:1410 'Skype UDP at 192.168.1.100:1410 (1792)' '' 0
4 TCP 1410->192.168.1.100:1410 'Skype TCP at 192.168.1.100:1410 (1792)' '' 0
5 UDP 26221->192.168.1.5:26221 'Skype UDP at 192.168.1.5:26221 (1792)' '' 0
6 UDP 28093->192.168.1.6:28093 'Skype UDP at 192.168.1.6:28093 (1791)' '' 0
7 TCP 28093->192.168.1.6:28093 'Skype TCP at 192.168.1.6:28093 (1791)' '' 0
8 TCP 26221->192.168.1.5:26221 'Skype TCP at 192.168.1.5:26221 (1792)' '' 0
9 UDP 50002->192.168.1.3:50002 'Skype UDP at 192.168.1.3:50002 (1792)' '' 0
10 TCP 50002->192.168.1.3:50002 'Skype TCP at 192.168.1.3:50002 (1792)' '' 0
11 TCP 9187->192.168.1.100:9187 'libminiupnpc' '' 0
12 UDP 47624->255.255.255.255:47624 'dplaysvr (255.255.255.255:47624) 47624 U' '' 0
13 TCP 7772->192.168.1.100:7772 'libminiupnpc' '' 0
14 TCP 7773->192.168.1.100:7773 'libminiupnpc' '' 0
15 TCP 7774->192.168.1.100:7774 'libminiupnpc' '' 0
16 TCP 7775->192.168.1.100:7775 'libminiupnpc' '' 0
17 TCP 7776->192.168.1.100:7776 'libminiupnpc' '' 0
18 TCP 7777->192.168.1.100:7777 'libminiupnpc' '' 0
19 TCP 7778->192.168.1.100:7778 'libminiupnpc' '' 0
20 TCP 7779->192.168.1.100:7779 'libminiupnpc' '' 0
21 TCP 7780->192.168.1.100:7780 'libminiupnpc' '' 0
22 TCP 7781->192.168.1.100:7781 'libminiupnpc' '' 0
23 TCP 7782->192.168.1.100:7782 'libminiupnpc' '' 0
24 TCP 7783->192.168.1.100:7783 'libminiupnpc' '' 0
25 TCP 7784->192.168.1.100:7784 'libminiupnpc' '' 0
26 TCP 7785->192.168.1.100:7785 'libminiupnpc' '' 0
27 TCP 7786->192.168.1.100:7786 'libminiupnpc' '' 0
28 TCP 7787->192.168.1.100:7787 'libminiupnpc' '' 0
29 TCP 7788->192.168.1.100:7788 'libminiupnpc' '' 0
30 TCP 7789->192.168.1.100:7789 'libminiupnpc' '' 0
31 TCP 7790->192.168.1.100:7790 'libminiupnpc' '' 0
GetGenericPortMappingEntry() returned 713 (SpecifiedArrayIndexInvalid)



So yes.
You absolutely right.
The maximum number of port maps fo my router is 32.
Thanks!


P.S.
Another thing.
Would be very good if upnpc.exe can add port maps with specific label.
At the moment all port maps have label 'libminiupnpc' '' , but my software called DataHaven.NET, so I wish to add port maps with label like this 'DataHaven.NET at IP:PORT'.
In the past I was modified your code and build it. So i added this option:

Quote:
C:\work\datahaven\p2p>miniupnpc-win32.exe
upnpc : miniupnpc library test client. (c) 2006-2008 Thomas Bernard
Go to http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
for more information.
Usage : miniupnpc-win32.exe [options] -a ip port external_port protocol
Add port redirection
miniupnpc-win32.exe [options] -d external_port protocol
Delete port redirection
miniupnpc-win32.exe [options] -s
Get Connection status
miniupnpc-win32.exe [options] -l
List redirections
miniupnpc-win32.exe [options] -r port1 protocol1 [port2 protocol2] [...]
Add all redirections to the current host

protocol is UDP or TCP
Options:
-u url : bypass discovery process by providing the XML root description url.
-m address : provide ip address of the interface to use for sending SSDP multicast packets.
-p path : use this path for MiniSSDPd socket.
-e description : set description for port mapping


Do you think this is legal?
If you do not like this, i will give up on this.
Can you add this option into your software?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpc Bugs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP
© 2007 Thomas Bernard, author of MiniUPNP.