2

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.

MasterRem
  • 112
  • 10

1 Answers1

2

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.

Pinetwig
  • 673
  • 5
  • 13
  • 1
    I'm now able to add the options. It doesn't work very well with CubeMx because all the modifications in src\core\ipv*\dhcp.c disappear every time I regenerate the code, but I'll just copy/paste again everytime. Thank you. – MasterRem Jun 26 '18 at 14:27
  • 1
    @MasterRem I would be wary of a tool that overwrites your source files like that. I'd recommend using version control (e.g. Subversion or git) to safely manage your code development. – Craig McQueen Oct 10 '18 at 04:02