From: Denis Ovsienko Date: Wed, 20 Sep 2017 13:40:18 +0000 (+0100) Subject: NTP: Remove some duplicate output. X-Git-Tag: tcpdump-4.99-bp~1835 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/4d424411615d4757ecd4f59ae467f27c9ddfc09c NTP: Remove some duplicate output. In ntp_time_print() do not print the information already printed in ntp_print(): mode, leap indicator, version (all part of the Status header field) and length. Update the test case. --- diff --git a/print-ntp.c b/print-ntp.c index ca455b2a..bf1ee461 100644 --- a/print-ntp.c +++ b/print-ntp.c @@ -256,33 +256,9 @@ static void ntp_time_print(netdissect_options *ndo, register const struct ntp_time_data *bp, u_int length) { - int mode, version, leapind; - if (length < NTP_TIMEMSG_MINLEN) goto invalid; - ND_TCHECK(bp->status); - - version = (int)(bp->status & VERSIONMASK) >> VERSIONSHIFT; - ND_PRINT((ndo, "NTPv%d", version)); - - mode = bp->status & MODEMASK; - if (!ndo->ndo_vflag) { - ND_PRINT((ndo, ", %s, length %u", - tok2str(ntp_mode_values, "Unknown mode", mode), - length)); - return; - } - - ND_PRINT((ndo, ", length %u\n\t%s", - length, - tok2str(ntp_mode_values, "Unknown mode", mode))); - - leapind = bp->status & LEAPMASK; - ND_PRINT((ndo, ", Leap indicator: %s (%u)", - tok2str(ntp_leapind_values, "Unknown", leapind), - leapind)); - ND_TCHECK(bp->stratum); ND_PRINT((ndo, ", Stratum %u (%s)", bp->stratum, diff --git a/tests/ntp.out b/tests/ntp.out index f5a080fa..3fe26c98 100644 --- a/tests/ntp.out +++ b/tests/ntp.out @@ -1,7 +1,6 @@ IP (tos 0x0, ttl 64, id 58037, offset 0, flags [DF], proto UDP (17), length 100) 192.168.100.2.58054 > 192.168.100.1.123: NTPv4, Client, length 72 - Leap indicator: (0)NTPv4, length 72 - Client, Leap indicator: (0), Stratum 0 (unspecified), poll 0 (1s), precision 32 + Leap indicator: (0), Stratum 0 (unspecified), poll 0 (1s), precision 32 Root Delay: 0.000000, Root dispersion: 0.000000, Reference-ID: (unspec) Reference Timestamp: 0.000000000 Originator Timestamp: 0.000000000 @@ -13,8 +12,7 @@ IP (tos 0x0, ttl 64, id 58037, offset 0, flags [DF], proto UDP (17), length 100) Authentication: 57ea530f6d74350cc5286bfec1ab8ca747c73584 IP (tos 0xb8, ttl 64, id 24722, offset 0, flags [DF], proto UDP (17), length 80) 192.168.100.1.123 > 192.168.100.2.58054: NTPv4, Server, length 52 - Leap indicator: clock unsynchronized (192)NTPv4, length 52 - Server, Leap indicator: clock unsynchronized (192), Stratum 0 (unspecified), poll 3 (8s), precision -23 + Leap indicator: clock unsynchronized (192), Stratum 0 (unspecified), poll 3 (8s), precision -23 Root Delay: 0.000000, Root dispersion: 0.001373, Reference-ID: (unspec) Reference Timestamp: 0.000000000 Originator Timestamp: 2763234513.007738396 (1987-07-25T21:08:33) @@ -25,8 +23,7 @@ IP (tos 0xb8, ttl 64, id 24722, offset 0, flags [DF], proto UDP (17), length 80) Key id: 0 IP (tos 0x0, ttl 64, id 5777, offset 0, flags [DF], proto UDP (17), length 100) 192.168.100.2.42818 > 192.168.100.1.123: NTPv4, Client, length 72 - Leap indicator: (0)NTPv4, length 72 - Client, Leap indicator: (0), Stratum 0 (unspecified), poll 0 (1s), precision 32 + Leap indicator: (0), Stratum 0 (unspecified), poll 0 (1s), precision 32 Root Delay: 0.000000, Root dispersion: 0.000000, Reference-ID: (unspec) Reference Timestamp: 0.000000000 Originator Timestamp: 3706870757.473833108 (2017-06-19T14:19:17) @@ -38,8 +35,7 @@ IP (tos 0x0, ttl 64, id 5777, offset 0, flags [DF], proto UDP (17), length 100) Authentication: 8b7e640979156264f3faa5ae979656dd86502431 IP (tos 0x0, ttl 64, id 64601, offset 0, flags [DF], proto UDP (17), length 100) 192.168.100.1.123 > 192.168.100.2.42818: NTPv4, Server, length 72 - Leap indicator: (0)NTPv4, length 72 - Server, Leap indicator: (0), Stratum 2 (secondary reference), poll 0 (1s), precision -23 + Leap indicator: (0), Stratum 2 (secondary reference), poll 0 (1s), precision -23 Root Delay: 0.155502, Root dispersion: 0.001571, Reference-ID: 0x0a051b0a Reference Timestamp: 3706870757.720418353 (2017-06-19T14:19:17) Originator Timestamp: 2929527464.107565978 (1992-10-31T13:37:44) @@ -51,8 +47,7 @@ IP (tos 0x0, ttl 64, id 64601, offset 0, flags [DF], proto UDP (17), length 100) Authentication: 629990a7fc22cc8467dd88b7af2d220dbe3287d6 IP (tos 0x0, ttl 64, id 31502, offset 0, flags [DF], proto UDP (17), length 76) 192.168.100.2.53144 > 192.168.100.1.123: NTPv4, Client, length 48 - Leap indicator: clock unsynchronized (192)NTPv4, length 48 - Client, Leap indicator: clock unsynchronized (192), Stratum 0 (unspecified), poll 3 (8s), precision -6 + Leap indicator: clock unsynchronized (192), Stratum 0 (unspecified), poll 3 (8s), precision -6 Root Delay: 1.000000, Root dispersion: 1.000000, Reference-ID: (unspec) Reference Timestamp: 0.000000000 Originator Timestamp: 0.000000000 @@ -62,8 +57,7 @@ IP (tos 0x0, ttl 64, id 31502, offset 0, flags [DF], proto UDP (17), length 76) Originator - Transmit Timestamp: 3706870974.488488492 (2017-06-19T14:22:54) IP (tos 0x0, ttl 64, id 456, offset 0, flags [DF], proto UDP (17), length 76) 192.168.100.1.123 > 192.168.100.2.53144: NTPv4, Server, length 48 - Leap indicator: (0)NTPv4, length 48 - Server, Leap indicator: (0), Stratum 2 (secondary reference), poll 3 (8s), precision -23 + Leap indicator: (0), Stratum 2 (secondary reference), poll 3 (8s), precision -23 Root Delay: 0.155456, Root dispersion: 0.001007, Reference-ID: 0x0a051b0a Reference Timestamp: 3706870972.021018556 (2017-06-19T14:22:52) Originator Timestamp: 3706870974.488488492 (2017-06-19T14:22:54) @@ -73,8 +67,7 @@ IP (tos 0x0, ttl 64, id 456, offset 0, flags [DF], proto UDP (17), length 76) Originator - Transmit Timestamp: +0.000176842 IP (tos 0xc0, ttl 64, id 4575, offset 0, flags [DF], proto UDP (17), length 96) 192.168.100.2.123 > 192.168.100.1.123: NTPv4, Client, length 68 - Leap indicator: clock unsynchronized (192)NTPv4, length 68 - Client, Leap indicator: clock unsynchronized (192), Stratum 0 (unspecified), poll 6 (64s), precision -25 + Leap indicator: clock unsynchronized (192), Stratum 0 (unspecified), poll 6 (64s), precision -25 Root Delay: 0.000000, Root dispersion: 0.000000, Reference-ID: (unspec) Reference Timestamp: 0.000000000 Originator Timestamp: 0.000000000 @@ -86,8 +79,7 @@ IP (tos 0xc0, ttl 64, id 4575, offset 0, flags [DF], proto UDP (17), length 96) Authentication: d5378a09c04da845732097104348843a IP (tos 0xb8, ttl 64, id 6653, offset 0, flags [DF], proto UDP (17), length 96) 192.168.100.1.123 > 192.168.100.2.123: NTPv4, Server, length 68 - Leap indicator: (0)NTPv4, length 68 - Server, Leap indicator: (0), Stratum 2 (secondary reference), poll 6 (64s), precision -23 + Leap indicator: (0), Stratum 2 (secondary reference), poll 6 (64s), precision -23 Root Delay: 0.116577, Root dispersion: 0.001739, Reference-ID: 0x0a0ba0ee Reference Timestamp: 3706872421.265296222 (2017-06-19T14:47:01) Originator Timestamp: 3706872432.800841171 (2017-06-19T14:47:12)