mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 10:07:43 +00:00
DHCPClient: Send ServerIdentifier option with DHCPRequest packet
Some DHCP servers (including Mikrotik ones) will NAK the request if the ServerIdentifier option is not sent with the DHCPRequest packet.
This commit is contained in:
parent
fa18c283dc
commit
01a602cb51
1 changed files with 6 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -361,6 +361,11 @@ void DHCPv4Client::dhcp_request(DHCPv4Transaction& transaction, DHCPv4Packet con
|
|||
// set packet options
|
||||
builder.set_message_type(DHCPMessageType::DHCPRequest);
|
||||
builder.add_option(DHCPOption::RequestedIPAddress, sizeof(IPv4Address), &offer.yiaddr());
|
||||
|
||||
auto maybe_dhcp_server_ip = offer.parse_options().get<IPv4Address>(DHCPOption::ServerIdentifier);
|
||||
if (maybe_dhcp_server_ip.has_value())
|
||||
builder.add_option(DHCPOption::ServerIdentifier, sizeof(IPv4Address), &maybe_dhcp_server_ip.value());
|
||||
|
||||
auto& dhcp_packet = builder.build();
|
||||
|
||||
// broadcast the "request" request
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue