summaryrefslogtreecommitdiff
path: root/src/ot_udp.c
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2026-11-05 13:52:17 +0100
committerDirk Engling <erdgeist@erdgeist.org>2026-11-05 13:52:17 +0100
commit47293a4f116e04a88b0797bafad0c98b4393b744 (patch)
treeb71d19aa8637382a6d3b453614a6a52a2c1b3245 /src/ot_udp.c
parent9a3a01643fc78bf544a1e6f5ca5c7529e2026b25 (diff)
Clamp every elapsed time span at zero, using a set of helper functions
Diffstat (limited to 'src/ot_udp.c')
-rw-r--r--src/ot_udp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ot_udp.c b/src/ot_udp.c
index 644b71d..e67ca1f 100644
--- a/src/ot_udp.c
+++ b/src/ot_udp.c
@@ -39,12 +39,12 @@ static void udp_make_connectionid(uint32_t connid[2], const ot_ip6 remoteip, int
39 int i; 39 int i;
40 uint32_t current_key_of_the_hour; 40 uint32_t current_key_of_the_hour;
41 41
42 if (time_now_minutes() - g_hour_of_the_key >= 60) { 42 if (time_since_minutes(g_hour_of_the_key) >= 60) {
43 uint32_t old_key_of_the_hour = g_key_of_the_hour[0]; 43 uint32_t old_key_of_the_hour = g_key_of_the_hour[0];
44 uint32_t new_key_of_the_hour = random_uint32(); 44 uint32_t new_key_of_the_hour = random_uint32();
45 /* If in the meantime another thread has performed 45 /* If in the meantime another thread has performed
46 key rotation, do not overwrite their results */ 46 key rotation, do not overwrite their results */
47 if (time_now_minutes() - g_hour_of_the_key >= 60) { 47 if (time_since_minutes(g_hour_of_the_key) >= 60) {
48 /* Upgrade en bloc */ 48 /* Upgrade en bloc */
49 g_hour_of_the_key = time_now_minutes(); 49 g_hour_of_the_key = time_now_minutes();
50 g_key_of_the_hour[0] = new_key_of_the_hour; 50 g_key_of_the_hour[0] = new_key_of_the_hour;