mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-23 08:00:20 +00:00
DHCPClient: Actually randomize transaction ID's (XID)
We were using unseeded rand() for the XID, which meant that our DHCP XID's were 100% predictable. Switch to using AK::get_random<u32>() instead. :^)
This commit is contained in:
parent
e928022bb3
commit
86a3363ddf
Notes:
sideshowbarker
2024-07-18 22:03:59 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/86a3363ddfa
1 changed files with 2 additions and 1 deletions
|
@ -29,6 +29,7 @@
|
|||
#include <AK/Debug.h>
|
||||
#include <AK/Endian.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/Random.h>
|
||||
#include <LibCore/SocketAddress.h>
|
||||
#include <LibCore/Timer.h>
|
||||
#include <stdio.h>
|
||||
|
@ -239,7 +240,7 @@ void DHCPv4Client::process_incoming(const DHCPv4Packet& packet)
|
|||
|
||||
void DHCPv4Client::dhcp_discover(const InterfaceDescriptor& iface, IPv4Address previous)
|
||||
{
|
||||
auto transaction_id = rand();
|
||||
auto transaction_id = get_random<u32>();
|
||||
|
||||
if constexpr (DHCPV4CLIENT_DEBUG) {
|
||||
dbgln("Trying to lease an IP for {} with ID {}", iface.m_ifname, transaction_id);
|
||||
|
|
Loading…
Reference in a new issue