[Git][NTPsec/ntpsec][master] Fix a reversed test that was messing up pool response handling.

Eric S. Raymond gitlab at mg.gitlab.com
Tue Jun 28 02:40:02 UTC 2016


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


Commits:
f4ae76db by Eric S. Raymond at 2016-06-27T22:38:27-04:00
Fix a reversed test that was messing up pool response handling.

- - - - -


2 changed files:

- include/recvbuff.h
- ntpd/ntp_proto.c


Changes:

=====================================
include/recvbuff.h
=====================================
--- a/include/recvbuff.h
+++ b/include/recvbuff.h
@@ -81,9 +81,9 @@ struct recvbuf {
 
 /* true for network packets, false for refclock packets */
 #ifdef REFCLOCK
-#define is_network_packet(rbufp)	((rbufp)->network_packet)
+#define is_refclock_packet(rbufp)	(!(rbufp)->network_packet)
 #else
-#define is_network_packet(rbufp)	false
+#define is_refclock_packet(rbufp)	false
 #endif /* REFCLOCK */
 
 


=====================================
ntpd/ntp_proto.c
=====================================
--- a/ntpd/ntp_proto.c
+++ b/ntpd/ntp_proto.c
@@ -420,7 +420,7 @@ receive(
 		return;				/* bogus port */
 	}
 #ifdef REFCLOCK
-	if (!is_network_packet(rbufp))
+	if (is_refclock_packet(rbufp))
 	    restrict_mask = 0;
 	else
 #endif /* REFCLOCK */
@@ -809,7 +809,7 @@ receive(
 			       peer2->maxpoll, FLAG_PREEMPT |
 			       (FLAG_IBURST & peer2->flags), MDF_UCAST |
 			       MDF_UCLNT, 0, skeyid,
-			       is_network_packet(rbufp));
+			       is_refclock_packet(rbufp));
 		if (NULL == peer) {
 			sys_declined++;
 			return;			/* ignore duplicate  */
@@ -887,7 +887,7 @@ receive(
 			    match_ep, MODE_BCLIENT, hisversion,
 			    pkt->ppoll, pkt->ppoll, FLAG_PREEMPT,
 			    MDF_BCLNT, 0, skeyid,
-			    is_network_packet(rbufp));
+			    is_refclock_packet(rbufp));
 			if (NULL == peer) {
 				sys_restricted++;
 				return;		/* ignore duplicate */
@@ -910,7 +910,7 @@ receive(
 		peer = newpeer(&rbufp->recv_srcadr, NULL, match_ep,
 		    MODE_CLIENT, hisversion, pkt->ppoll, pkt->ppoll,
 		    FLAG_BC_VOL | FLAG_IBURST | FLAG_PREEMPT, MDF_BCLNT,
-		    0, skeyid, is_network_packet(rbufp));
+		    0, skeyid, is_refclock_packet(rbufp));
 		if (NULL == peer) {
 			sys_restricted++;
 			return;			/* ignore duplicate */
@@ -994,7 +994,7 @@ receive(
 		if ((peer = newpeer(&rbufp->recv_srcadr, NULL,
 		    rbufp->dstadr, MODE_PASSIVE, hisversion, pkt->ppoll,
 				    NTP_MAXDPOLL, 0, MDF_UCAST, 0, skeyid,
-				    is_network_packet(rbufp))) == NULL) {
+				    is_refclock_packet(rbufp))) == NULL) {
 			sys_declined++;
 			return;			/* ignore duplicate */
 		}



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/f4ae76db0f29c417850247c09566c0b6e10fb882
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160628/5f75a93d/attachment.html>


More information about the vc mailing list