[Git][NTPsec/ntpsec][master] Fix signedness glitches.

Eric S. Raymond gitlab at mg.gitlab.com
Fri Sep 1 02:49:25 UTC 2017


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


Commits:
48d36a61 by Eric S. Raymond at 2017-08-31T22:48:30-04:00
Fix signedness glitches.

- - - - -


3 changed files:

- include/ntp.h
- libntp/clocktime.c
- ntpd/ntp_peer.c


Changes:

=====================================
include/ntp.h
=====================================
--- a/include/ntp.h
+++ b/include/ntp.h
@@ -160,7 +160,7 @@ typedef struct __endpt {
  */
 struct peer_ctl {
 	uint8_t		version;
-	int		flags;
+	unsigned int	flags;
 	uint8_t		minpoll;
 	uint8_t		maxpoll;
 	uint32_t	ttl;
@@ -375,19 +375,19 @@ struct peer {
 /*
  * Values for peer.flags (unsigned int)
  */
-#define	FLAG_CONFIG	0x0001	/* association was configured */
-#define	FLAG_PREEMPT	0x0002	/* preemptable association */
-#define	FLAG_AUTHENTIC	0x0004	/* last message was authentic */
-#define	FLAG_REFCLOCK	0x0008	/* this is actually a reference clock */
-#define	FLAG_BC_VOL	0x0010	/* broadcast client volleying */
-#define	FLAG_PREFER	0x0020	/* prefer peer */
-#define	FLAG_BURST	0x0040	/* burst mode */
-#define	FLAG_PPS	0x0080U	/* steered by PPS */
-#define	FLAG_IBURST	0x0100	/* initial burst mode */
-#define	FLAG_NOSELECT	0x0200	/* never select */
-#define	FLAG_TRUE	0x0400	/* force truechimer */
-#define	FLAG_DNS	0x0800	/* needs DNS lookup */
-#define FLAG_TSTAMP_PPS	0x4cd000	/* PPS source provides absolute timestamp */
+#define	FLAG_CONFIG	0x0001u	/* association was configured */
+#define	FLAG_PREEMPT	0x0002u	/* preemptable association */
+#define	FLAG_AUTHENTIC	0x0004u	/* last message was authentic */
+#define	FLAG_REFCLOCK	0x0008u	/* this is actually a reference clock */
+#define	FLAG_BC_VOL	0x0010u	/* broadcast client volleying */
+#define	FLAG_PREFER	0x0020u	/* prefer peer */
+#define	FLAG_BURST	0x0040u	/* burst mode */
+#define	FLAG_PPS	0x0080u	/* steered by PPS */
+#define	FLAG_IBURST	0x0100u	/* initial burst mode */
+#define	FLAG_NOSELECT	0x0200u	/* never select */
+#define	FLAG_TRUE	0x0400u	/* force truechimer */
+#define	FLAG_DNS	0x0800u	/* needs DNS lookup */
+#define FLAG_TSTAMP_PPS	0x4cd000u	/* PPS source provides absolute timestamp */
 
 
 /*


=====================================
libntp/clocktime.c
=====================================
--- a/libntp/clocktime.c
+++ b/libntp/clocktime.c
@@ -91,7 +91,7 @@ clocktime(
 	 */
 	if (year > 1970) {
 	    *yearstart = year_to_ntp(year);
-	    return  *yearstart + tmp;
+	    return  (int32_t)*yearstart + tmp;
 	}
 
         /*


=====================================
ntpd/ntp_peer.c
=====================================
--- a/ntpd/ntp_peer.c
+++ b/ntpd/ntp_peer.c
@@ -565,8 +565,8 @@ peer_refresh_interface(
 		   "peer_refresh_interface: %s->%s mode %d vers %d poll %d %d flags 0x%x 0x%x ttl %u key %08x: new interface: ",
 		   p->dstadr == NULL ? "<null>" :
 		   socktoa(&p->dstadr->sin), socktoa(&p->srcadr), p->hmode,
-		   p->version, p->minpoll, p->maxpoll, p->cfg.flags, p->cast_flags,
-		   p->cfg.ttl, p->keyid));
+		   p->cfg.version, p->cfg.minpoll, p->cfg.maxpoll, p->cfg.flags, p->cast_flags,
+		   p->cfg.ttl, p->cfg.peerkey));
 	if (niface != NULL) {
 		DPRINT(4, (
 			   "fd=%d, bfd=%d, name=%.16s, flags=0x%x, ifindex=%u, sin=%s",



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

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/48d36a61e466c6988e0bf56b6dd8109d2fba222d
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/20170901/c510d1ec/attachment.html>


More information about the vc mailing list