fixed reload_from_lease_file()
iport and timestamp where mixed leaseduration always negative and NAT-PMP forwards with non-null timestamp always deleted
This commit is contained in:
parent
b1cc7aad36
commit
57ff044fb7
|
@ -1,4 +1,7 @@
|
||||||
$Id: Changelog.txt,v 1.260 2012/02/15 22:44:26 nanard Exp $
|
$Id: Changelog.txt,v 1.261 2012/03/05 04:41:21 nanard Exp $
|
||||||
|
|
||||||
|
2012/03/05:
|
||||||
|
fixed reload_from_lease_file().
|
||||||
|
|
||||||
2012/02/15:
|
2012/02/15:
|
||||||
Change parselanaddr() function to allow 192.168.1.1/255.255.255.0 in
|
Change parselanaddr() function to allow 192.168.1.1/255.255.255.0 in
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* $Id: upnpredirect.c,v 1.60 2011/06/22 20:34:39 nanard Exp $ */
|
/* $Id: upnpredirect.c,v 1.61 2012/03/05 04:41:22 nanard Exp $ */
|
||||||
/* MiniUPnP project
|
/* MiniUPnP project
|
||||||
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
||||||
* (c) 2006-2011 Thomas Bernard
|
* (c) 2006-2012 Thomas Bernard
|
||||||
* This software is subject to the conditions detailed
|
* This software is subject to the conditions detailed
|
||||||
* in the LICENCE file provided within the distribution */
|
* in the LICENCE file provided within the distribution */
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ int reload_from_lease_file()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
*(p++) = '\0';
|
*(p++) = '\0';
|
||||||
timestamp = (unsigned int)atoi(p);
|
iport = (unsigned short)atoi(p);
|
||||||
p = strchr(p, ':');
|
p = strchr(p, ':');
|
||||||
if(!p) {
|
if(!p) {
|
||||||
syslog(LOG_ERR, "unrecognized data in lease file");
|
syslog(LOG_ERR, "unrecognized data in lease file");
|
||||||
|
@ -207,7 +207,7 @@ int reload_from_lease_file()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
*(desc++) = '\0';
|
*(desc++) = '\0';
|
||||||
iport = (unsigned short)atoi(p);
|
timestamp = (unsigned int)atoi(p);
|
||||||
/* trim description */
|
/* trim description */
|
||||||
while(isspace(*desc))
|
while(isspace(*desc))
|
||||||
desc++;
|
desc++;
|
||||||
|
@ -222,7 +222,7 @@ int reload_from_lease_file()
|
||||||
syslog(LOG_NOTICE, "already expired lease in lease file");
|
syslog(LOG_NOTICE, "already expired lease in lease file");
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
leaseduration = current_time - timestamp;
|
leaseduration = timestamp - current_time;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
leaseduration = 0; /* default value */
|
leaseduration = 0; /* default value */
|
||||||
|
|
Loading…
Reference in New Issue