From 32b1aaf280016d534ab17d3340531ae55af3c230 Mon Sep 17 00:00:00 2001 From: ronghulin Date: Wed, 9 Oct 2019 21:42:32 +0800 Subject: [PATCH] dhcp_timeout: change the timeout type u16 to u32 --- src/core/ipv4/dhcp.c | 6 +++--- src/include/lwip/dhcp.h | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/core/ipv4/dhcp.c b/src/core/ipv4/dhcp.c index 6d8c44b2..aaddd14e 100644 --- a/src/core/ipv4/dhcp.c +++ b/src/core/ipv4/dhcp.c @@ -571,7 +571,7 @@ dhcp_t1_timeout(struct netif *netif) if (((dhcp->t2_timeout - dhcp->lease_used) / 2) >= ((60 + DHCP_COARSE_TIMER_SECS / 2) / DHCP_COARSE_TIMER_SECS)) #endif { - dhcp->t1_renew_time = (u16_t)((dhcp->t2_timeout - dhcp->lease_used) / 2); + dhcp->t1_renew_time = ((dhcp->t2_timeout - dhcp->lease_used) / 2); } } } @@ -601,8 +601,8 @@ dhcp_t2_timeout(struct netif *netif) #else if (((dhcp->t0_timeout - dhcp->lease_used) / 2) >= ((60 + DHCP_COARSE_TIMER_SECS / 2) / DHCP_COARSE_TIMER_SECS)) #endif - { - dhcp->t2_rebind_time = (u16_t)((dhcp->t0_timeout - dhcp->lease_used) / 2); + { + dhcp->t2_rebind_time = ((dhcp->t0_timeout - dhcp->lease_used) / 2); } } } diff --git a/src/include/lwip/dhcp.h b/src/include/lwip/dhcp.h index c2250bda..962cc2ee 100644 --- a/src/include/lwip/dhcp.h +++ b/src/include/lwip/dhcp.h @@ -84,12 +84,21 @@ struct dhcp u8_t subnet_mask_given; u16_t request_timeout; /* #ticks with period DHCP_FINE_TIMER_SECS for request timeout */ +#if ESP_DHCP + u32_t t1_timeout; /* #ticks with period DHCP_COARSE_TIMER_SECS for renewal time */ + u32_t t2_timeout; /* #ticks with period DHCP_COARSE_TIMER_SECS for rebind time */ + u32_t t1_renew_time; /* #ticks with period DHCP_COARSE_TIMER_SECS until next renew try */ + u32_t t2_rebind_time; /* #ticks with period DHCP_COARSE_TIMER_SECS until next rebind try */ + u32_t lease_used; /* #ticks with period DHCP_COARSE_TIMER_SECS since last received DHCP ack */ + u32_t t0_timeout; /* #ticks with period DHCP_COARSE_TIMER_SECS for lease time */ +#else u16_t t1_timeout; /* #ticks with period DHCP_COARSE_TIMER_SECS for renewal time */ u16_t t2_timeout; /* #ticks with period DHCP_COARSE_TIMER_SECS for rebind time */ u16_t t1_renew_time; /* #ticks with period DHCP_COARSE_TIMER_SECS until next renew try */ u16_t t2_rebind_time; /* #ticks with period DHCP_COARSE_TIMER_SECS until next rebind try */ u16_t lease_used; /* #ticks with period DHCP_COARSE_TIMER_SECS since last received DHCP ack */ u16_t t0_timeout; /* #ticks with period DHCP_COARSE_TIMER_SECS for lease time */ +#endif ip_addr_t server_ip_addr; /* dhcp server address that offered this lease (ip_addr_t because passed to UDP) */ ip4_addr_t offered_ip_addr; ip4_addr_t offered_sn_mask;