|
|
2b78f7 |
commit 63b405a67040ad6545abb102bf0714ccb5a50558
|
|
|
2b78f7 |
Author: <murray@pogo.udel.edu>
|
|
|
2b78f7 |
Date: Thu Dec 27 20:09:00 2012 -0500
|
|
|
2b78f7 |
|
|
|
2b78f7 |
ntp_util.c, ntpd.h, ChangeLog, ntp_proto.c:
|
|
|
2b78f7 |
Fix for bug 2081
|
|
|
2b78f7 |
|
|
|
2b78f7 |
diff -up ntp-4.2.6p5/include/ntpd.h.rawstats ntp-4.2.6p5/include/ntpd.h
|
|
|
2b78f7 |
--- ntp-4.2.6p5/include/ntpd.h.rawstats 2015-07-22 14:19:37.220167860 +0200
|
|
|
2b78f7 |
+++ ntp-4.2.6p5/include/ntpd.h 2015-07-22 14:20:52.819392212 +0200
|
|
|
2b78f7 |
@@ -244,7 +244,7 @@ extern void record_peer_stats (sockaddr_
|
|
|
2b78f7 |
extern void record_proto_stats (char *);
|
|
|
2b78f7 |
extern void record_loop_stats (double, double, double, double, int);
|
|
|
2b78f7 |
extern void record_clock_stats (sockaddr_u *, const char *);
|
|
|
2b78f7 |
-extern void record_raw_stats (sockaddr_u *, sockaddr_u *, l_fp *, l_fp *, l_fp *, l_fp *);
|
|
|
2b78f7 |
+extern void record_raw_stats (sockaddr_u *srcadr, sockaddr_u *dstadr, l_fp *t1, l_fp *t2, l_fp *t3, l_fp *t4, int leap, int version, int mode, int stratum, int poll, int precision, double root_delay, double root_dispersion, u_int32 refid);
|
|
|
2b78f7 |
extern u_long leap_month(u_long);
|
|
|
2b78f7 |
extern void record_crypto_stats (sockaddr_u *, const char *);
|
|
|
2b78f7 |
#ifdef DEBUG
|
|
|
2b78f7 |
diff -up ntp-4.2.6p5/ntpd/ntp_proto.c.rawstats ntp-4.2.6p5/ntpd/ntp_proto.c
|
|
|
2b78f7 |
--- ntp-4.2.6p5/ntpd/ntp_proto.c.rawstats 2015-07-22 14:19:37.218167854 +0200
|
|
|
2b78f7 |
+++ ntp-4.2.6p5/ntpd/ntp_proto.c 2015-07-22 14:19:37.221167862 +0200
|
|
|
2b78f7 |
@@ -1341,7 +1341,7 @@ process_packet(
|
|
|
2b78f7 |
double t34, t21;
|
|
|
2b78f7 |
double p_offset, p_del, p_disp;
|
|
|
2b78f7 |
l_fp p_rec, p_xmt, p_org, p_reftime, ci;
|
|
|
2b78f7 |
- u_char pmode, pleap, pstratum;
|
|
|
2b78f7 |
+ u_char pmode, pleap, pversion, pstratum;
|
|
|
2b78f7 |
char statstr[NTP_MAXSTRLEN];
|
|
|
2b78f7 |
#ifdef ASSYM
|
|
|
2b78f7 |
int itemp;
|
|
|
2b78f7 |
@@ -1359,14 +1359,17 @@ process_packet(
|
|
|
2b78f7 |
NTOHL_FP(&pkt->xmt, &p_xmt);
|
|
|
2b78f7 |
pmode = PKT_MODE(pkt->li_vn_mode);
|
|
|
2b78f7 |
pleap = PKT_LEAP(pkt->li_vn_mode);
|
|
|
2b78f7 |
+ pversion = PKT_VERSION(pkt->li_vn_mode);
|
|
|
2b78f7 |
pstratum = PKT_TO_STRATUM(pkt->stratum);
|
|
|
2b78f7 |
|
|
|
2b78f7 |
/*
|
|
|
2b78f7 |
* Capture the header values in the client/peer association..
|
|
|
2b78f7 |
*/
|
|
|
2b78f7 |
record_raw_stats(&peer->srcadr, peer->dstadr ?
|
|
|
2b78f7 |
- &peer->dstadr->sin : NULL, &p_org, &p_rec, &p_xmt,
|
|
|
2b78f7 |
- &peer->dst);
|
|
|
2b78f7 |
+ &peer->dstadr->sin : NULL,
|
|
|
2b78f7 |
+ &p_org, &p_rec, &p_xmt, &peer->dst,
|
|
|
2b78f7 |
+ pleap, pversion, pmode, pstratum, pkt->ppoll, pkt->precision,
|
|
|
2b78f7 |
+ p_del, p_disp, pkt->refid);
|
|
|
2b78f7 |
peer->leap = pleap;
|
|
|
2b78f7 |
peer->stratum = min(pstratum, STRATUM_UNSPEC);
|
|
|
2b78f7 |
peer->pmode = pmode;
|
|
|
2b78f7 |
diff -up ntp-4.2.6p5/ntpd/ntp_util.c.rawstats ntp-4.2.6p5/ntpd/ntp_util.c
|
|
|
2b78f7 |
--- ntp-4.2.6p5/ntpd/ntp_util.c.rawstats 2010-10-22 09:37:31.000000000 +0200
|
|
|
2b78f7 |
+++ ntp-4.2.6p5/ntpd/ntp_util.c 2015-07-22 14:19:37.221167862 +0200
|
|
|
2b78f7 |
@@ -707,7 +707,16 @@ record_raw_stats(
|
|
|
2b78f7 |
l_fp *t1, /* originate timestamp */
|
|
|
2b78f7 |
l_fp *t2, /* receive timestamp */
|
|
|
2b78f7 |
l_fp *t3, /* transmit timestamp */
|
|
|
2b78f7 |
- l_fp *t4 /* destination timestamp */
|
|
|
2b78f7 |
+ l_fp *t4, /* destination timestamp */
|
|
|
2b78f7 |
+ int leap,
|
|
|
2b78f7 |
+ int version,
|
|
|
2b78f7 |
+ int mode,
|
|
|
2b78f7 |
+ int stratum,
|
|
|
2b78f7 |
+ int poll,
|
|
|
2b78f7 |
+ int precision,
|
|
|
2b78f7 |
+ double root_delay, /* seconds */
|
|
|
2b78f7 |
+ double root_dispersion,/* seconds */
|
|
|
2b78f7 |
+ u_int32 refid
|
|
|
2b78f7 |
)
|
|
|
2b78f7 |
{
|
|
|
2b78f7 |
l_fp now;
|
|
|
2b78f7 |
@@ -721,10 +730,13 @@ record_raw_stats(
|
|
|
2b78f7 |
day = now.l_ui / 86400 + MJD_1900;
|
|
|
2b78f7 |
now.l_ui %= 86400;
|
|
|
2b78f7 |
if (rawstats.fp != NULL) {
|
|
|
2b78f7 |
- fprintf(rawstats.fp, "%lu %s %s %s %s %s %s %s\n", day,
|
|
|
2b78f7 |
- ulfptoa(&now, 3), stoa(srcadr), dstadr ?
|
|
|
2b78f7 |
- stoa(dstadr) : "-", ulfptoa(t1, 9), ulfptoa(t2, 9),
|
|
|
2b78f7 |
- ulfptoa(t3, 9), ulfptoa(t4, 9));
|
|
|
2b78f7 |
+ fprintf(rawstats.fp, "%lu %s %s %s %s %s %s %s %d %d %d %d %d %d %.6f %.6f %s\n",
|
|
|
2b78f7 |
+ day, ulfptoa(&now, 3),
|
|
|
2b78f7 |
+ stoa(srcadr), dstadr ? stoa(dstadr) : "-",
|
|
|
2b78f7 |
+ ulfptoa(t1, 9), ulfptoa(t2, 9),
|
|
|
2b78f7 |
+ ulfptoa(t3, 9), ulfptoa(t4, 9),
|
|
|
2b78f7 |
+ leap, version, mode, stratum, poll, precision,
|
|
|
2b78f7 |
+ root_delay, root_dispersion, refid_str(refid, stratum));
|
|
|
2b78f7 |
fflush(rawstats.fp);
|
|
|
2b78f7 |
}
|
|
|
2b78f7 |
}
|
|
|
2b78f7 |
|
|
|
2b78f7 |
commit f626c563dbf6c00c40f9d12e8200b427759ed0bf
|
|
|
2b78f7 |
Author: <davehart@shiny.ad.hartbrothers.com>
|
|
|
2b78f7 |
Date: Sat Dec 25 06:12:51 2010 +0000
|
|
|
2b78f7 |
|
|
|
2b78f7 |
Add ntpq sysinfo command, similar to ntpdc's sysinfo.
|
|
|
2b78f7 |
|
|
|
2b78f7 |
diff --git a/libntp/numtoa.c b/libntp/numtoa.c
|
|
|
2b78f7 |
index 36a7c58..0fbbab7 100644
|
|
|
2b78f7 |
--- a/libntp/numtoa.c
|
|
|
2b78f7 |
+++ b/libntp/numtoa.c
|
|
|
2b78f7 |
@@ -31,3 +31,29 @@ numtoa(
|
|
|
2b78f7 |
(u_long)netnum & 0xff);
|
|
|
2b78f7 |
return buf;
|
|
|
2b78f7 |
}
|
|
|
2b78f7 |
+
|
|
|
2b78f7 |
+
|
|
|
2b78f7 |
+/* Convert a refid & stratum to a string */
|
|
|
2b78f7 |
+const char *
|
|
|
2b78f7 |
+refid_str(
|
|
|
2b78f7 |
+ u_int32 refid,
|
|
|
2b78f7 |
+ int stratum
|
|
|
2b78f7 |
+ )
|
|
|
2b78f7 |
+{
|
|
|
2b78f7 |
+ char * text;
|
|
|
2b78f7 |
+ size_t tlen;
|
|
|
2b78f7 |
+
|
|
|
2b78f7 |
+ if (stratum > 1)
|
|
|
2b78f7 |
+ return numtoa(refid);
|
|
|
2b78f7 |
+
|
|
|
2b78f7 |
+ LIB_GETBUF(text);
|
|
|
2b78f7 |
+ text[0] = '.';
|
|
|
2b78f7 |
+ strncpy(&text[1], (void *)&refid, sizeof(refid));
|
|
|
2b78f7 |
+ text[1 + sizeof(refid)] = '\0';
|
|
|
2b78f7 |
+ tlen = strlen(text);
|
|
|
2b78f7 |
+ text[tlen] = '.';
|
|
|
2b78f7 |
+ text[tlen + 1] = '\0';
|
|
|
2b78f7 |
+
|
|
|
2b78f7 |
+ return text;
|
|
|
2b78f7 |
+}
|
|
|
2b78f7 |
+
|
|
|
2b78f7 |
diff -up ntp-4.2.6p5/include/ntp_stdlib.h.rawstats ntp-4.2.6p5/include/ntp_stdlib.h
|
|
|
2b78f7 |
--- ntp-4.2.6p5/include/ntp_stdlib.h.rawstats 2015-07-22 15:13:16.870503486 +0200
|
|
|
2b78f7 |
+++ ntp-4.2.6p5/include/ntp_stdlib.h 2015-07-22 15:14:21.893714802 +0200
|
|
|
2b78f7 |
@@ -134,6 +134,7 @@ extern char * socktohost (const sockaddr
|
|
|
2b78f7 |
extern int octtoint (const char *, u_long *);
|
|
|
2b78f7 |
extern u_long ranp2 (int);
|
|
|
2b78f7 |
extern char * refnumtoa (sockaddr_u *);
|
|
|
2b78f7 |
+extern const char *refid_str (u_int32, int);
|
|
|
2b78f7 |
extern int tsftomsu (u_long, int);
|
|
|
2b78f7 |
extern char * uinttoa (u_long);
|
|
|
2b78f7 |
|