[Git][NTPsec/ntpsec][master] Use REFIDLEN consistently.

Eric S. Raymond gitlab at mg.gitlab.com
Wed Oct 5 01:15:56 UTC 2016


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


Commits:
1361811c by Eric S. Raymond at 2016-10-04T21:14:26-04:00
Use REFIDLEN consistently.

- - - - -


2 changed files:

- include/ntp.h
- include/ntp_refclock.h


Changes:

=====================================
include/ntp.h
=====================================
--- a/include/ntp.h
+++ b/include/ntp.h
@@ -433,7 +433,13 @@ struct peer {
 #define CRYPTO_TO_ZERO(p)	((char *)&((p)->clear_to_zero))
 #define END_CRYPTO_TO_ZERO(p)	((char *)&((p)->end_clear_to_zero))
 #define LEN_CRYPTO_TO_ZERO	(END_CRYPTO_TO_ZERO((struct peer *)0) \
-				    - CRYPTO_TO_ZERO((struct peer *)0))
+
+/*
+ * It's ugly that refid is sometimes treated as a  uint32_t and sometimes
+ * as a string; that should be fixed. Using this in memcpy() at least
+ * contains the problem.
+ */
+#define REFIDLEN	sizeof(uint32_t)
 
 #define	LEN_PKT_NOMAC	48 /* min header length */
 
@@ -448,7 +454,7 @@ struct parsed_pkt {
         int8_t precision;
         uint32_t rootdelay;
         uint32_t rootdisp;
-        char refid[4];
+        char refid[REFIDLEN];
         uint64_t reftime;
         uint64_t org;
         uint64_t rec;


=====================================
include/ntp_refclock.h
=====================================
--- a/include/ntp_refclock.h
+++ b/include/ntp_refclock.h
@@ -113,13 +113,6 @@ struct refclockbug {
 #define GMT		0	/* I hope nobody sees this */
 #define MAXDIAL		60	/* max length of modem dial strings */
 
-/*
- * It's ugly that refid is sometimes treated as a  uint32_t and sometimes
- * as a string; that should be fixed. Using this in memcpy() at least
- * contains the problem.
- */
-#define REFIDLEN	sizeof(uint32_t)
-
 struct refclockproc {
 	void *	unitptr;	/* pointer to unit structure */
 	struct refclock * conf;	/* pointer to driver method table */



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/1361811cb2227c7a256c55fae6f72248ff73b82f
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161005/4c7fd4e5/attachment.html>


More information about the vc mailing list