From 0d077a536f134a68aaeb65b82f3925c985ea5b79 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 22 Feb 2025 22:54:31 +0100 Subject: [PATCH] Do not allow more than 10 NTP requests per second to be served Signed-off-by: DL6ER --- src/ntp/server.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ntp/server.c b/src/ntp/server.c index a78240dfc..cd882bdb0 100644 --- a/src/ntp/server.c +++ b/src/ntp/server.c @@ -42,6 +42,8 @@ #include "enums.h" // threads #include "signals.h" +// sleepms() +#include "timers.h" uint64_t ntp_last_sync = 0u; uint32_t ntp_root_delay = 0u; @@ -269,6 +271,10 @@ static void request_process_loop(const int fd, const char *ipstr, const int prot // Handle the request ntp_reply(fd, &src_addr, src_addrlen, buf, &recv_time); log_debug(DEBUG_NTP, "NTP reply sent"); + + // Sleep for 100 msec, this allows no more than 10 requests per + // second + sleepms(100); } }