Search code examples
chostnamedhcplwipstm32f7

Set DHCP options using LwIP in C


Where can I change the configs of the dhcp options when sending a dhcp request with the LwIP library?

I need to set option 53 (DHCP message type (discover)), 61 (client identifier), 12 (host name), 60 (vendor class identifier) and 55 (parameter request list).

I created my project with CubeMx on stm32f7.


Solution

  • Unfortunately, not all DHCP options are exposed in the lwIP API (as of lwIP 2.0.3). Option 12 can be enabled with the LWIP_NETIF_HOSTNAME define. For the others, you'll have to add support in src\core\ipv*\dhcp.c . See the dhcp_discover and the dhcp_parse_reply functions.