From 306171c93ba748ce6a593f9715a7fbbaac58a7bc Mon Sep 17 00:00:00 2001 From: goldsimon Date: Tue, 23 Aug 2016 15:25:39 +0200 Subject: [PATCH] DHCP: fixed compiling LWIP_DHCP_BOOTP_FILE==1 --- src/core/ipv4/dhcp.c | 7 ++++--- src/include/lwip/dhcp.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/core/ipv4/dhcp.c b/src/core/ipv4/dhcp.c index 041699d6..d9ee38ed 100644 --- a/src/core/ipv4/dhcp.c +++ b/src/core/ipv4/dhcp.c @@ -615,7 +615,7 @@ dhcp_handle_ack(struct netif *netif) #if LWIP_DHCP_BOOTP_FILE /* copy boot server address, boot file name copied in dhcp_parse_reply if not overloaded */ - ip_addr_copy(dhcp->offered_si_addr, dhcp->msg_in->siaddr); + ip4_addr_copy(dhcp->offered_si_addr, dhcp->msg_in->siaddr); #endif /* LWIP_DHCP_BOOTP_FILE */ /* subnet mask given? */ @@ -1415,14 +1415,15 @@ dhcp_option_hostname(struct dhcp *dhcp, struct netif *netif) if (netif->hostname != NULL) { size_t namelen = strlen(netif->hostname); if (namelen > 0) { - u8_t len; + size_t len; const char *p = netif->hostname; /* Shrink len to available bytes (need 2 bytes for OPTION_HOSTNAME and 1 byte for trailer) */ size_t available = DHCP_OPTIONS_LEN - dhcp->options_out_len - 3; LWIP_ASSERT("DHCP: hostname is too long!", namelen <= available); len = LWIP_MIN(namelen, available); - dhcp_option(dhcp, DHCP_OPTION_HOSTNAME, len); + LWIP_ASSERT("DHCP: hostname is too long!", len <= 0xFF); + dhcp_option(dhcp, DHCP_OPTION_HOSTNAME, (u8_t)len); while (len--) { dhcp_option_byte(dhcp, *p++); } diff --git a/src/include/lwip/dhcp.h b/src/include/lwip/dhcp.h index 220342b3..f7503280 100644 --- a/src/include/lwip/dhcp.h +++ b/src/include/lwip/dhcp.h @@ -100,7 +100,7 @@ struct dhcp u32_t offered_t1_renew; /* recommended renew time (usually 50% of lease period) */ u32_t offered_t2_rebind; /* recommended rebind time (usually 87.5 of lease period) */ #if LWIP_DHCP_BOOTP_FILE - ip_addr_t offered_si_addr; + ip4_addr_t offered_si_addr; char boot_file_name[DHCP_BOOT_FILE_LEN]; #endif /* LWIP_DHCP_BOOTPFILE */ };