diff --git a/CHANGELOG b/CHANGELOG index 5fa50a18..e7b974b4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -45,6 +45,10 @@ HISTORY ++ Bug fixes: + 2007-03-06 Simon Goldschmidt + * tcpip.c: Initialize dhcp timers in tcpip_thread (if LWIP_DHCP) to protect + the stack from concurrent access. + 2007-03-06 Frédéric Bernon, Dmitry Potapov * tcpip.c, ip_frag.c, ethernetif.c: Fix some build problems, and a redundancy call to "lwip_stats.link.recv++;" in low_level_input() & ethernetif_input(). diff --git a/src/api/tcpip.c b/src/api/tcpip.c index 7c0f8d24..129f5fed 100644 --- a/src/api/tcpip.c +++ b/src/api/tcpip.c @@ -102,6 +102,24 @@ arp_timer(void *arg) sys_timeout( ARP_TMR_INTERVAL, arp_timer, NULL); } +#if LWIP_DHCP +static void +dhcp_timer_coarse(void *arg) +{ + LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip: dhcp_coarse_tmr()\n")); + dhcp_coarse_tmr(); + sys_timeout(DHCP_COARSE_TIMER_SECS*1000, dhcp_timer_coarse, NULL); +} + +static void +dhcp_timer_fine(void *arg) +{ + LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip: dhcp_fine_tmr()\n")); + dhcp_fine_tmr(); + sys_timeout(DHCP_FINE_TIMER_MSECS, dhcp_timer_fine, NULL); +} +#endif + #if ETHARP_TCPIP_ETHINPUT static void ethernet_input(struct pbuf *p, struct netif *netif) @@ -146,6 +164,10 @@ tcpip_thread(void *arg) sys_timeout( IP_TMR_INTERVAL, ip_timer, NULL); #endif sys_timeout( ARP_TMR_INTERVAL, arp_timer, NULL); +#if LWIP_DHCP + sys_timeout(DHCP_COARSE_TIMER_SECS*1000, dhcp_timer_coarse, NULL); + sys_timeout(DHCP_FINE_TIMER_MSECS, dhcp_timer_fine, NULL); +#endif if (tcpip_init_done != NULL) { tcpip_init_done(tcpip_init_done_arg);