aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakubtomsu <66876057+jakubtomsu@users.noreply.github.com>2026-02-17 18:51:41 +0100
committerjakubtomsu <66876057+jakubtomsu@users.noreply.github.com>2026-02-17 18:51:41 +0100
commit8a7fb8bd4e85405b241be75412ca99392262d596 (patch)
treebf99bd244d20f74fa735e62f0f6dc05f50a16860
parente8aac50f8b244eed0fc872010788c19a12f8a87b (diff)
net: generate DNS ID with context.random_generator directly
-rw-r--r--core/net/dns.odin6
1 files changed, 4 insertions, 2 deletions
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