Skip to content

Commit 13665c1

Browse files
lsgunthfreakyxue
authored andcommitted
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]>
1 parent 276baa3 commit 13665c1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/core/ipv4/dhcp.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,12 @@ dhcp_discover(struct netif *netif)
10571057
options_out_len = dhcp_option(options_out_len, msg_out->options, DHCP_OPTION_MAX_MSG_SIZE, DHCP_OPTION_MAX_MSG_SIZE_LEN);
10581058
options_out_len = dhcp_option_short(options_out_len, msg_out->options, DHCP_MAX_MSG_LEN(netif));
10591059

1060+
#if ESP_DHCP
1061+
#if LWIP_NETIF_HOSTNAME
1062+
options_out_len = dhcp_option_hostname(options_out_len, msg_out->options, netif);
1063+
#endif /* LWIP NETIF HOSTNAME */
1064+
#endif /* ESP_DHCP */
1065+
10601066
options_out_len = dhcp_option(options_out_len, msg_out->options, DHCP_OPTION_PARAMETER_REQUEST_LIST, LWIP_ARRAYSIZE(dhcp_discover_request_options));
10611067
for (i = 0; i < LWIP_ARRAYSIZE(dhcp_discover_request_options); i++) {
10621068
options_out_len = dhcp_option_byte(options_out_len, msg_out->options, dhcp_discover_request_options[i]);

0 commit comments

Comments
 (0)