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:
parent
9213d1e926
commit
6e101adc28
1 changed files with 5 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue