[Git][NTPsec/ntpsec][master] TESTFRAME: Last oiece of intercept layer in place, but untested.

Eric S. Raymond gitlab at mg.gitlab.com
Tue Dec 8 05:04:45 UTC 2015


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


Commits:
642d1242 by Eric S. Raymond at 2015-12-08T00:04:28Z
TESTFRAME: Last oiece of intercept layer in place, but untested.

Tis pretty much finishes capture mode, though it's still possible
the dump format might need revision.


- - - - -


2 changed files:

- ntpd/ntp_intercept.c
- ntpd/ntp_io.c


Changes:

=====================================
ntpd/ntp_intercept.c
=====================================
--- a/ntpd/ntp_intercept.c
+++ b/ntpd/ntp_intercept.c
@@ -351,22 +351,25 @@ void intercept_sendpkt(const char *legend,
 
 void intercept_receive(struct recvbuf *rbufp)
 {
-    if (mode != replay)
-	receive(rbufp);
-
     if (mode != none) {
 	/*
-	 * Order is: cast flags, receipt time, source address, packet, length.
-	 * Cast flags are only kept because they change the ntpq display,
-	 * they have no implications for the protocol machine.
-	 * We don't dump srcadr because only the parse clock uses that.
+	 * Order is: cast flags, receipt time, interface name, source
+	 * address, packet, length.  Cast flags are only kept because
+	 * they change the ntpq display, they have no implications for
+	 * the protocol machine.  We don't dump srcadr because only
+	 * the parse clock uses that.
 	 */
-	printf("event receive %0x %s ",
-	       rbufp->cast_flags, lfptoa(&rbufp->recv_time, 10));
+	printf("event receive %0x %s %s ",
+	       rbufp->cast_flags,
+	       lfptoa(&rbufp->recv_time, 10),
+	       rbufp->dstadr->name);
 	packet_dump(&rbufp->recv_srcadr, &rbufp->recv_pkt, rbufp->recv_length);
 	fputs("\n", stdout);
     }
 
+    if (mode != replay)
+	receive(rbufp);
+
     /* FIXME: replay logic goes here */
 }
 


=====================================
ntpd/ntp_io.c
=====================================
--- a/ntpd/ntp_io.c
+++ b/ntpd/ntp_io.c
@@ -3550,7 +3550,7 @@ read_network_packet(
 	ts = fetch_timestamp(rb, &msghdr, ts);
 #endif
 	rb->recv_time = ts;
-	rb->receiver = receive;
+	rb->receiver = intercept_receive;
 
 	add_full_recv_buffer(rb);
 



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/642d12423900f2e5c93a0ce7f79c21d8ef1ccc10
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20151208/e0246c10/attachment.html>


More information about the vc mailing list