提交 e41c6c6c 编写于 作者: B Bernard Xiong

Merge pull request #616 from hchunhui/lwip_nat-fix

fix various bugs in lwip-nat
...@@ -229,7 +229,7 @@ nat_timer(void *arg) ...@@ -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) ...@@ -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();
...@@ -370,12 +370,12 @@ ip_nat_reset_state(ip_nat_conf_t *cfg) ...@@ -370,12 +370,12 @@ ip_nat_reset_state(ip_nat_conf_t *cfg)
} }
} }
for (i = 0; i < LWIP_NAT_DEFAULT_STATE_TABLES_TCP; i++) { for (i = 0; i < LWIP_NAT_DEFAULT_STATE_TABLES_TCP; i++) {
if(ip_nat_icmp_table[i].common.cfg == cfg) { if(ip_nat_tcp_table[i].common.cfg == cfg) {
IPNAT_ENTRY_RESET(&ip_nat_tcp_table[i].common); IPNAT_ENTRY_RESET(&ip_nat_tcp_table[i].common);
} }
} }
for (i = 0; i < LWIP_NAT_DEFAULT_STATE_TABLES_UDP; i++) { for (i = 0; i < LWIP_NAT_DEFAULT_STATE_TABLES_UDP; i++) {
if(ip_nat_icmp_table[i].common.cfg == cfg) { if(ip_nat_udp_table[i].common.cfg == cfg) {
IPNAT_ENTRY_RESET(&ip_nat_udp_table[i].common); IPNAT_ENTRY_RESET(&ip_nat_udp_table[i].common);
} }
} }
...@@ -622,7 +622,7 @@ ip_nat_tmr(void) ...@@ -622,7 +622,7 @@ ip_nat_tmr(void)
} }
} }
/** Vheck if we want to perform NAT with this packet. If so, send it out on /** Check if we want to perform NAT with this packet. If so, send it out on
* the correct interface. * the correct interface.
* *
* @param p the packet to test/send * @param p the packet to test/send
......
...@@ -67,7 +67,7 @@ ...@@ -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" {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册