1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 21:08:12 +00:00

DHCPClient: Handle invalid DHCP responses more gracefully

This commit is contained in:
Gunnar Beutner 2021-05-06 08:37:46 +02:00 committed by Andreas Kling
parent 9213d1e926
commit 6e101adc28

View file

@ -287,7 +287,11 @@ void DHCPv4Client::process_incoming(const DHCPv4Packet& packet)
dbgln_if(DHCPV4CLIENT_DEBUG, "Here are the options: {}", options.to_string());
auto value = options.get<DHCPMessageType>(DHCPOption::DHCPMessageType).value();
auto value_or_error = options.get<DHCPMessageType>(DHCPOption::DHCPMessageType);
if (!value_or_error.has_value())
return;
auto value = value_or_error.value();
switch (value) {
case DHCPMessageType::DHCPOffer:
handle_offer(packet, options);