DHCPClient: Set ServerIdentifier and RequestedAddress in DHCP REQUESTs

Some dhcp servers require these to be there - otherwise, the ack gets
dropped somewhere.
This commit is contained in:
AnotherTest 2021-02-16 14:25:46 +03:30 committed by Andreas Kling
parent ce3b24723a
commit cc889b3976
Notes: sideshowbarker 2024-07-18 22:12:03 +09:00

View file

@ -286,6 +286,8 @@ void DHCPv4Client::dhcp_request(DHCPv4Transaction& transaction, const DHCPv4Pack
// set packet options
builder.set_message_type(DHCPMessageType::DHCPRequest);
builder.add_option(DHCPOption::ServerIdentifier, sizeof(IPv4Address), &offer.siaddr());
builder.add_option(DHCPOption::RequestedIPAddress, sizeof(IPv4Address), &offer.yiaddr());
auto& dhcp_packet = builder.build();
// broadcast the "request" request