diff options
| author | He Chunhui <[email protected]> | 2016-03-16 07:43:38 +0000 |
|---|---|---|
| committer | He Chunhui <[email protected]> | 2016-03-16 07:43:38 +0000 |
| commit | 54395808339868877f5d401a46ed8885fbbe74a1 (patch) | |
| tree | 50ad2904327e92a63bd99fd8022e71f84c65ed33 /components | |
| parent | e0998e3c230a16fa1a60ff14fa52590bcce16eda (diff) | |
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.
Diffstat (limited to 'components')
| -rw-r--r-- | components/net/lwip_nat/ipv4_nat.c | 4 | ||||
| -rw-r--r-- | components/net/lwip_nat/ipv4_nat.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/components/net/lwip_nat/ipv4_nat.c b/components/net/lwip_nat/ipv4_nat.c index 13c1877f2c..6f218fc1e1 100644 --- a/components/net/lwip_nat/ipv4_nat.c +++ b/components/net/lwip_nat/ipv4_nat.c @@ -229,7 +229,7 @@ nat_timer(void *arg) LWIP_DEBUGF(TIMERS_DEBUG, ("tcpip: nat_timer()\n")); 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 */ @@ -255,7 +255,7 @@ ip_nat_init(void) rt_enter_critical(); /* 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 */ rt_exit_critical(); diff --git a/components/net/lwip_nat/ipv4_nat.h b/components/net/lwip_nat/ipv4_nat.h index e369c781da..b30ed98428 100644 --- a/components/net/lwip_nat/ipv4_nat.h +++ b/components/net/lwip_nat/ipv4_nat.h @@ -67,7 +67,7 @@ #include "lwip/opt.h" /** 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 extern "C" { |
