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 

[PATCH] Fix for NAT-PMP rules getting expired prematurely

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



Joined: 04 Feb 2009
Posts: 4

PostPosted: Wed May 05, 2010 5:44 pm    Post subject: [PATCH] Fix for NAT-PMP rules getting expired prematurely Reply with quote

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 Wink. 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
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1497

PostPosted: Thu May 06, 2010 11:43 am    Post subject: Reply with quote

thank you for the patch !
_________________
Main miniUPnP author.
http://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
alucard3186



Joined: 05 Jun 2010
Posts: 8

PostPosted: Sat Jun 05, 2010 7:03 pm    Post subject: it work but d'ont work. Reply with quote

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
View user's profile Send private message Send e-mail
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1497

PostPosted: Wed Jun 09, 2010 10:41 am    Post subject: Re: it work but d'ont work. Reply with quote

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
View user's profile Send private message Visit poster's website
alucard3186



Joined: 05 Jun 2010
Posts: 8

PostPosted: Sat Jun 12, 2010 5:34 pm    Post subject: Reply with quote

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) Idea .
_________________
I WILL WORK
Back to top
View user's profile Send private message Send e-mail
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1497

PostPosted: Sat Jun 12, 2010 7:20 pm    Post subject: Reply with quote

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) Idea .

it's ok.
_________________
Main miniUPnP author.
http://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpd 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.