mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-12 19:19:30 +00:00
DHCPClient: Don't reject packets smaller than the max size
It's acceptable to have less padding in a packet, the only requirement is to have a single byte of 'END' in the DHCP fields.
This commit is contained in:
parent
c0703f48fe
commit
3440dbb1fc
Notes:
sideshowbarker
2024-07-18 22:12:11 +09:00
Author: https://github.com/alimpfard
Commit: 3440dbb1fc
Pull-request: https://github.com/SerenityOS/serenity/pull/5362
Reviewed-by: https://github.com/bugaevc
2 changed files with 8 additions and 4 deletions
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
#include "DHCPv4Client.h"
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/JsonArray.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/String.h>
|
||||
|
@ -69,7 +70,7 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv)
|
|||
|
||||
auto file = Core::File::construct("/proc/net/adapters");
|
||||
if (!file->open(Core::IODevice::ReadOnly)) {
|
||||
warnln("Error: {}", file->error_string());
|
||||
dbgln("Error: {}", file->error_string());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -77,7 +78,7 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv)
|
|||
auto json = JsonValue::from_string(file_contents);
|
||||
|
||||
if (!json.has_value() || !json.value().is_array()) {
|
||||
warnln("Error: No network adapters available");
|
||||
dbgln("Error: No network adapters available");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -90,6 +91,7 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv)
|
|||
|
||||
auto name = if_object.get("name").to_string();
|
||||
auto mac = if_object.get("mac_address").to_string();
|
||||
dbgln_if(DHCPV4_DEBUG, "Found adapter '{}' with mac {}", name, mac);
|
||||
ifnames.append({ name, mac_from_string(mac) });
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue