[Git][NTPsec/ntpsec][master] MSSNTP code doesn't need to know about NTP header structure; factor that out.

Eric S. Raymond gitlab at mg.gitlab.com
Mon Jan 28 16:50:00 UTC 2019


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
ee7677d0 by Eric S. Raymond at 2019-01-28T16:47:58Z
MSSNTP code doesn't need to know about NTP header structure; factor that out.

This is part of isol;ating out uses of the wire packet structure.

- - - - -


2 changed files:

- include/ntpd.h
- ntpd/ntp_signd.c


Changes:

=====================================
include/ntpd.h
=====================================
@@ -389,7 +389,7 @@ extern uint8_t		ntp_minpoll;
 #ifdef ENABLE_MSSNTP
 /* ntp_signd.c */
 extern void send_via_ntp_signd(struct recvbuf *, int, keyid_t, int,
-			       struct pkt *);
+			       void *);
 #endif
 
 /* ntp_timer.c */


=====================================
ntpd/ntp_signd.c
=====================================
@@ -17,6 +17,13 @@
 #include <sys/un.h>
 
 /* socket routines by tridge - from junkcode.samba.org */
+/*
+ * Dependency on NTP packet structure removed by ESR.
+ * This code now only knows about the length of an NTP packet header,
+ * not its content. Note that the signing technique never handled anything
+ * but unextended and MACless packet headers, so it can't be used with NTS. 
+ */
+
 
 /*
   connect to a unix domain socket
@@ -116,7 +123,7 @@ send_via_ntp_signd(
 	int	xmode,
 	keyid_t	xkeyid,
 	int flags,
-	struct pkt  *xpkt
+	void *xpkt
 	)
 {
 	UNUSED_ARG(flags);
@@ -144,14 +151,14 @@ send_via_ntp_signd(
 		uint32_t op;
 		uint32_t packet_id;
 		uint32_t key_id_le;
-		struct pkt pkt;
+		char pkt[LEN_PKT_NOMAC];
 	} samba_pkt;
 
 	struct samba_key_out {
 		uint32_t version;
 		uint32_t op;
 		uint32_t packet_id;
-		struct pkt pkt;
+		char pkt[LEN_PKT_NOMAC];
 	} samba_reply;
 
 	char full_socket[256];
@@ -171,7 +178,7 @@ send_via_ntp_signd(
 	 * endian on the wire, but it was read above as
 	 * network byte order */
 	samba_pkt.key_id_le = htonl(xkeyid);
-	samba_pkt.pkt = *xpkt;
+	memcpy(&samba_pkt.pkt, xpkt, sizeof(samba_pkt.pkt));
 
 	snprintf(full_socket, sizeof(full_socket), "%s/socket", ntp_signd_socket);
 



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/ee7677d0cff27c9e208cc3716db41f51bf29c1fb

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/ee7677d0cff27c9e208cc3716db41f51bf29c1fb
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20190128/4dc5bdf9/attachment-0001.html>


More information about the vc mailing list