[Git][NTPsec/ntpsec][master] nts now works with pool

Hal Murray (@hal.murray) gitlab at mg.gitlab.com
Wed Mar 25 12:10:09 UTC 2026



Hal Murray pushed to branch master at NTPsec / ntpsec


Commits:
32a950f6 by Hal Murray at 2026-03-25T05:08:51-07:00
nts now works with pool

- - - - -


5 changed files:

- NEWS.adoc
- include/ntp_dns.h
- ntpd/ntp_proto.c
- ntpd/nts_client.c
- tests/ntpd/nts_client.c


Changes:

=====================================
NEWS.adoc
=====================================
@@ -12,6 +12,8 @@ on user-visible changes.
 
 ## Repository Head
 
+  pool <serv> nts now works
+
   maxclock now skips the POOL slots when counting servers.
   This is relevant if you use "tos maxclock nn" in your config file.
   (It also skips servers with noselect on the config line.)


=====================================
include/ntp_dns.h
=====================================
@@ -6,7 +6,7 @@
 
 #include "ntp_net.h"
 
-typedef enum {DNS_good, DNS_temp, DNS_error} DNS_Status;
+typedef enum {DNS_good, DNS_NTS_pool, DNS_temp, DNS_error} DNS_Status;
 
 /* start DNS query (unless busy) */
 extern bool dns_probe(struct peer*);


=====================================
ntpd/ntp_proto.c
=====================================
@@ -2516,6 +2516,15 @@ dns_take_pool(
 	pctl.peerkey = 0;
 	peer = newpeer(rmtadr, NULL, lcladr,
 		       MODE_CLIENT, &pctl, MDF_UCAST, false);
+	if (pool->cfg.flags & FLAG_NTS) {
+	  /* pool is in NTS mode
+	     NTS info is in pool struct
+	     copy to new peer, clean out pool struct */
+	  peer->cfg.flags |= FLAG_NTS;
+	  memcpy(&peer->nts_state, &pool->nts_state, sizeof(peer->nts_state));
+	  ZERO(pool->nts_state);
+	  pool->nts_state.count = -1;
+	}
 	peer_xmit(peer);
 	if (peer->cfg.flags & FLAG_IBURST)
 	  peer->retry = NTP_RETRY;
@@ -2554,6 +2563,11 @@ void dns_take_status(struct peer* peer, DNS_Status status) {
 				/* pool: maybe need more */
 				hpoll = 8;
 			break;
+		case DNS_NTS_pool:
+			txt = "NTS-pool";
+			/* pool+NTS: only got one, maybe need more */
+			hpoll = 1;
+			break;
 		case DNS_temp:
 			/* DNS not working yet.  ??
 			 * Want to retry soon,


=====================================
ntpd/nts_client.c
=====================================
@@ -211,8 +211,13 @@ bool nts_check(struct peer *peer) {
 		msyslog(LOG_INFO, "NTSc: nts_check %s, %d", errbuf, addrOK);
 	}
 	if (addrOK) {
-		dns_take_server(peer, &sockaddr);
-		dns_take_status(peer, DNS_good);
+		if (peer->cast_flags & MDF_POOL) {
+			dns_take_pool(peer, &sockaddr);
+			dns_take_status(peer, DNS_NTS_pool);
+		} else {
+			dns_take_server(peer, &sockaddr);
+			dns_take_status(peer, DNS_good);
+		}
 	} else
 		dns_take_status(peer, DNS_error);
 	return addrOK;


=====================================
tests/ntpd/nts_client.c
=====================================
@@ -9,6 +9,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+void dns_take_pool(struct peer *a, sockaddr_u *b);
 void dns_take_server(struct peer *a, sockaddr_u *b);
 void dns_take_status(struct peer *a, DNS_Status b);
 
@@ -277,6 +278,12 @@ void setup_SIGSYS_trap(void) {
 }
 #endif
 
+void dns_take_pool(struct peer *a, sockaddr_u *b) {
+	UNUSED_ARG(a);
+	UNUSED_ARG(b);
+	return;
+}
+
 void dns_take_server(struct peer *a, sockaddr_u *b) {
 	UNUSED_ARG(a);
 	UNUSED_ARG(b);



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/32a950f65ad6fe90d04e90c597416f0377d008e0

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/32a950f65ad6fe90d04e90c597416f0377d008e0
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20260325/eb09f24c/attachment-0001.htm>


More information about the vc mailing list