fix incompatible unit in LWIP_NAT_TMR_INTERVAL_SEC

LWIP_NAT_TMR_INTERVAL_SEC defined in ipv4_nat.h is in miliseconds,
but ip_nat_check_timeout() thinks it's in seconds.

With this bug, all nat entries will expire immediately when
ip_nat_check_timeout() is called.

Note sys_timeout() is in miliseconds.
This commit is contained in:
He Chunhui 2016-03-16 07:43:38 +00:00
parent e0998e3c23
commit 5439580833
2 changed files with 3 additions and 3 deletions

View File

@ -229,7 +229,7 @@ nat_timer(void *arg)
LWIP_DEBUGF(TIMERS_DEBUG, ("tcpip: nat_timer()\n")); LWIP_DEBUGF(TIMERS_DEBUG, ("tcpip: nat_timer()\n"));
ip_nat_tmr(); ip_nat_tmr();
sys_timeout(LWIP_NAT_TMR_INTERVAL_SEC, nat_timer, NULL); sys_timeout(LWIP_NAT_TMR_INTERVAL_SEC * 1000, nat_timer, NULL);
} }
/** Initialize this module */ /** Initialize this module */
@ -255,7 +255,7 @@ ip_nat_init(void)
rt_enter_critical(); rt_enter_critical();
/* add a lwip timer for NAT */ /* add a lwip timer for NAT */
sys_timeout(LWIP_NAT_TMR_INTERVAL_SEC, nat_timer, NULL); sys_timeout(LWIP_NAT_TMR_INTERVAL_SEC * 1000, nat_timer, NULL);
/* un-protect */ /* un-protect */
rt_exit_critical(); rt_exit_critical();

View File

@ -67,7 +67,7 @@
#include "lwip/opt.h" #include "lwip/opt.h"
/** Timer interval at which to call ip_nat_tmr() */ /** Timer interval at which to call ip_nat_tmr() */
#define LWIP_NAT_TMR_INTERVAL_SEC (30*1000) #define LWIP_NAT_TMR_INTERVAL_SEC (30)
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {