core/ipv4/dhcp: Set hostname for DISCOVER packets

If the hostname is not set in the DISCOVER packet, then some servers might
issue an OFFER with that it will reject when the hostname is presented in
the REQUEST packet.

Signed-off-by: Logan Gunthorpe <[email protected]>
Signed-off-by: xueyunfei <[email protected]>
This commit is contained in:
Logan Gunthorpe
2020-03-02 10:58:13 +08:00
committed by xueyunfei
parent 276baa3ea6
commit 13665c14e1
+6
View File
@@ -1057,6 +1057,12 @@ dhcp_discover(struct netif *netif)
options_out_len = dhcp_option(options_out_len, msg_out->options, DHCP_OPTION_MAX_MSG_SIZE, DHCP_OPTION_MAX_MSG_SIZE_LEN);
options_out_len = dhcp_option_short(options_out_len, msg_out->options, DHCP_MAX_MSG_LEN(netif));
#if ESP_DHCP
#if LWIP_NETIF_HOSTNAME
options_out_len = dhcp_option_hostname(options_out_len, msg_out->options, netif);
#endif /* LWIP NETIF HOSTNAME */
#endif /* ESP_DHCP */
options_out_len = dhcp_option(options_out_len, msg_out->options, DHCP_OPTION_PARAMETER_REQUEST_LIST, LWIP_ARRAYSIZE(dhcp_discover_request_options));
for (i = 0; i < LWIP_ARRAYSIZE(dhcp_discover_request_options); i++) {
options_out_len = dhcp_option_byte(options_out_len, msg_out->options, dhcp_discover_request_options[i]);