diff --git a/src/core/dhcp.c b/src/core/dhcp.c index 2e578205..69337567 100644 --- a/src/core/dhcp.c +++ b/src/core/dhcp.c @@ -100,7 +100,6 @@ static void dhcp_check(struct netif *netif); static void dhcp_bind(struct netif *netif); static err_t dhcp_decline(struct netif *netif); static err_t dhcp_rebind(struct netif *netif); -static err_t dhcp_release(struct netif *netif); static void dhcp_set_state(struct dhcp *dhcp, unsigned char new_state); /** receive, unfold, parse and free incoming messages */ @@ -925,7 +924,7 @@ static err_t dhcp_rebind(struct netif *netif) * * @param netif network interface which must release its lease */ -static err_t dhcp_release(struct netif *netif) +err_t dhcp_release(struct netif *netif) { struct dhcp *dhcp = netif->dhcp; err_t result; diff --git a/src/include/lwip/dhcp.h b/src/include/lwip/dhcp.h index 6cb5cd43..bfe753f2 100644 --- a/src/include/lwip/dhcp.h +++ b/src/include/lwip/dhcp.h @@ -86,8 +86,12 @@ struct dhcp_msg PACK_STRUCT_FIELD(u8_t file[DHCP_FILE_LEN]); PACK_STRUCT_FIELD(u32_t cookie); #define DHCP_MIN_OPTIONS_LEN 68U +/** make sure user does not configure this too small */ +#if ((defined(DHCP_OPTIONS_LEN)) && (DHCP_OPTIONS_LEN < DHCP_MIN_OPTIONS_LEN)) +# undef DHCP_OPTIONS_LEN +#endif /** allow this to be configured in lwipopts.h, but not too small */ -#if ((!defined(DHCP_OPTIONS_LEN)) || (DHCP_OPTIONS_LEN < DHCP_MIN_OPTIONS_LEN)) +#if (!defined(DHCP_OPTIONS_LEN)) /** set this to be sufficient for your options in outgoing DHCP msgs */ # define DHCP_OPTIONS_LEN DHCP_MIN_OPTIONS_LEN #endif @@ -100,11 +104,13 @@ PACK_STRUCT_END /** start DHCP configuration */ err_t dhcp_start(struct netif *netif); +/** enforce early lease renewal (not needed normally)*/ +err_t dhcp_renew(struct netif *netif); +/** release the DHCP lease, usually called before dhcp_stop()*/ +err_t dhcp_release(struct netif *netif); /** stop DHCP configuration */ void dhcp_stop(struct netif *netif); -/** enforce lease renewal */ -err_t dhcp_renew(struct netif *netif); -/** inform server of our IP address */ +/** inform server of our manual IP address */ void dhcp_inform(struct netif *netif); /** if enabled, check whether the offered IP address is not in use, using ARP */