From 8a7fb8bd4e85405b241be75412ca99392262d596 Mon Sep 17 00:00:00 2001 From: jakubtomsu <66876057+jakubtomsu@users.noreply.github.com> Date: Tue, 17 Feb 2026 18:51:41 +0100 Subject: net: generate DNS ID with context.random_generator directly --- core/net/dns.odin | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/net/dns.odin b/core/net/dns.odin index 6af18798b..54cc57c38 100644 --- a/core/net/dns.odin +++ b/core/net/dns.odin @@ -25,7 +25,6 @@ package net import "base:runtime" import "core:bufio" import "core:io" -import "core:math/rand" import "core:mem" import "core:strings" import "core:time" @@ -192,7 +191,10 @@ get_dns_records_from_nameservers :: proc(hostname: string, type: DNS_Record_Type init_dns_configuration() context.allocator = allocator - id := u16be(rand.uint32()) + id: u16be + rand_ok := runtime.random_generator_read_ptr(context.random_generator, &id, size_of(id)) + assert(rand_ok, "uninitialized gen/context.random_generator") + dns_packet_buf: [DNS_PACKET_MIN_LEN]byte = --- dns_packet := make_dns_packet(dns_packet_buf[:], id, hostname, type) or_return -- cgit v1.2.3