From 54801db9f06af6f6390240a6489b77649463c0cb Mon Sep 17 00:00:00 2001 From: Marcin Niestroj Date: Tue, 23 Oct 2018 15:15:31 +0200 Subject: net: dhcp: fix option 54 Option 54 (Server Identifier) is something different than SIADDR (Server IP address). Currently they are used interchangeably. This causes DHCPNAK with DHCP servers that have configured different values for each field. Create new 'dhcp_serverip' field in 'struct dhcp_result', so we treat option 54 separately. This fixes DHCP requests for servers that send two different values for SIADDR and option 54 in DHCPOFFER. Fixes: 528298b702a0 ("net: dhcp: rework") Fixes: e18cc5b7e9ce ("DHCP: fix option 54 passing") Signed-off-by: Marcin Niestroj Signed-off-by: Sascha Hauer --- net/dhcp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'net') diff --git a/net/dhcp.c b/net/dhcp.c index 984d32a93e..f41d2dd305 100644 --- a/net/dhcp.c +++ b/net/dhcp.c @@ -300,7 +300,7 @@ static void dhcp_options_handle(unsigned char option, void *popt, net_copy_uint32(&dhcp_result->leasetime, popt); break; case 54: - dhcp_result->serverip = net_read_ip(popt); + dhcp_result->dhcp_serverip = net_read_ip(popt); break; case 66: dhcp_result->tftp_server_name = xstrndup(popt, optlen); @@ -378,8 +378,8 @@ static void dhcp_send_request_packet(struct bootp *bp_offer) /* * Copy options from OFFER packet if present */ - extlen = dhcp_extended(bp->bp_vend, DHCP_REQUEST, dhcp_result->serverip, - dhcp_result->ip); + extlen = dhcp_extended(bp->bp_vend, DHCP_REQUEST, + dhcp_result->dhcp_serverip, dhcp_result->ip); debug("Transmitting DHCPREQUEST packet\n"); net_udp_send(dhcp_con, sizeof(*bp) + extlen); -- cgit v1.2.3