From 86a3363ddfa4ad8c6b4b71a07383563a9669f424 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 21 Feb 2021 11:01:55 +0100 Subject: [PATCH] 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() instead. :^) --- Userland/Services/DHCPClient/DHCPv4Client.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Services/DHCPClient/DHCPv4Client.cpp b/Userland/Services/DHCPClient/DHCPv4Client.cpp index 895b1467c80..74ddb40ee49 100644 --- a/Userland/Services/DHCPClient/DHCPv4Client.cpp +++ b/Userland/Services/DHCPClient/DHCPv4Client.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -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(); if constexpr (DHCPV4CLIENT_DEBUG) { dbgln("Trying to lease an IP for {} with ID {}", iface.m_ifname, transaction_id);