View previous topic :: View next topic |
Author |
Message |
teddy_bear
Joined: 04 Feb 2009 Posts: 4
|
Posted: Wed May 05, 2010 5:44 pm Post subject: [PATCH] Fix for NAT-PMP rules getting expired prematurely |
|
|
I noticed that my NAT-PMP rules are disappearing from time to time (version 20100308, and I believe all previous versions have the same problem), even though the application which requested the redirection is still running.
Turned out there's a small bug in CleanExpiredNATPMP() function - it doesn't check for the rule expiration time. You already have /* TODO: check desc */ comment there . Well, apparently this check is importaint since you keep the expiration time as part of the rule description. Here's what happens...
Applications don't wait until the rule is expired to renew the rule - they usually request a renewal ahead of time (i.e. the renewal is sent every 45 mins with requested life time of 1 hr). When the rule is renewed by the client application, Miniupnpd recreates the existing rule with new expiration time in the description, but the nextnatpmptoclean_timestamp variable stays unchanged. When the time stored in nextnatpmptoclean_timestamp is reached, CleanExpiredNATPMP() is called - but without the check for current rule expiration time, the same proto/port redirection will be deleted even if it's not yet expired.
Here you can find a patch that solves this problem. It implements your TODO by checking that the expiration time stored in the rule description is actually passed. Seems to be working properly after a few days of testing - no more premature expirations and disappearing rules. |
|
Back to top |
|
 |
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1518
|
|
Back to top |
|
 |
alucard3186
Joined: 05 Jun 2010 Posts: 8
|
Posted: Sat Jun 05, 2010 7:03 pm Post subject: it work but d'ont work. |
|
|
i ma running upnpc-static -a 192.198.1.3 7070 7070 TCP.
and i m running upnpc-static -l there is the result:
Found valid IGD : http : //192.168.1.1:5431/uuid:0000e0a8-60a0-00e0-20a0-484802f86
048/WANPPPConnection:1
Local LAN ip address : 192.168.1.3
Connection Type : IP_Routed
Status : Connected, uptime=49225s, LastConnectionError :
Time started : Sat Jun 05 07:12:18 2010
MaxBitRateDown : 2048000 bps MaxBitRateUp 512000 bps
ExternalIPAddress = 41.201.79.140
0 TCP 14990->192.168.1.2:14990 'uTorrent (TCP)' ''
1 UDP 54288->192.168.1.3:54288 'Teredo' ''
2 TCP 7070->192.168.1.3:7070 'libminiupnpc' ''
3 TCP 32373->192.168.1.3:32373 'uTorrent (TCP)' ''
GetGenericPortMappingEntry() returned 713 (SpecifiedArrayIndexInvalid).
then i am running a servere in 192.168.1.3 in port 7070 and whene i trying to connect whit client in 41.201.79.140:7070 the socket(primitiv connect) return socke_error(-1), but if i connect directly in 192.168.1.3:7070 it work.
can help me and tell me where is the problem. _________________ I WILL WORK |
|
Back to top |
|
 |
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1518
|
Posted: Wed Jun 09, 2010 10:41 am Post subject: Re: it work but d'ont work. |
|
|
alucard3186 wrote: | then i am running a servere in 192.168.1.3 in port 7070 and whene i trying to connect whit client in 41.201.79.140:7070 the socket(primitiv connect) return socke_error(-1), but if i connect directly in 192.168.1.3:7070 it work.
can help me and tell me where is the problem. |
You must make your test to connect to 41.201.79.140:7070 from outside your LAN. _________________ Main miniUPnP author.
http://miniupnp.tuxfamily.org/ |
|
Back to top |
|
 |
alucard3186
Joined: 05 Jun 2010 Posts: 8
|
Posted: Sat Jun 12, 2010 5:34 pm Post subject: |
|
|
yo and thanks , I am trying to connect from outside my LAN and it work.
just one remarque why it say GetGenericPortMappingEntry() returned 713 (SpecifiedArrayIndexInvalid) . _________________ I WILL WORK |
|
Back to top |
|
 |
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1518
|
Posted: Sat Jun 12, 2010 7:20 pm Post subject: |
|
|
alucard3186 wrote: | yo and thanks , I am trying to connect from outside my LAN and it work.
just one remarque why it say GetGenericPortMappingEntry() returned 713 (SpecifiedArrayIndexInvalid) . |
it's ok. _________________ Main miniUPnP author.
http://miniupnp.tuxfamily.org/ |
|
Back to top |
|
 |
|