epan/dissectors/pidl/ C99 drsuapi
[wireshark-sm.git] / epan / dissectors / packet-ntp.c
blobbbb4db4a29c14927f544886e16815a0e4eecfe9b
1 /* packet-ntp.c
2 * Routines for NTP packet dissection
3 * Copyright 1999, Nathan Neulinger <nneul@umr.edu>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * Copied from packet-tftp.c
11 * SPDX-License-Identifier: GPL-2.0-or-later
14 #include "config.h"
16 #include <math.h>
18 #include <epan/packet.h>
19 #include <epan/expert.h>
20 #include <epan/addr_resolv.h>
21 #include <epan/tvbparse.h>
22 #include <epan/conversation.h>
23 #include <epan/tfs.h>
24 #include <wsutil/array.h>
25 #include <wsutil/epochs.h>
27 #include "packet-ntp.h"
28 #include "packet-nts-ke.h"
30 void proto_register_ntp(void);
31 void proto_reg_handoff_ntp(void);
33 static dissector_handle_t ntp_handle;
36 * Dissecting NTP packets version 3 and 4 (RFC5905, RFC2030, RFC1769, RFC1361,
37 * RFC1305).
39 * Those packets have simple structure:
40 * 1 2 3
41 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
42 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
43 * |LI | VN |Mode | Stratum | Poll | Precision |
44 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
45 * | Root Delay |
46 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
47 * | Root Dispersion |
48 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
49 * | Reference Identifier |
50 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
51 * | Reference Timestamp (64) |
52 * | |
53 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
54 * | Originate Timestamp (64) |
55 * | |
56 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
57 * | Receive Timestamp (64) |
58 * | |
59 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
60 * | Transmit Timestamp (64) |
61 * | |
62 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
63 * | Key Identifier (optional) (32) |
64 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
65 * | Message Digest (optional) (128/160) |
66 * | |
67 * | |
68 * | |
69 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
70 * NTP timestamps are represented as a 64-bit unsigned fixed-point number,
71 * in seconds relative to 0h on 1 January 1900. The integer part is in the
72 * first 32 bits and the fraction part in the last 32 bits.
75 * NTP Control messages as defined in version 2, 3 and 4 (RFC1119, RFC1305) use
76 * the following structure:
77 * 1 2 3
78 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
79 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
80 * |00 | VN | 110 |R E M| OpCode | Sequence |
81 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
82 * | Status | Association ID |
83 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
84 * | Offset | Count |
85 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
86 * | |
87 * | Data (468 octets max) |
88 * | |
89 * | | Padding (zeros) |
90 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
91 * | Authenticator (optional) (96) |
92 * | |
93 * | |
94 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
96 * Not yet implemented: complete dissection of TPCTRL_OP_SETTRAP,
97 * NTPCTRL_OP_ASYNCMSG, NTPCTRL_OP_UNSETTRAPSETTRAP Control-Messages
101 #define UDP_PORT_NTP 123
102 #define TCP_PORT_NTP 123
104 /* Leap indicator, 2bit field is used to warn of a inserted/deleted
105 * second, or clock unsynchronized indication.
107 #define NTP_LI_MASK 0xC0
109 #define NTP_LI_NONE 0
110 #define NTP_LI_61 1
111 #define NTP_LI_59 2
112 #define NTP_LI_UNKNOWN 3
114 static const value_string li_types[] = {
115 { NTP_LI_NONE, "no warning" },
116 { NTP_LI_61, "last minute of the day has 61 seconds" },
117 { NTP_LI_59, "last minute of the day has 59 seconds" },
118 { NTP_LI_UNKNOWN, "unknown (clock unsynchronized)" },
119 { 0, NULL}
122 /* Version info, 3bit field informs about NTP version used in particular
123 * packet. According to rfc2030, version info could be only 3 or 4, but I
124 * have noticed packets with 1 or even 6 as version numbers. They are
125 * produced as a result of ntptrace command. Are those packets malformed
126 * on purpose? I don't know yet, probably some browsing through ntp sources
127 * would help. My solution is to put them as reserved for now.
129 #define NTP_VN_MASK 0x38
131 static const value_string ver_nums[] = {
132 { 0, "reserved" },
133 { 1, "NTP Version 1" },
134 { 2, "NTP Version 2" },
135 { 3, "NTP Version 3" },
136 { 4, "NTP Version 4" },
137 { 5, "reserved" },
138 { 6, "reserved" },
139 { 7, "reserved" },
140 { 0, NULL}
143 /* Mode, 3bit field representing mode of communication.
145 #define NTP_MODE_MASK 7
147 #define NTP_MODE_RSV 0
148 #define NTP_MODE_SYMACT 1
149 #define NTP_MODE_SYMPAS 2
150 #define NTP_MODE_CLIENT 3
151 #define NTP_MODE_SERVER 4
152 #define NTP_MODE_BCAST 5
153 #define NTP_MODE_CTRL 6
154 #define NTP_MODE_PRIV 7
156 static const value_string mode_types[] = {
157 { NTP_MODE_RSV, "reserved" },
158 { NTP_MODE_SYMACT, "symmetric active" },
159 { NTP_MODE_SYMPAS, "symmetric passive" },
160 { NTP_MODE_CLIENT, "client" },
161 { NTP_MODE_SERVER, "server" },
162 { NTP_MODE_BCAST, "broadcast" },
163 { NTP_MODE_CTRL, "reserved for NTP control message"},
164 { NTP_MODE_PRIV, "reserved for private use" },
165 { 0, NULL}
168 static const value_string info_mode_types[] = {
169 { NTP_MODE_RSV, "reserved" },
170 { NTP_MODE_SYMACT, "symmetric active" },
171 { NTP_MODE_SYMPAS, "symmetric passive" },
172 { NTP_MODE_CLIENT, "client" },
173 { NTP_MODE_SERVER, "server" },
174 { NTP_MODE_BCAST, "broadcast" },
175 { NTP_MODE_CTRL, "control"},
176 { NTP_MODE_PRIV, "private" },
177 { 0, NULL}
180 /* According to rfc, unspecified or invalid (stratum-0) servers should
181 * set their Reference ID (4bytes field) according to following table:
182 * https://www.iana.org/assignments/ntp-parameters/ntp-parameters.xhtml#ntp-parameters-2
184 static const struct {
185 const char *id;
186 const char *data;
187 } kod_messages[] = {
188 /* IANA / RFC 5905 */
189 { "ACST", "The association belongs to a unicast server" },
190 { "AUTH", "Server authentication failed" },
191 { "AUTO", "Autokey sequence failed" },
192 { "BCST", "The association belongs to a broadcast server" },
193 { "CRYP", "Cryptographic authentication or identification failed" },
194 { "DENY", "Access denied by remote server" },
195 { "DROP", "Lost peer in symmetric mode" },
196 { "RSTR", "Access denied due to local policy" },
197 { "INIT", "The association has not yet synchronized for the first time" },
198 { "MCST", "The association belongs to a dynamically discovered server" },
199 { "NKEY", "No key found. Either the key was never installed or is not trusted" },
200 { "NTSN", "Network Time Security (NTS) negative-acknowledgment (NAK)" },
201 { "RATE", "Rate exceeded. The server has temporarily denied access because the client exceeded the rate threshold" },
202 { "RMOT", "Alteration of association from a remote host running ntpdc." },
203 { "STEP", "A step change in system time has occurred, but the association has not yet resynchronized" },
204 { "\0\0\0\0", "NULL" },
205 { NULL, NULL}
208 /* According to rfc 4330, primary (stratum-1) servers should set
209 * their Reference ID (4bytes field) according to following table:
211 static const struct {
212 const char *id;
213 const char *data;
214 } primary_sources[] = {
215 /* Reference Identifier Codes
216 * https://www.iana.org/assignments/ntp-parameters/ntp-parameters.xhtml#ntp-parameters-1
218 { "GOES", "Geostationary Orbit Environment Satellite" },
219 { "GPS\0", "Global Position System" },
220 { "GAL\0", "Galileo Positioning System" },
221 { "PPS\0", "Generic pulse-per-second" },
222 { "IRIG", "Inter-Range Instrumentation Group" },
223 { "WWVB", "LF Radio WWVB Ft. Collins, CO 60 kHz" },
224 { "DCF\0", "LF Radio DCF77 Mainflingen, DE 77.5 kHz" },
225 { "HBG\0", "LF Radio HBG Prangins, HB 75 kHz" },
226 { "MSF\0", "LF Radio MSF Anthorn, UK 60 kHz" },
227 { "JJY\0", "LF Radio JJY Fukushima, JP 40 kHz, Saga, JP 60 kHz" },
228 { "LORC", "MF Radio LORAN C station, 100 kHz" },
229 { "TDF\0", "MF Radio Allouis, FR 162 kHz" },
230 { "CHU\0", "HF Radio CHU Ottawa, Ontario" },
231 { "WWV\0", "HF Radio WWV Ft. Collins, CO" },
232 { "WWVH", "HF Radio WWVH Kauai, HI" },
233 { "NIST", "NIST telephone modem" },
234 { "ACTS", "NIST telephone modem" },
235 { "USNO", "USNO telephone modem" },
236 { "PTB\0", "European telephone modem" },
237 { "DFM\0", "UTC(DFM)"},
239 /* Unofficial codes */
240 { "LCL\0", "uncalibrated local clock" },
241 { "LOCL", "uncalibrated local clock" },
242 { "CESM", "calibrated Cesium clock" },
243 { "RBDM", "calibrated Rubidium clock" },
244 { "OMEG", "OMEGA radionavigation system" },
245 { "DCN\0", "DCN routing protocol" },
246 { "TSP\0", "TSP time protocol" },
247 { "DTS\0", "Digital Time Service" },
248 { "ATOM", "Atomic clock (calibrated)" },
249 { "VLF\0", "VLF radio (OMEGA,, etc.)" },
250 { "DCFa", "DCF77 with amplitude modulation" },
251 { "DCFp", "DCF77 with phase modulation/pseudo random phase modulation" },
252 { "PZF\0", "DCF77 correlation receiver for middle Europe" },
253 { "PZFs", "DCF77 correlation receiver (with shared memory access)" },
254 { "PZFi", "DCF77 correlation receiver (with interrupt based access)" },
255 { "GPSD", "GPSD client driver" },
256 { "GPSs", "GPS (with shared memory access)" },
257 { "GPSi", "GPS (with interrupt based access)" },
258 { "GLNs", "GPS/GLONASS (with shared memory access)" },
259 { "GLNi", "GPS/GLONASS (with interrupt based access)" },
260 { "GNSS", "Global Navigation Satellite System" },
261 { "MRS\0", "Multi Reference System" },
262 { "Nut1", "UT1(NIST)" },
263 { "1PPS", "External 1 PPS input" },
264 { "FREE", "(Internal clock)" },
265 // { "INIT", "(Initialization)" },
266 { "\0\0\0\0", "NULL" },
267 { NULL, NULL}
271 #define NTPCTRL_R_MASK 0x80
273 #define ctrl_r_types ext_r_types
275 #define NTPCTRL_ERROR_MASK 0x40
276 #define NTPCTRL_MORE_MASK 0x20
277 #define NTPCTRL_OP_MASK 0x1f
279 #define NTPCTRL_OP_UNSPEC 0 /* unspecified */
280 #define NTPCTRL_OP_READSTAT 1 /* read status */
281 #define NTPCTRL_OP_READVAR 2 /* read variables */
282 #define NTPCTRL_OP_WRITEVAR 3 /* write variables */
283 #define NTPCTRL_OP_READCLOCK 4 /* read clock variables */
284 #define NTPCTRL_OP_WRITECLOCK 5 /* write clock variables */
285 #define NTPCTRL_OP_SETTRAP 6 /* set trap address */
286 #define NTPCTRL_OP_ASYNCMSG 7 /* asynchronous message */
287 #define NTPCTRL_OP_CONFIGURE 8 /* runtime configuration */
288 #define NTPCTRL_OP_SAVECONFIG 9 /* save config to file */
289 #define NTPCTRL_OP_READ_MRU 10 /* retrieve MRU (mrulist) */
290 #define NTPCTRL_OP_READ_ORDLIST_A 11 /* ordered list req. auth. */
291 #define NTPCTRL_OP_REQ_NONCE 12 /* request a client nonce */
292 #define NTPCTRL_OP_UNSETTRAP 31 /* unset trap */
294 static const value_string ctrl_op_types[] = {
295 { NTPCTRL_OP_UNSPEC, "reserved" },
296 { NTPCTRL_OP_READSTAT, "read status" },
297 { NTPCTRL_OP_READVAR, "read variables" },
298 { NTPCTRL_OP_WRITEVAR, "write variables" },
299 { NTPCTRL_OP_READCLOCK, "read clock variables" },
300 { NTPCTRL_OP_WRITECLOCK, "write clock variables" },
301 { NTPCTRL_OP_SETTRAP, "set trap address/port" },
302 { NTPCTRL_OP_ASYNCMSG, "asynchronous message" },
303 { NTPCTRL_OP_CONFIGURE, "runtime configuration" },
304 { NTPCTRL_OP_SAVECONFIG, "save config to file" },
305 { NTPCTRL_OP_READ_MRU, "retrieve MRU (mrulist)" },
306 { NTPCTRL_OP_READ_ORDLIST_A, "retrieve ordered list" },
307 { NTPCTRL_OP_REQ_NONCE, "request a client nonce" },
308 { NTPCTRL_OP_UNSETTRAP, "unset trap address/port" },
309 { 0, NULL}
312 #define NTPCTRL_SYSSTATUS_LI_MASK 0xC000
313 #define NTPCTRL_SYSSTATUS_CLK_MASK 0x3F00
314 #define NTPCTRL_SYSSTATUS_COUNT_MASK 0x00F0
315 #define NTPCTRL_SYSSTATUS_CODE_MASK 0x000F
317 static const value_string ctrl_sys_status_clksource_types[] = {
318 { 0, "unspecified or unknown" },
319 { 1, "Calibrated atomic clock (e.g. HP 5061)" },
320 { 2, "VLF (band 4) or LF (band 5) radio (e.g. OMEGA, WWVB)" },
321 { 3, "HF (band 7) radio (e.g. CHU, MSF, WWV/H)" },
322 { 4, "UHF (band 9) satellite (e.g. GOES, GPS)" },
323 { 5, "local net (e.g. DCN, TSP, DTS)" },
324 { 6, "UDP/NTP" },
325 { 7, "UDP/TIME" },
326 { 8, "eyeball-and-wristwatch" },
327 { 9, "telephone modem (e.g. NIST)" },
328 { 0, NULL}
331 static const value_string ctrl_sys_status_event_types[] = {
332 { 0, "unspecified" },
333 { 1, "frequency correction (drift) file not available" },
334 { 2, "frequency correction started (frequency stepped)" },
335 { 3, "spike detected and ignored, starting stepout timer" },
336 { 4, "frequency training started" },
337 { 5, "clock synchronized" },
338 { 6, "system restart" },
339 { 7, "panic stop (required step greater than panic threshold)" },
340 { 8, "no system peer" },
341 { 9, "leap second insertion/deletion armed" },
342 { 10, "leap second disarmed" },
343 { 11, "leap second inserted or deleted" },
344 { 12, "clock stepped (stepout timer expired)" },
345 { 13, "kernel loop discipline status changed" },
346 { 14, "leapseconds table loaded from file" },
347 { 15, "leapseconds table outdated, updated file needed" },
348 { 0, NULL}
351 #define NTPCTRL_PEERSTATUS_STATUS_MASK 0xF800
352 #define NTPCTRL_PEERSTATUS_CONFIG_MASK 0x8000
353 #define NTPCTRL_PEERSTATUS_AUTHENABLE_MASK 0x4000
354 #define NTPCTRL_PEERSTATUS_AUTHENTIC_MASK 0x2000
355 #define NTPCTRL_PEERSTATUS_REACH_MASK 0x1000
356 #define NTPCTRL_PEERSTATUS_BCAST_MASK 0x0800
357 #define NTPCTRL_PEERSTATUS_SEL_MASK 0x0700
358 #define NTPCTRL_PEERSTATUS_COUNT_MASK 0x00F0
359 #define NTPCTRL_PEERSTATUS_CODE_MASK 0x000F
361 static const true_false_string tfs_ctrl_peer_status_config = {"configured (peer.config)", "not configured (peer.config)" };
362 static const true_false_string tfs_ctrl_peer_status_authenable = { "authentication enabled (peer.authenable)", "authentication disabled (peer.authenable)" };
363 static const true_false_string tfs_ctrl_peer_status_authentic = { "authentication okay (peer.authentic)", "authentication not okay (peer.authentic)" };
364 static const true_false_string tfs_ctrl_peer_status_reach = {"reachability okay (peer.reach != 0)", "reachability not okay (peer.reach != 0)" };
366 static const value_string ctrl_peer_status_selection_types[] = {
367 { 0, "rejected" },
368 { 1, "passed sanity checks (tests 1 through 8 in Section 3.4.3)" },
369 { 2, "passed correctness checks (intersection algorithm in Section 4.2.1)" },
370 { 3, "passed candidate checks (if limit check implemented)" },
371 { 4, "passed outlier checks (clustering algorithm in Section 4.2.2)" },
372 { 5, "current synchronization source; max distance exceeded (if limit check implemented)" },
373 { 6, "current synchronization source; max distance okay" },
374 { 7, "reserved" },
375 { 0, NULL}
378 static const value_string ctrl_peer_status_event_types[] = {
379 { 0, "unspecified" },
380 { 1, "association mobilized" },
381 { 2, "association demobilized" },
382 { 3, "peer unreachable (peer.reach was nonzero now zero)" },
383 { 4, "peer reachable (peer.reach was zero now nonzero)" },
384 { 5, "association restarted or timed out" },
385 { 6, "no server found (ntpdate mode)" },
386 { 7, "rate exceeded (kiss code RATE)" },
387 { 8, "access denied (kiss code DENY)" },
388 { 9, "leap armed from server LI code" },
389 { 10, "become system peer" },
390 { 11, "reference clock event (see clock status word)" },
391 { 12, "authentication failure" },
392 { 13, "popcorn spike suppressor" },
393 { 14, "entering interleave mode" },
394 { 15, "interleave error (recovered)" },
395 { 0, NULL}
398 #define NTPCTRL_CLKSTATUS_STATUS_MASK 0xFF00
399 #define NTPCTRL_CLKSTATUS_CODE_MASK 0x00FF
401 static const value_string ctrl_clk_status_types[] = {
402 { 0, "clock operating within nominals" },
403 { 1, "reply timeout" },
404 { 2, "bad reply format" },
405 { 3, "hardware or software fault" },
406 { 4, "propagation failure" },
407 { 5, "bad date format or value" },
408 { 6, "bad time format or value" },
409 { 0, NULL}
412 #define NTP_CTRL_ERRSTATUS_CODE_MASK 0xFF00
414 static const value_string ctrl_err_status_types[] = {
415 { 0, "unspecified" },
416 { 1, "authentication failure" },
417 { 2, "invalid message length or format" },
418 { 3, "invalid opcode" },
419 { 4, "unknown association identifier" },
420 { 5, "unknown variable name" },
421 { 6, "invalid variable value" },
422 { 7, "administratively prohibited" },
423 { 0, NULL}
426 static const value_string err_values_types[] = {
427 { 0, "No error" },
428 { 1, "incompatible implementation number"},
429 { 2, "unimplemented request code" },
430 { 3, "format error" },
431 { 4, "no data available" },
432 { 5, "unknown" },
433 { 6, "unknown" },
434 { 7, "authentication failure"},
435 { 0, NULL}
438 #define NTPPRIV_R_MASK 0x80
440 #define NTPPRIV_MORE_MASK 0x40
442 #define NTPPRIV_AUTH_MASK 0x80
443 #define NTPPRIV_SEQ_MASK 0x7f
445 #define XNTPD_OLD 0x02
446 #define XNTPD 0x03
448 static const value_string priv_impl_types[] = {
449 { 0, "UNIV" },
450 { XNTPD_OLD, "XNTPD_OLD (pre-IPv6)" },
451 { XNTPD, "XNTPD" },
452 { 0, NULL}
455 static const value_string priv_mode7_int_action[] = {
456 { 1, "Interface exists" },
457 { 2, "Interface created" },
458 { 3, "Interface deleted" },
459 { 0, NULL}
462 #define PRIV_RC_PEER_LIST 0
463 #define PRIV_RC_PEER_LIST_SUM 1
464 #define PRIV_RC_PEER_INFO 2
465 #define PRIV_RC_PEER_STATS 3
466 #define PRIV_RC_SYS_INFO 4
467 #define PRIV_RC_SYS_STATS 5
468 #define PRIV_RC_IO_STATS 6
469 #define PRIV_RC_MEM_STATS 7
470 #define PRIV_RC_LOOP_INFO 8
471 #define PRIV_RC_TIMER_STATS 9
472 #define PRIV_RC_CONFIG 10
473 #define PRIV_RC_UNCONFIG 11
474 #define PRIV_RC_SET_SYS_FLAG 12
475 #define PRIV_RC_CLR_SYS_FLAG 13
476 #define PRIV_RC_GET_RESTRICT 16
477 #define PRIV_RC_RESADDFLAGS 17
478 #define PRIV_RC_RESSUBFLAGS 18
479 #define PRIV_RC_UNRESTRICT 19
480 #define PRIV_RC_MON_GETLIST 20
481 #define PRIV_RC_RESET_STATS 21
482 #define PRIV_RC_RESET_PEER 22
483 #define PRIV_RC_TRUSTKEY 26
484 #define PRIV_RC_UNTRUSTKEY 27
485 #define PRIV_RC_AUTHINFO 28
486 #define PRIV_RC_TRAPS 29
487 #define PRIV_RC_ADD_TRAP 30
488 #define PRIV_RC_CLR_TRAP 31
489 #define PRIV_RC_REQUEST_KEY 32
490 #define PRIV_RC_CONTROL_KEY 33
491 #define PRIV_RC_CTL_STATS 34
492 #define PRIV_RC_GET_CLOCKINFO 36
493 #define PRIV_RC_SET_CLKFUDGE 37
494 #define PRIV_RC_GET_KERNEL 38
495 #define PRIV_RC_GET_CLKBUGINFO 39
496 #define PRIV_RC_MON_GETLIST_1 42
497 #define PRIV_RC_IF_STATS 44
498 #define PRIV_RC_IF_RELOAD 45
500 static const value_string priv_rc_types[] = {
501 { PRIV_RC_PEER_LIST, "PEER_LIST" },
502 { PRIV_RC_PEER_LIST_SUM, "PEER_LIST_SUM" },
503 { PRIV_RC_PEER_INFO, "PEER_INFO" },
504 { PRIV_RC_PEER_STATS, "PEER_STATS" },
505 { PRIV_RC_SYS_INFO, "SYS_INFO" },
506 { PRIV_RC_SYS_STATS, "SYS_STATS" },
507 { PRIV_RC_IO_STATS, "IO_STATS" },
508 { PRIV_RC_MEM_STATS, "MEM_STATS" },
509 { PRIV_RC_LOOP_INFO, "LOOP_INFO" },
510 { PRIV_RC_TIMER_STATS, "TIMER_STATS" },
511 { PRIV_RC_CONFIG, "CONFIG" },
512 { PRIV_RC_UNCONFIG, "UNCONFIG" },
513 { PRIV_RC_SET_SYS_FLAG, "SET_SYS_FLAG" },
514 { PRIV_RC_CLR_SYS_FLAG, "CLR_SYS_FLAG" },
515 { 14, "MONITOR" },
516 { 15, "NOMONITOR" },
517 { PRIV_RC_GET_RESTRICT, "GET_RESTRICT" },
518 { PRIV_RC_RESADDFLAGS, "RESADDFLAGS" },
519 { PRIV_RC_RESSUBFLAGS, "RESSUBFLAGS" },
520 { PRIV_RC_UNRESTRICT, "UNRESTRICT" },
521 { PRIV_RC_MON_GETLIST, "MON_GETLIST" },
522 { PRIV_RC_RESET_STATS, "RESET_STATS" },
523 { PRIV_RC_RESET_PEER, "RESET_PEER" },
524 { 23, "REREAD_KEYS" },
525 { 24, "DO_DIRTY_HACK" },
526 { 25, "DONT_DIRTY_HACK" },
527 { PRIV_RC_TRUSTKEY, "TRUSTKEY" },
528 { PRIV_RC_UNTRUSTKEY, "UNTRUSTKEY" },
529 { PRIV_RC_AUTHINFO, "AUTHINFO" },
530 { PRIV_RC_TRAPS, "TRAPS" },
531 { PRIV_RC_ADD_TRAP, "ADD_TRAP" },
532 { PRIV_RC_CLR_TRAP, "CLR_TRAP" },
533 { PRIV_RC_REQUEST_KEY, "REQUEST_KEY" },
534 { PRIV_RC_CONTROL_KEY, "CONTROL_KEY" },
535 { PRIV_RC_CTL_STATS, "GET_CTLSTATS" },
536 { 35, "GET_LEAPINFO" },
537 { PRIV_RC_GET_CLOCKINFO, "GET_CLOCKINFO" },
538 { PRIV_RC_SET_CLKFUDGE, "SET_CLKFUDGE" },
539 { PRIV_RC_GET_KERNEL, "GET_KERNEL" },
540 { PRIV_RC_GET_CLKBUGINFO, "GET_CLKBUGINFO" },
541 { 40, "UNASSIGNED" }, /* included to allow direct lookup */
542 { 41, "SET_PRECISION" },
543 { PRIV_RC_MON_GETLIST_1, "MON_GETLIST_1" },
544 { 43, "HOSTNAME_ASSOCID" },
545 { PRIV_RC_IF_STATS, "IF_STATS" },
546 { PRIV_RC_IF_RELOAD, "IF_RELOAD" },
547 { 0, NULL}
549 static value_string_ext priv_rc_types_ext = VALUE_STRING_EXT_INIT(priv_rc_types);
551 #define PRIV_INFO_FLAG_CONFIG 0x1
552 #define PRIV_INFO_FLAG_SYSPEER 0x2
553 #define PRIV_INFO_FLAG_BURST 0x4
554 #define PRIV_INFO_FLAG_REFCLOCK 0x8
555 #define PRIV_INFO_FLAG_PREFER 0x10
556 #define PRIV_INFO_FLAG_AUTHENABLE 0x20
557 #define PRIV_INFO_FLAG_SEL_CANDIDATE 0x40
558 #define PRIV_INFO_FLAG_SHORTLIST 0x80
559 /* XXX PRIV_INFO_FLAG_IBURST is unused, is a field needed? */
560 #define PRIV_INFO_FLAG_IBURST 0x100
562 #define PRIV_CONF_FLAG_AUTHENABLE 0x01
563 #define PRIV_CONF_FLAG_PREFER 0x02
564 #define PRIV_CONF_FLAG_BURST 0x04
565 #define PRIV_CONF_FLAG_IBURST 0x08
566 #define PRIV_CONF_FLAG_NOSELECT 0x10
567 #define PRIV_CONF_FLAG_SKEY 0x20
569 #define PRIV_SYS_FLAG_BCLIENT 0x01
570 #define PRIV_SYS_FLAG_PPS 0x02
571 #define PRIV_SYS_FLAG_NTP 0x04
572 #define PRIV_SYS_FLAG_KERNEL 0x08
573 #define PRIV_SYS_FLAG_MONITOR 0x10
574 #define PRIV_SYS_FLAG_FILEGEN 0x20
575 #define PRIV_SYS_FLAG_AUTH 0x40
576 #define PRIV_SYS_FLAG_CAL 0x80
578 #define PRIV_RESET_FLAG_ALLPEERS 0x00000001
579 #define PRIV_RESET_FLAG_IO 0x00000002
580 #define PRIV_RESET_FLAG_SYS 0x00000004
581 #define PRIV_RESET_FLAG_MEM 0x00000008
582 #define PRIV_RESET_FLAG_TIMER 0x00000010
583 #define PRIV_RESET_FLAG_AUTH 0x00000020
584 #define PRIV_RESET_FLAG_CTL 0x00000040
586 static const range_string stratum_rvals[] = {
587 { 0, 0, "unspecified or invalid" },
588 { 1, 1, "primary reference" },
589 { 2, 15, "secondary reference" },
590 { 16, 16, "unsynchronized" },
591 { 17, 255, "reserved" },
592 { 0, 0, NULL }
595 #define NTP_MD5_ALGO 0
596 #define NTP_SHA_ALGO 1
598 static const value_string authentication_types[] = {
599 { NTP_MD5_ALGO, "MD5" },
600 { NTP_SHA_ALGO, "SHA" },
601 { 0, NULL}
605 * NTP Extension Field Types.
606 * https://www.iana.org/assignments/ntp-parameters/ntp-parameters.xhtml#ntp-parameters-3
608 static const value_string ntp_ext_field_types[] = {
609 { 0x0002, "No-Operation Request" },
610 { 0x0102, "Association Message Request" },
611 { 0x0104, "Unique Identifier" },
612 { 0x0202, "Certificate Message Request" },
613 { 0x0204, "NTS Cookie" },
614 { 0x0302, "Cookie Message Request" },
615 { 0x0304, "NTS Cookie Placeholder" },
616 { 0x0402, "Autokey Message Request" },
617 { 0x0404, "NTS Authenticator and Encrypted Extension Fields" },
618 { 0x0502, "Leapseconds Message Request" },
619 { 0x0602, "Sign Message Request" },
620 { 0x0702, "IFF Identity Message Request" },
621 { 0x0802, "GQ Identity Message Request" },
622 { 0x0902, "MV Identity Message Request" },
623 { 0x2005, "Checksum Complement" },
624 { 0x8002, "No-Operation Response" },
625 { 0x8102, "Association Message Response" },
626 { 0x8202, "Certificate Message Response" },
627 { 0x8302, "Cookie Message Response" },
628 { 0x8402, "Autokey Message Response" },
629 { 0x8502, "Leapseconds Message Response" },
630 { 0x8602, "Sign Message Response" },
631 { 0x8702, "IFF Identity Message Response" },
632 { 0x8802, "GQ Identity Message Response" },
633 { 0x8902, "MV Identity Message Response" },
634 { 0xC002, "No-Operation Error Response" },
635 { 0xC102, "Association Message Error Response" },
636 { 0xC202, "Certificate Message Error Response" },
637 { 0xC302, "Cookie Message Error Response" },
638 { 0xC402, "Autokey Message Error Response" },
639 { 0xC502, "Leapseconds Message Error Response" },
640 { 0xC602, "Sign Message Error Response" },
641 { 0xC702, "IFF Identity Message Error Response" },
642 { 0xC802, "GQ Identity Message Error Response" },
643 { 0xC902, "MV Identity Message Error Response" },
644 { 0xF323, "Monotonic Timestamp & Root Delay/Dispersion (exp)" },
645 { 0xF324, "Network PTP Time correction (exp)" },
646 { 0, NULL }
650 typedef struct {
651 uint32_t req_frame;
652 uint32_t resp_frame;
653 nstime_t req_time;
654 uint32_t seq;
655 } ntp_trans_info_t;
657 typedef struct {
658 wmem_tree_t *trans;
659 } ntp_conv_info_t;
662 static int proto_ntp;
664 static int hf_ntp_flags;
665 static int hf_ntp_flags_li;
666 static int hf_ntp_flags_vn;
667 static int hf_ntp_flags_mode;
668 static int hf_ntp_stratum;
669 static int hf_ntp_ppoll;
670 static int hf_ntp_precision;
671 static int hf_ntp_rootdelay;
672 static int hf_ntp_rootdispersion;
673 static int hf_ntp_refid;
674 static int hf_ntp_reftime;
675 static int hf_ntp_org;
676 static int hf_ntp_rec;
677 static int hf_ntp_xmt;
678 static int hf_ntp_keyid;
679 static int hf_ntp_mac;
680 static int hf_ntp_padding;
681 static int hf_ntp_key_type;
682 static int hf_ntp_key_index;
683 static int hf_ntp_key_signature;
684 static int hf_ntp_response_in;
685 static int hf_ntp_request_in;
686 static int hf_ntp_delta_time;
688 static int hf_ntp_ext;
689 static int hf_ntp_ext_type;
690 static int hf_ntp_ext_length;
691 static int hf_ntp_ext_value;
693 static int hf_ntp_ext_nts;
694 static int hf_ntp_nts_nonce_length;
695 static int hf_ntp_nts_ciphertext_length;
696 static int hf_ntp_nts_nonce;
697 static int hf_ntp_nts_ciphertext;
698 static int hf_ntp_nts_cookie_receive_frame;
699 static int hf_ntp_nts_cookie_used_frame;
700 static int hf_ntp_nts_crypto_success;
702 static int hf_ntpctrl_flags2;
703 static int hf_ntpctrl_flags2_r;
704 static int hf_ntpctrl_flags2_error;
705 static int hf_ntpctrl_flags2_more;
706 static int hf_ntpctrl_flags2_opcode;
707 static int hf_ntpctrl_sequence;
708 static int hf_ntpctrl_status;
709 static int hf_ntpctrl_error_status_word;
710 static int hf_ntpctrl_sys_status_li;
711 static int hf_ntpctrl_sys_status_clksrc;
712 static int hf_ntpctrl_sys_status_count;
713 static int hf_ntpctrl_sys_status_code;
714 static int hf_ntpctrl_peer_status_b0;
715 static int hf_ntpctrl_peer_status_b1;
716 static int hf_ntpctrl_peer_status_b2;
717 static int hf_ntpctrl_peer_status_b3;
718 static int hf_ntpctrl_peer_status_b4;
719 static int hf_ntpctrl_peer_status_selection;
720 static int hf_ntpctrl_peer_status_count;
721 static int hf_ntpctrl_peer_status_code;
722 static int hf_ntpctrl_clk_status;
723 static int hf_ntpctrl_clk_status_code;
724 static int hf_ntpctrl_associd;
725 static int hf_ntpctrl_offset;
726 static int hf_ntpctrl_count;
727 static int hf_ntpctrl_data;
728 static int hf_ntpctrl_item;
729 static int hf_ntpctrl_trapmsg;
730 static int hf_ntpctrl_ordlist;
731 static int hf_ntpctrl_configuration;
732 static int hf_ntpctrl_mru;
733 static int hf_ntpctrl_nonce;
735 static int hf_ntppriv_flags_r;
736 static int hf_ntppriv_flags_more;
737 static int hf_ntppriv_auth_seq;
738 static int hf_ntppriv_auth;
739 static int hf_ntppriv_seq;
740 static int hf_ntppriv_impl;
741 static int hf_ntppriv_reqcode;
742 static int hf_ntppriv_errcode;
743 static int hf_ntppriv_numitems;
744 static int hf_ntppriv_mbz;
745 static int hf_ntppriv_mode7_item;
746 static int hf_ntppriv_itemsize;
747 static int hf_ntppriv_avgint;
748 static int hf_ntppriv_lsint;
749 static int hf_ntppriv_count;
750 static int hf_ntppriv_restr;
751 static int hf_ntppriv_addr;
752 static int hf_ntppriv_daddr;
753 static int hf_ntppriv_flags;
754 static int hf_ntppriv_port;
755 static int hf_ntppriv_mode;
756 static int hf_ntppriv_version;
757 static int hf_ntppriv_v6_flag;
758 static int hf_ntppriv_unused;
759 static int hf_ntppriv_addr6;
760 static int hf_ntppriv_daddr6;
761 static int hf_ntppriv_tstamp;
762 static int hf_ntppriv_mode7_addr;
763 static int hf_ntppriv_mode7_mask;
764 static int hf_ntppriv_mode7_bcast;
765 static int hf_ntppriv_mode7_port;
766 static int hf_ntppriv_mode7_hmode;
767 static int hf_ntppriv_mode7_peer_flags;
768 static int hf_ntppriv_mode7_v6_flag;
769 static int hf_ntppriv_mode7_unused;
770 static int hf_ntppriv_mode7_addr6;
771 static int hf_ntppriv_mode7_mask6;
772 static int hf_ntppriv_mode7_bcast6;
773 static int hf_ntppriv_mode7_peer_flags_config;
774 static int hf_ntppriv_mode7_peer_flags_syspeer;
775 static int hf_ntppriv_mode7_peer_flags_burst;
776 static int hf_ntppriv_mode7_peer_flags_refclock;
777 static int hf_ntppriv_mode7_peer_flags_prefer;
778 static int hf_ntppriv_mode7_peer_flags_authenable;
779 static int hf_ntppriv_mode7_peer_flags_sel_candidate;
780 static int hf_ntppriv_mode7_peer_flags_shortlist;
781 static int hf_ntppriv_mode7_dstaddr;
782 static int hf_ntppriv_mode7_srcaddr;
783 static int hf_ntppriv_mode7_srcport;
784 static int hf_ntppriv_mode7_count;
785 static int hf_ntppriv_mode7_hpoll;
786 static int hf_ntppriv_mode7_reach;
787 static int hf_ntppriv_mode7_delay;
788 static int hf_ntppriv_mode7_offset;
789 static int hf_ntppriv_mode7_dispersion;
790 static int hf_ntppriv_mode7_dstaddr6;
791 static int hf_ntppriv_mode7_srcaddr6;
792 static int hf_ntppriv_mode7_leap;
793 static int hf_ntppriv_mode7_pmode;
794 static int hf_ntppriv_mode7_version;
795 static int hf_ntppriv_mode7_unreach;
796 static int hf_ntppriv_mode7_flash;
797 static int hf_ntppriv_mode7_ttl;
798 static int hf_ntppriv_mode7_flash2;
799 static int hf_ntppriv_mode7_associd;
800 static int hf_ntppriv_mode7_pkeyid;
801 static int hf_ntppriv_mode7_timer;
802 static int hf_ntppriv_mode7_filtdelay;
803 static int hf_ntppriv_mode7_filtoffset;
804 static int hf_ntppriv_mode7_order;
805 static int hf_ntppriv_mode7_selectdis;
806 static int hf_ntppriv_mode7_estbdelay;
807 static int hf_ntppriv_mode7_bdelay;
808 static int hf_ntppriv_mode7_authdelay;
809 static int hf_ntppriv_mode7_stability;
810 static int hf_ntppriv_mode7_timeup;
811 static int hf_ntppriv_mode7_timereset;
812 static int hf_ntppriv_mode7_timereceived;
813 static int hf_ntppriv_mode7_timetosend;
814 static int hf_ntppriv_mode7_timereachable;
815 static int hf_ntppriv_mode7_sent;
816 static int hf_ntppriv_mode7_processed;
817 static int hf_ntppriv_mode7_badauth;
818 static int hf_ntppriv_mode7_bogusorg;
819 static int hf_ntppriv_mode7_oldpkt;
820 static int hf_ntppriv_mode7_seldisp;
821 static int hf_ntppriv_mode7_selbroken;
822 static int hf_ntppriv_mode7_candidate;
823 static int hf_ntppriv_mode7_minpoll;
824 static int hf_ntppriv_mode7_maxpoll;
825 static int hf_ntppriv_mode7_config_flags;
826 static int hf_ntppriv_mode7_config_flags_auth;
827 static int hf_ntppriv_mode7_config_flags_prefer;
828 static int hf_ntppriv_mode7_config_flags_burst;
829 static int hf_ntppriv_mode7_config_flags_iburst;
830 static int hf_ntppriv_mode7_config_flags_noselect;
831 static int hf_ntppriv_mode7_config_flags_skey;
832 static int hf_ntppriv_mode7_key_file;
833 static int hf_ntppriv_mode7_sys_flags;
834 static int hf_ntppriv_mode7_sys_flags8;
835 static int hf_ntppriv_mode7_sys_flags_bclient;
836 static int hf_ntppriv_mode7_sys_flags_pps;
837 static int hf_ntppriv_mode7_sys_flags_ntp;
838 static int hf_ntppriv_mode7_sys_flags_kernel;
839 static int hf_ntppriv_mode7_sys_flags_monitor;
840 static int hf_ntppriv_mode7_sys_flags_filegen;
841 static int hf_ntppriv_mode7_sys_flags_auth;
842 static int hf_ntppriv_mode7_sys_flags_cal;
843 static int hf_ntppriv_mode7_reset_stats_flags;
844 static int hf_ntppriv_mode7_reset_stats_flags_allpeers;
845 static int hf_ntppriv_mode7_reset_stats_flags_io;
846 static int hf_ntppriv_mode7_reset_stats_flags_sys;
847 static int hf_ntppriv_mode7_reset_stats_flags_mem;
848 static int hf_ntppriv_mode7_reset_stats_flags_timer;
849 static int hf_ntppriv_mode7_reset_stats_flags_auth;
850 static int hf_ntppriv_mode7_reset_stats_flags_ctl;
851 static int hf_ntppriv_mode7_req;
852 static int hf_ntppriv_mode7_badpkts;
853 static int hf_ntppriv_mode7_responses;
854 static int hf_ntppriv_mode7_frags;
855 static int hf_ntppriv_mode7_errors;
856 static int hf_ntppriv_mode7_tooshort;
857 static int hf_ntppriv_mode7_inputresp;
858 static int hf_ntppriv_mode7_inputfrag;
859 static int hf_ntppriv_mode7_inputerr;
860 static int hf_ntppriv_mode7_badoffset;
861 static int hf_ntppriv_mode7_badversion;
862 static int hf_ntppriv_mode7_datatooshort;
863 static int hf_ntppriv_mode7_badop;
864 static int hf_ntppriv_mode7_asyncmsgs;
865 static int hf_ntppriv_mode7_type;
866 static int hf_ntppriv_mode7_clock_flags;
867 static int hf_ntppriv_mode7_lastevent;
868 static int hf_ntppriv_mode7_currentstatus;
869 static int hf_ntppriv_mode7_polls;
870 static int hf_ntppriv_mode7_noresponse;
871 static int hf_ntppriv_mode7_badformat;
872 static int hf_ntppriv_mode7_baddata;
873 static int hf_ntppriv_mode7_timestarted;
874 static int hf_ntppriv_mode7_fudgetime1;
875 static int hf_ntppriv_mode7_fudgetime2;
876 static int hf_ntppriv_mode7_fudgeval1;
877 static int hf_ntppriv_mode7_fudgeval2;
878 static int hf_ntppriv_mode7_kernel_offset;
879 static int hf_ntppriv_mode7_freq;
880 static int hf_ntppriv_mode7_maxerror;
881 static int hf_ntppriv_mode7_esterror;
882 static int hf_ntppriv_mode7_status;
883 static int hf_ntppriv_mode7_shift;
884 static int hf_ntppriv_mode7_constant;
885 static int hf_ntppriv_mode7_precision;
886 static int hf_ntppriv_mode7_tolerance;
887 static int hf_ntppriv_mode7_ppsfreq;
888 static int hf_ntppriv_mode7_jitter;
889 static int hf_ntppriv_mode7_stabil;
890 static int hf_ntppriv_mode7_jitcnt;
891 static int hf_ntppriv_mode7_calcnt;
892 static int hf_ntppriv_mode7_errcnt;
893 static int hf_ntppriv_mode7_stbcnt;
894 static int hf_ntppriv_mode7_key;
895 static int hf_ntppriv_mode7_numkeys;
896 static int hf_ntppriv_mode7_numfreekeys;
897 static int hf_ntppriv_mode7_keylookups;
898 static int hf_ntppriv_mode7_keynotfound;
899 static int hf_ntppriv_mode7_encryptions;
900 static int hf_ntppriv_mode7_decryptions;
901 static int hf_ntppriv_mode7_expired;
902 static int hf_ntppriv_mode7_keyuncached;
903 static int hf_ntppriv_mode7_local_addr;
904 static int hf_ntppriv_mode7_trap_addr;
905 static int hf_ntppriv_mode7_trap_port;
906 static int hf_ntppriv_mode7_sequence;
907 static int hf_ntppriv_mode7_settime;
908 static int hf_ntppriv_mode7_origtime;
909 static int hf_ntppriv_mode7_resets;
910 static int hf_ntppriv_traps_flags;
911 static int hf_ntppriv_mode7_local_addr6;
912 static int hf_ntppriv_mode7_trap_addr6;
913 static int hf_ntppriv_mode7_last_offset;
914 static int hf_ntppriv_mode7_drift_comp;
915 static int hf_ntppriv_mode7_compliance;
916 static int hf_ntppriv_mode7_watchdog_timer;
917 static int hf_ntppriv_mode7_poll32;
918 static int hf_ntppriv_mode7_denied;
919 static int hf_ntppriv_mode7_oldversion;
920 static int hf_ntppriv_mode7_newversion;
921 static int hf_ntppriv_mode7_badlength;
922 static int hf_ntppriv_mode7_limitrejected;
923 static int hf_ntppriv_mode7_lamport;
924 static int hf_ntppriv_mode7_tsrounding;
925 static int hf_ntppriv_mode7_totalmem;
926 static int hf_ntppriv_mode7_freemem;
927 static int hf_ntppriv_mode7_findpeer_calls;
928 static int hf_ntppriv_mode7_allocations;
929 static int hf_ntppriv_mode7_demobilizations;
930 static int hf_ntppriv_mode7_hashcount;
931 static int hf_ntppriv_mode7_totalrecvbufs;
932 static int hf_ntppriv_mode7_freerecvbufs;
933 static int hf_ntppriv_mode7_fullrecvbufs;
934 static int hf_ntppriv_mode7_lowwater;
935 static int hf_ntppriv_mode7_dropped;
936 static int hf_ntppriv_mode7_ignored;
937 static int hf_ntppriv_mode7_received;
938 static int hf_ntppriv_mode7_notsent;
939 static int hf_ntppriv_mode7_interrupts;
940 static int hf_ntppriv_mode7_int_received;
941 static int hf_ntppriv_mode7_alarms;
942 static int hf_ntppriv_mode7_overflows;
943 static int hf_ntppriv_mode7_xmtcalls;
944 static int hf_ntppriv_mode7_rflags;
945 static int hf_ntppriv_mode7_mflags;
946 static int hf_ntppriv_mode7_int_name;
947 static int hf_ntppriv_mode7_int_flags;
948 static int hf_ntppriv_mode7_last_ttl;
949 static int hf_ntppriv_mode7_num_mcast;
950 static int hf_ntppriv_mode7_uptime;
951 static int hf_ntppriv_mode7_scopeid;
952 static int hf_ntppriv_mode7_ifindex;
953 static int hf_ntppriv_mode7_ifnum;
954 static int hf_ntppriv_mode7_peercnt;
955 static int hf_ntppriv_mode7_family;
956 static int hf_ntppriv_mode7_ignore_pkt;
957 static int hf_ntppriv_mode7_action;
958 static int hf_ntppriv_mode7_nvalues;
959 static int hf_ntppriv_mode7_ntimes;
960 static int hf_ntppriv_mode7_svalues;
961 static int hf_ntppriv_mode7_stimes;
962 static int hf_ntppriv_mode7_values;
963 static int hf_ntppriv_mode7_times;
964 static int hf_ntppriv_mode7_which;
965 static int hf_ntppriv_mode7_fudgetime;
966 static int hf_ntppriv_mode7_fudgeval_flags;
967 static int hf_ntppriv_mode7_ippeerlimit;
968 static int hf_ntppriv_mode7_restrict_flags;
970 static int ett_ntp;
971 static int ett_ntp_flags;
972 static int ett_ntp_ext;
973 static int ett_ntp_ext_flags;
974 static int ett_ntp_ext_nts;
975 static int ett_ntpctrl_flags2;
976 static int ett_ntpctrl_status;
977 static int ett_ntpctrl_data;
978 static int ett_ntpctrl_item;
979 static int ett_ntppriv_auth_seq;
980 static int ett_mode7_item;
981 static int ett_ntp_authenticator;
982 static int ett_ntppriv_peer_list_flags;
983 static int ett_ntppriv_config_flags;
984 static int ett_ntppriv_sys_flag_flags;
985 static int ett_ntppriv_reset_stats_flags;
987 static expert_field ei_ntp_ext;
989 static const char *mon_names[12] = {
990 "Jan",
991 "Feb",
992 "Mar",
993 "Apr",
994 "May",
995 "Jun",
996 "Jul",
997 "Aug",
998 "Sep",
999 "Oct",
1000 "Nov",
1001 "Dec"
1004 static int * const ntp_header_fields[] = {
1005 &hf_ntp_flags_li,
1006 &hf_ntp_flags_vn,
1007 &hf_ntp_flags_mode,
1008 NULL
1012 * dissect peer status word:
1014 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
1015 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1016 * | Status | Sel | Count | Code |
1017 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1019 static int * const peer_status_flags[] = {
1020 &hf_ntpctrl_peer_status_b0,
1021 &hf_ntpctrl_peer_status_b1,
1022 &hf_ntpctrl_peer_status_b2,
1023 &hf_ntpctrl_peer_status_b3,
1024 &hf_ntpctrl_peer_status_b4,
1025 &hf_ntpctrl_peer_status_selection,
1026 &hf_ntpctrl_peer_status_count,
1027 &hf_ntpctrl_peer_status_code,
1028 NULL
1031 static int * const ntppriv_peer_list_flags[] = {
1032 &hf_ntppriv_mode7_peer_flags_config,
1033 &hf_ntppriv_mode7_peer_flags_syspeer,
1034 &hf_ntppriv_mode7_peer_flags_burst,
1035 &hf_ntppriv_mode7_peer_flags_refclock,
1036 &hf_ntppriv_mode7_peer_flags_prefer,
1037 &hf_ntppriv_mode7_peer_flags_authenable,
1038 &hf_ntppriv_mode7_peer_flags_sel_candidate,
1039 &hf_ntppriv_mode7_peer_flags_shortlist,
1040 NULL
1043 static int * const ntppriv_config_flags[] = {
1044 &hf_ntppriv_mode7_config_flags_auth,
1045 &hf_ntppriv_mode7_config_flags_prefer,
1046 &hf_ntppriv_mode7_config_flags_burst,
1047 &hf_ntppriv_mode7_config_flags_iburst,
1048 &hf_ntppriv_mode7_config_flags_noselect,
1049 &hf_ntppriv_mode7_config_flags_skey,
1050 NULL
1053 static int * const ntppriv_sys_flag_flags[] = {
1054 &hf_ntppriv_mode7_sys_flags_bclient,
1055 &hf_ntppriv_mode7_sys_flags_pps,
1056 &hf_ntppriv_mode7_sys_flags_ntp,
1057 &hf_ntppriv_mode7_sys_flags_kernel,
1058 &hf_ntppriv_mode7_sys_flags_monitor,
1059 &hf_ntppriv_mode7_sys_flags_filegen,
1060 &hf_ntppriv_mode7_sys_flags_auth,
1061 &hf_ntppriv_mode7_sys_flags_cal,
1062 NULL
1065 static int * const ntppriv_reset_stats_flags[] = {
1066 &hf_ntppriv_mode7_reset_stats_flags_allpeers,
1067 &hf_ntppriv_mode7_reset_stats_flags_io,
1068 &hf_ntppriv_mode7_reset_stats_flags_sys,
1069 &hf_ntppriv_mode7_reset_stats_flags_mem,
1070 &hf_ntppriv_mode7_reset_stats_flags_timer,
1071 &hf_ntppriv_mode7_reset_stats_flags_auth,
1072 &hf_ntppriv_mode7_reset_stats_flags_ctl,
1073 NULL
1076 /* parser definitions */
1077 static tvbparse_wanted_t *want;
1078 static tvbparse_wanted_t *want_ignore;
1080 /* NTS cookie and reminders */
1081 static nts_cookie_t *nts_cookie;
1082 static int nts_tvb_uid_offset;
1083 static int nts_tvb_uid_length;
1084 static int nts_aad_start;
1087 * NTP_BASETIME is in fact epoch - ntp_start_time; ntp_start_time
1088 * is January 1, 2036, 00:00:00 UTC.
1090 #define NTP_BASETIME EPOCH_DELTA_1900_01_01_00_00_00_UTC
1091 #define NTP_FLOAT_DENOM 4294967296.0
1092 #define NTP_TS_SIZE 110
1094 /* tvb_ntp_fmt_ts_sec - converts an NTP timestamps second part (32bits) to an human readable string.
1095 * TVB and an offset (IN).
1096 * returns pointer to filled buffer. This buffer will be freed automatically once
1097 * dissection of the next packet occurs.
1099 const char *
1100 tvb_ntp_fmt_ts_sec(tvbuff_t *tvb, int offset)
1102 uint32_t tempstmp;
1103 time_t temptime;
1104 struct tm *bd;
1105 char *buff;
1107 tempstmp = tvb_get_ntohl(tvb, offset);
1108 if (tempstmp == 0){
1109 return "NULL";
1112 /* We need a temporary variable here so the unsigned math
1113 * works correctly (for years > 2036 according to RFC 2030
1114 * chapter 3).
1116 temptime = (time_t)(tempstmp - NTP_BASETIME);
1117 bd = gmtime(&temptime);
1118 if (!bd){
1119 return "Not representable";
1122 buff = (char *)wmem_alloc(wmem_packet_scope(), NTP_TS_SIZE);
1123 snprintf(buff, NTP_TS_SIZE,
1124 "%s %2d, %d %02d:%02d:%02d UTC",
1125 mon_names[bd->tm_mon],
1126 bd->tm_mday,
1127 bd->tm_year + 1900,
1128 bd->tm_hour,
1129 bd->tm_min,
1130 bd->tm_sec);
1131 return buff;
1134 static tvbuff_t*
1135 ntp_decrypt_nts(tvbuff_t *parent_tvb, packet_info *pinfo, uint8_t *nonce, uint32_t nonce_len,
1136 uint8_t *ciphertext, uint32_t ciphertext_len, uint8_t *aad, uint32_t aad_len,
1137 const nts_aead *aead, uint8_t *key)
1139 gcry_cipher_hd_t gc_hd = NULL;
1140 gcry_error_t err;
1141 uint8_t *tag, *ct;
1142 uint32_t ct_len;
1144 /* Field ciphertext length is the total length, including authentication tag.
1145 * Now, as we know the AEAD details, we need to adjust the lengths and copy the bytes
1147 ct_len = ciphertext_len - aead->tag_len;
1149 /* SIV has authentication tag prepended */
1150 tag = wmem_alloc0(pinfo->pool, aead->tag_len);
1151 ct = wmem_alloc0(pinfo->pool, ct_len);
1153 /* GCRYPT 1.10.0 is mandatory for decryption due to SIV algos */
1154 #if GCRYPT_VERSION_NUMBER >= 0x010a00
1155 if(aead->mode == GCRY_CIPHER_MODE_SIV) {
1156 memcpy(tag, ciphertext, aead->tag_len);
1157 memcpy(ct, ciphertext + aead->tag_len, ct_len);
1158 } else {
1159 memcpy(ct, ciphertext, ct_len);
1160 memcpy(tag, ciphertext + ct_len, aead->tag_len);
1162 #else
1163 memcpy(ct, ciphertext, ct_len);
1164 memcpy(tag, ciphertext + ct_len, aead->tag_len);
1165 #endif
1168 * Be sure to align the following with supported ciphers in NTS-KE
1171 err = gcry_cipher_open(&gc_hd, aead->cipher, aead->mode, 0);
1172 if (err) { ws_debug("Decryption (open) failed: %s", gcry_strerror(err)); gcry_cipher_close(gc_hd); return NULL; }
1174 err = gcry_cipher_setkey(gc_hd, key, aead->key_len);
1175 if (err) { ws_debug("Decryption (setkey) failed: %s", gcry_strerror(err)); gcry_cipher_close(gc_hd); return NULL; }
1177 #if GCRYPT_VERSION_NUMBER >= 0x010a00
1179 /* gcry_cipher_setiv() blocks futher gcry_cipher_authenticate() calls with GCRY_CIPHER_MODE_SIV */
1180 if(aead->mode != GCRY_CIPHER_MODE_SIV) {
1181 err = gcry_cipher_setiv(gc_hd, nonce, nonce_len);
1182 if (err) { ws_debug("Decryption (setiv) failed: %s", gcry_strerror(err)); gcry_cipher_close(gc_hd); return NULL; }
1185 err = gcry_cipher_authenticate(gc_hd, aad, aad_len);
1186 if (err) { ws_debug("Decryption (authenticate) failed: %s", gcry_strerror(err)); gcry_cipher_close(gc_hd); return NULL; }
1188 if(aead->mode == GCRY_CIPHER_MODE_SIV) {
1189 err = gcry_cipher_setiv(gc_hd, nonce, nonce_len);
1190 if (err) { ws_debug("Decryption (setiv) failed: %s", gcry_strerror(err)); gcry_cipher_close(gc_hd); return NULL; }
1193 err = gcry_cipher_set_decryption_tag(gc_hd, tag, aead->tag_len);
1194 if (err) { ws_debug("Decryption (decryption tag) failed: %s", gcry_strerror(err)); gcry_cipher_close(gc_hd); return NULL; }
1196 #else
1198 err = gcry_cipher_authenticate(gc_hd, aad, aad_len);
1199 if (err) { ws_debug("Decryption (authenticate) failed: %s", gcry_strerror(err)); gcry_cipher_close(gc_hd); return NULL; }
1201 err = gcry_cipher_setiv(gc_hd, nonce, nonce_len);
1202 if (err) { ws_debug("Decryption (setiv) failed: %s", gcry_strerror(err)); gcry_cipher_close(gc_hd); return NULL; }
1204 #endif
1206 err = gcry_cipher_decrypt(gc_hd, ct, ct_len, NULL, 0);
1207 if (err) { ws_debug("Decryption (decrypt) failed: %s", gcry_strerror(err)); gcry_cipher_close(gc_hd); return NULL; }
1209 err = gcry_cipher_checktag(gc_hd, tag, aead->tag_len);
1210 if (err) { ws_debug("Decryption (checktag) failed: %s", gcry_strerror(err)); gcry_cipher_close(gc_hd); return NULL; }
1212 if(gc_hd)
1213 gcry_cipher_close(gc_hd);
1215 return tvb_new_child_real_data(parent_tvb, ct, ct_len, ct_len);
1218 void
1219 ntp_to_nstime(tvbuff_t *tvb, int offset, nstime_t *nstime)
1221 uint32_t tempstmp;
1223 /* We need a temporary variable here so the unsigned math
1224 * works correctly (for years > 2036 according to RFC 2030
1225 * chapter 3).
1227 tempstmp = tvb_get_ntohl(tvb, offset);
1228 if (tempstmp)
1229 nstime->secs = (time_t)(tempstmp - NTP_BASETIME);
1230 else
1231 nstime->secs = (time_t)tempstmp; /* 0 */
1233 nstime->nsecs = (int)(tvb_get_ntohl(tvb, offset+4)/(NTP_FLOAT_DENOM/1000000000.0));
1236 static void
1237 dissect_nts_cookie(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ext_tree, int offset, int length, uint64_t flags)
1239 proto_item *ct;
1240 nts_cookie_t *new_cookie;
1241 nts_used_frames_lookup_t lookup_data = {.tvb = tvb, .hfindex = hf_ntp_nts_cookie_used_frame};
1243 if ((flags & NTP_MODE_MASK) == NTP_MODE_CLIENT) {
1244 nts_cookie = nts_use_cookie(
1245 tvb_new_subset_length(tvb, offset, length),
1246 tvb_new_subset_length(tvb, nts_tvb_uid_offset, nts_tvb_uid_length),
1247 pinfo);
1248 if(nts_cookie) {
1249 ct = proto_tree_add_uint(ext_tree, hf_ntp_nts_cookie_receive_frame, tvb, 0, 0, nts_cookie->frame_received);
1250 proto_item_set_generated(ct);
1252 } else if ((flags & NTP_MODE_MASK) == NTP_MODE_SERVER && nts_cookie) {
1253 /* If a cookie extension was received in a server packet, we need to add it as a new one */
1254 new_cookie = nts_new_cookie_copy(tvb_new_subset_length(tvb, offset, length), nts_cookie, pinfo);
1256 if(new_cookie) {
1257 /* List all packets which made use of that cookie */
1258 lookup_data.tree = ext_tree;
1259 wmem_list_foreach(new_cookie->frames_used, nts_append_used_frames_to_tree, &lookup_data);
1264 static int
1265 dissect_ntp_ext_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ext_tree, int offset, uint16_t extlen)
1267 proto_item *tf;
1268 int value_length;
1270 tf = proto_tree_add_item(ext_tree, hf_ntp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
1271 offset += 2;
1273 if (extlen < 8) {
1274 /* Extension length isn't enough for the extension header.
1275 * Report the error, and return an offset that goes to
1276 * the end of the tvbuff, so we stop dissecting.
1278 expert_add_info_format(pinfo, tf, &ei_ntp_ext, "Extension length %u < 8", extlen);
1279 return tvb_reported_length(tvb);
1281 if (extlen % 4) {
1282 /* Extension length isn't a multiple of 4.
1283 * Report the error, and return an offset that goes
1284 * to the end of the tvbuff, so we stop dissecting.
1286 expert_add_info_format(pinfo, tf, &ei_ntp_ext, "Extension length %u isn't a multiple of 4",
1287 extlen);
1288 return tvb_reported_length(tvb);
1291 value_length = extlen - 4;
1292 proto_tree_add_item(ext_tree, hf_ntp_ext_value, tvb, offset, value_length, ENC_NA);
1294 return offset;
1297 /* Same as dissect_ntp_ext() but without crypto which would cause recursion (called by dissect_nts_ext()).
1298 * At that point, there can't be extensions of type:
1299 * - NTS UID
1300 * - NTS authentication and encryption
1302 static int
1303 dissect_ntp_ext_wo_crypto(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ntp_tree, int offset, uint64_t flags)
1305 proto_tree *ext_tree;
1306 proto_item *tf;
1307 uint16_t extlen;
1308 uint32_t type;
1309 int value_length;
1311 extlen = tvb_get_ntohs(tvb, offset+2);
1312 tf = proto_tree_add_item(ntp_tree, hf_ntp_ext, tvb, offset, extlen, ENC_NA);
1313 ext_tree = proto_item_add_subtree(tf, ett_ntp_ext);
1315 proto_tree_add_item_ret_uint(ext_tree, hf_ntp_ext_type, tvb, offset, 2, ENC_BIG_ENDIAN, &type);
1316 offset += 2;
1318 offset = dissect_ntp_ext_data(tvb, pinfo, ext_tree, offset, extlen);
1320 value_length = extlen - 4;
1322 if(type == 0x0204) /* NTS cookie extension */
1323 dissect_nts_cookie(tvb, pinfo, ext_tree, offset, value_length, flags);
1325 offset += value_length;
1327 return offset;
1330 static void
1331 dissect_nts_ext(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ext_tree, proto_tree *ntp_tree, int offset, int length, uint64_t flags, int ext_start)
1333 proto_tree *nts_tree;
1334 proto_item *tf, *af;
1335 uint32_t nonce_len, ciphertext_len, aad_len;
1336 uint8_t *nonce, *aad, *ciphertext;
1337 uint8_t *ptr_key = NULL;
1338 const nts_aead *aead;
1339 int crypto_offset = 0, offset_n = offset;
1340 tvbuff_t *decrypted;
1342 tf = proto_tree_add_item(ext_tree, hf_ntp_ext_nts, tvb, offset_n, length, ENC_NA);
1343 nts_tree = proto_item_add_subtree(tf, ett_ntp_ext_nts);
1345 proto_tree_add_item_ret_uint(nts_tree, hf_ntp_nts_nonce_length, tvb, offset_n, 2, ENC_BIG_ENDIAN, &nonce_len);
1346 offset_n += 2;
1348 proto_tree_add_item_ret_uint(nts_tree, hf_ntp_nts_ciphertext_length, tvb, offset_n, 2, ENC_BIG_ENDIAN, &ciphertext_len);
1349 offset_n += 2;
1351 proto_tree_add_item(nts_tree, hf_ntp_nts_nonce, tvb, offset_n, nonce_len, ENC_NA);
1352 nonce = (uint8_t *)tvb_memdup(pinfo->pool, tvb, offset_n, nonce_len);
1353 offset_n += nonce_len;
1355 proto_tree_add_item(nts_tree, hf_ntp_nts_ciphertext, tvb, offset_n, ciphertext_len, ENC_NA);
1356 ciphertext = (uint8_t *)tvb_memdup(pinfo->pool, tvb, offset_n, ciphertext_len);
1358 /* CLIENT REQUEST: C2S key is required, used cookie data should already be available */
1359 if ((flags & NTP_MODE_MASK) == NTP_MODE_CLIENT) {
1360 if(!nts_cookie)
1361 return;
1362 ptr_key = nts_cookie->key_c2s;
1364 /* SERVER RESPONSE: S2C key is required, used cookie data has to be looked up by client request */
1365 } else if ((flags & NTP_MODE_MASK) == NTP_MODE_SERVER) {
1366 if(nts_tvb_uid_length > 0 && nts_tvb_uid_offset >0 ) {
1367 nts_cookie = nts_find_cookie_by_uid(tvb_new_subset_length(tvb, nts_tvb_uid_offset, nts_tvb_uid_length));
1369 if(!nts_cookie)
1370 return;
1371 ptr_key = nts_cookie->key_s2c;
1372 } else {
1373 return;
1376 /* Stop without valid crypto material */
1377 aead = nts_find_aead(nts_cookie->aead);
1378 if(!aead || !nts_cookie->keys_present)
1379 return;
1381 /* Create a buffer for the bytes to authenticate (associated data)
1382 * from packet start until end of previous extension (ext_start).
1384 aad_len = ext_start;
1385 aad = (uint8_t *)tvb_memdup(pinfo->pool, tvb, nts_aad_start, aad_len);
1387 decrypted = ntp_decrypt_nts(tvb, pinfo, nonce, nonce_len, ciphertext, ciphertext_len, aad, aad_len, aead, ptr_key);
1388 af = proto_tree_add_boolean(nts_tree, hf_ntp_nts_crypto_success, tvb, 0, 0, (bool)decrypted);
1389 proto_item_set_generated(af);
1391 if(decrypted) {
1392 add_new_data_source(pinfo, decrypted, "Decrypted NTP");
1393 while ((unsigned)crypto_offset < tvb_reported_length(decrypted)) {
1394 crypto_offset = dissect_ntp_ext_wo_crypto(decrypted, pinfo, ntp_tree, crypto_offset, flags);
1399 static int
1400 dissect_ntp_ext(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ntp_tree, int offset, uint64_t flags)
1402 proto_tree *ext_tree;
1403 proto_item *tf;
1404 uint16_t extlen;
1405 uint32_t type;
1406 int value_length, offset_m = offset;
1408 extlen = tvb_get_ntohs(tvb, offset+2);
1409 tf = proto_tree_add_item(ntp_tree, hf_ntp_ext, tvb, offset, extlen, ENC_NA);
1410 ext_tree = proto_item_add_subtree(tf, ett_ntp_ext);
1412 proto_tree_add_item_ret_uint(ext_tree, hf_ntp_ext_type, tvb, offset, 2, ENC_BIG_ENDIAN, &type);
1413 offset += 2;
1415 offset = dissect_ntp_ext_data(tvb, pinfo, ext_tree, offset, extlen);
1417 value_length = extlen - 4;
1419 if(type == 0x0104) { /* NTS UID extension -> remember offset and length */
1420 nts_tvb_uid_offset = offset;
1421 nts_tvb_uid_length = value_length;
1423 /* Every NTP NTS packet must have this extention, so use it to add INFO */
1424 col_append_sep_fstr(pinfo->cinfo, COL_INFO, ",", " NTS");
1426 if(type == 0x0204) /* NTS cookie extension */
1427 dissect_nts_cookie(tvb, pinfo, ext_tree, offset, value_length, flags);
1428 if(type == 0x0404) /* NTS authentication and encryption extension */
1429 dissect_nts_ext(tvb, pinfo, ext_tree, ntp_tree, offset, value_length, flags, offset_m);
1431 offset += value_length;
1433 return offset;
1436 static void
1437 dissect_ntp_std(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ntp_tree, ntp_conv_info_t *ntp_conv)
1439 uint8_t stratum;
1440 int8_t ppoll;
1441 int8_t precision;
1442 uint32_t rootdelay;
1443 double rootdelay_double;
1444 uint32_t rootdispersion;
1445 double rootdispersion_double;
1446 uint32_t refid_addr;
1447 char *buff;
1448 int i;
1449 int efs_end;
1450 uint16_t last_extlen = 0;
1451 int macofs;
1452 unsigned maclen;
1453 ntp_trans_info_t *ntp_trans;
1454 wmem_tree_key_t key[3];
1455 uint64_t flags;
1456 uint32_t seq;
1458 proto_tree_add_bitmask_ret_uint64(ntp_tree, tvb, 0, hf_ntp_flags, ett_ntp_flags,
1459 ntp_header_fields, ENC_NA, &flags);
1461 seq = 0xffffffff;
1462 key[0].length = 1;
1463 key[0].key = &seq;
1464 key[1].length = 1;
1465 key[1].key = &pinfo->num;
1466 key[2].length = 0;
1467 key[2].key = NULL;
1468 if ((flags & NTP_MODE_MASK) == NTP_MODE_CLIENT) {
1469 if (!PINFO_FD_VISITED(pinfo)) {
1470 ntp_trans = wmem_new(wmem_file_scope(), ntp_trans_info_t);
1471 ntp_trans->req_frame = pinfo->num;
1472 ntp_trans->resp_frame = 0;
1473 ntp_trans->req_time = pinfo->abs_ts;
1474 ntp_trans->seq = seq;
1475 wmem_tree_insert32_array(ntp_conv->trans, key, (void *)ntp_trans);
1476 } else {
1477 ntp_trans = (ntp_trans_info_t *)wmem_tree_lookup32_array_le(ntp_conv->trans, key);
1478 if (ntp_trans && ntp_trans->resp_frame != 0 && ntp_trans->seq == seq) {
1479 proto_item *resp_it;
1481 resp_it = proto_tree_add_uint(ntp_tree, hf_ntp_response_in, tvb, 0, 0, ntp_trans->resp_frame);
1482 proto_item_set_generated(resp_it);
1485 } else if ((flags & NTP_MODE_MASK) == NTP_MODE_SERVER) {
1486 ntp_trans = (ntp_trans_info_t *)wmem_tree_lookup32_array_le(ntp_conv->trans, key);
1487 if (ntp_trans && ntp_trans->seq == seq) {
1488 if (!PINFO_FD_VISITED(pinfo)) {
1489 if (ntp_trans->resp_frame == 0) {
1490 ntp_trans->resp_frame = pinfo->num;
1492 } else if (ntp_trans->resp_frame == pinfo->num) {
1493 proto_item *req_it;
1494 nstime_t delta;
1496 req_it = proto_tree_add_uint(ntp_tree, hf_ntp_request_in, tvb, 0, 0, ntp_trans->req_frame);
1497 proto_item_set_generated(req_it);
1498 nstime_delta(&delta, &pinfo->abs_ts, &ntp_trans->req_time);
1499 req_it = proto_tree_add_time(ntp_tree, hf_ntp_delta_time, tvb, 0, 0, &delta);
1500 proto_item_set_generated(req_it);
1505 /* Stratum, 1byte field represents distance from primary source
1507 proto_tree_add_item(ntp_tree, hf_ntp_stratum, tvb, 1, 1, ENC_NA);
1508 stratum = tvb_get_uint8(tvb, 1);
1510 /* Poll interval, 1byte field indicating the maximum interval
1511 * between successive messages, in seconds to the nearest
1512 * power of two.
1514 ppoll = tvb_get_int8(tvb, 2);
1515 proto_tree_add_int_format_value(ntp_tree, hf_ntp_ppoll, tvb, 2, 1,
1516 ppoll, ppoll >= 0 ? "%d (%.0f seconds)" : "%d (%5.3f seconds)",
1517 ppoll, pow(2, ppoll));
1519 /* Precision, 1 byte field indicating the precision of the
1520 * local clock, in seconds to the nearest power of two.
1522 precision = tvb_get_int8(tvb, 3);
1523 proto_tree_add_int_format_value(ntp_tree, hf_ntp_precision, tvb, 3, 1,
1524 precision, "%d (%11.9f seconds)", precision, pow(2, precision));
1526 /* Root Delay is a 32-bit signed fixed-point number indicating
1527 * the total roundtrip delay to the primary reference source,
1528 * in seconds with fraction point between bits 15 and 16.
1530 rootdelay = tvb_get_ntohl(tvb, 4);
1531 rootdelay_double = (rootdelay >> 16) + (rootdelay & 0xffff) / 65536.0;
1532 proto_tree_add_uint_format_value(ntp_tree, hf_ntp_rootdelay, tvb, 4, 4,
1533 rootdelay, "%8.6f seconds", rootdelay_double);
1535 /* Root Dispersion, 32-bit unsigned fixed-point number indicating
1536 * the nominal error relative to the primary reference source, in
1537 * seconds with fraction point between bits 15 and 16.
1539 rootdispersion = tvb_get_ntohl(tvb, 8);
1540 rootdispersion_double = (rootdispersion >> 16) + (rootdispersion & 0xffff) / 65536.0;
1541 proto_tree_add_uint_format_value(ntp_tree, hf_ntp_rootdispersion, tvb, 8, 4,
1542 rootdispersion, "%8.6f seconds", rootdispersion_double);
1544 /* Now, there is a problem with secondary servers. Standards
1545 * asks from stratum-2 - stratum-15 servers to set this to the
1546 * low order 32 bits of the latest transmit timestamp of the
1547 * reference source.
1548 * But, all V3 and V4 servers set this to IP address of their
1549 * higher level server. My decision was to resolve this address.
1551 buff = (char *)wmem_alloc(pinfo->pool, NTP_TS_SIZE);
1552 if (stratum == 0) {
1553 snprintf (buff, NTP_TS_SIZE, "Unidentified Kiss-o\'-Death message '%s'",
1554 tvb_get_string_enc(pinfo->pool, tvb, 12, 4, ENC_ASCII));
1555 for (i = 0; kod_messages[i].id; i++) {
1556 if (tvb_memeql(tvb, 12, kod_messages[i].id, 4) == 0) {
1557 snprintf(buff, NTP_TS_SIZE, "%s",
1558 kod_messages[i].data);
1559 break;
1562 } else if (stratum == 1) {
1563 snprintf (buff, NTP_TS_SIZE, "Unidentified reference source '%s'",
1564 tvb_get_string_enc(pinfo->pool, tvb, 12, 4, ENC_ASCII));
1565 for (i = 0; primary_sources[i].id; i++) {
1566 if (tvb_memeql(tvb, 12, (const uint8_t*)primary_sources[i].id, 4) == 0) {
1567 snprintf(buff, NTP_TS_SIZE, "%s",
1568 primary_sources[i].data);
1569 break;
1572 } else {
1573 int buffpos;
1574 refid_addr = tvb_get_ipv4(tvb, 12);
1575 buffpos = snprintf(buff, NTP_TS_SIZE, "%s", get_hostname (refid_addr));
1576 if (buffpos >= NTP_TS_SIZE) {
1577 buff[NTP_TS_SIZE-4]='.';
1578 buff[NTP_TS_SIZE-3]='.';
1579 buff[NTP_TS_SIZE-2]='.';
1580 buff[NTP_TS_SIZE-1]=0;
1583 proto_tree_add_bytes_format_value(ntp_tree, hf_ntp_refid, tvb, 12, 4,
1584 NULL, "%s", buff);
1586 /* Reference Timestamp: This is the time at which the local clock was
1587 * last set or corrected.
1589 proto_tree_add_item(ntp_tree, hf_ntp_reftime, tvb, 16, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
1591 /* Originate Timestamp: This is the time at which the request departed
1592 * the client for the server.
1594 proto_tree_add_item(ntp_tree, hf_ntp_org, tvb, 24, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
1596 /* Receive Timestamp: This is the time at which the request arrived at
1597 * the server.
1599 proto_tree_add_item(ntp_tree, hf_ntp_rec, tvb, 32, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
1601 /* Transmit Timestamp: This is the time at which the reply departed the
1602 * server for the client.
1604 proto_tree_add_item(ntp_tree, hf_ntp_xmt, tvb, 40, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
1607 * Optional fields:
1609 * - Optional Extension fields (EFs), at minimum 16 bytes each.
1610 * Used for Autokey (RFC 5906, requires a MAC) and others.
1612 * - Optional Message Authentication Codes (MACs), consisting of a
1613 * 32-bit key ID concatenated with the digest. Per RFC 7822, this MAC
1614 * can be 24 bytes (SHA-1, AES-CMAC from RFC 8573), 20 octets (MD5),
1615 * or 4 bytes (crypto-NAK, MAC contains four zeroes). However,
1616 * implementations such as chrony and NTPsec support additional hash
1617 * algorithms such as SHA-512 which result in a MAC of 68 bytes.
1619 * Since MACs cannot unambiguously be recognized from EFs based on size
1620 * alone due to the larger, non-standard MAC algorithms, follow this:
1622 * 1. Find the end of EFs, stopping as soon as it looks invalid (too
1623 * small or large Length field).
1624 * 2. If there is any trailing data, assume a MAC is present. If it is
1625 * too small, remove a field that was assumed to be an EF.
1627 efs_end = 48;
1628 while (tvb_reported_length_remaining(tvb, efs_end) >= 16) {
1629 uint16_t extlen = tvb_get_ntohs(tvb, efs_end + 2);
1630 if (extlen < 16) {
1631 break;
1633 if (tvb_reported_length_remaining(tvb, efs_end) < extlen) {
1634 break;
1636 efs_end += extlen;
1637 last_extlen = extlen;
1640 maclen = tvb_reported_length_remaining(tvb, efs_end);
1641 if (maclen == 0) {
1642 /* MAC is missing. */
1643 } else if (maclen == 4 && tvb_get_ntohl(tvb, efs_end) == 0) {
1644 /* crypto-NAK - continue as normal. */
1645 } else if (maclen < 20) {
1646 /* last field was most likely not an EF, remove it. */
1647 efs_end -= last_extlen;
1650 macofs = 48;
1651 while (macofs < efs_end) {
1652 macofs = dissect_ntp_ext(tvb, pinfo, ntp_tree, macofs, flags);
1655 /* When the NTP authentication scheme is implemented, the
1656 * Key Identifier and Message Digest fields contain the
1657 * message authentication code (MAC) information defined in
1658 * Appendix C of RFC-1305. Will print this as hex code for now.
1660 if (tvb_reported_length_remaining(tvb, macofs) >= 4)
1661 proto_tree_add_item(ntp_tree, hf_ntp_keyid, tvb, macofs, 4, ENC_NA);
1662 macofs += 4;
1663 maclen = tvb_reported_length_remaining(tvb, macofs);
1664 if (maclen > 0)
1665 proto_tree_add_item(ntp_tree, hf_ntp_mac, tvb, macofs, maclen, ENC_NA);
1668 static void
1669 dissect_ntp_ctrl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *ntp_tree, ntp_conv_info_t *ntp_conv)
1671 uint8_t flags2;
1672 proto_tree *data_tree, *item_tree, *auth_tree;
1673 proto_item *td, *ti;
1674 uint16_t associd;
1675 uint16_t datalen;
1676 uint16_t data_offset;
1677 int length_remaining;
1678 bool auth_diss = false;
1679 ntp_trans_info_t *ntp_trans;
1680 uint32_t seq;
1681 wmem_tree_key_t key[3];
1683 tvbparse_t *tt;
1684 tvbparse_elem_t *element;
1686 static int * const ntpctrl_flags[] = {
1687 &hf_ntpctrl_flags2_r,
1688 &hf_ntpctrl_flags2_error,
1689 &hf_ntpctrl_flags2_more,
1690 &hf_ntpctrl_flags2_opcode,
1691 NULL
1693 proto_tree_add_bitmask(ntp_tree, tvb, 0, hf_ntp_flags, ett_ntp_flags, ntp_header_fields, ENC_NA);
1694 proto_tree_add_bitmask(ntp_tree, tvb, 1, hf_ntpctrl_flags2, ett_ntpctrl_flags2, ntpctrl_flags, ENC_NA);
1695 flags2 = tvb_get_uint8(tvb, 1);
1697 proto_tree_add_item_ret_uint(ntp_tree, hf_ntpctrl_sequence, tvb, 2, 2, ENC_BIG_ENDIAN, &seq);
1698 key[0].length = 1;
1699 key[0].key = &seq;
1700 key[1].length = 1;
1701 key[1].key = &pinfo->num;
1702 key[2].length = 0;
1703 key[2].key = NULL;
1704 associd = tvb_get_ntohs(tvb, 6);
1706 * further processing of status is only necessary in server responses
1708 if (flags2 & NTPCTRL_R_MASK) {
1709 ntp_trans = (ntp_trans_info_t *)wmem_tree_lookup32_array_le(ntp_conv->trans, key);
1710 if (ntp_trans && ntp_trans->seq == seq) {
1711 if (!PINFO_FD_VISITED(pinfo)) {
1712 if (ntp_trans->resp_frame == 0) {
1713 ntp_trans->resp_frame = pinfo->num;
1715 } else {
1716 proto_item *req_it;
1717 nstime_t delta;
1719 req_it = proto_tree_add_uint(ntp_tree, hf_ntp_request_in, tvb, 0, 0, ntp_trans->req_frame);
1720 proto_item_set_generated(req_it);
1721 nstime_delta(&delta, &pinfo->abs_ts, &ntp_trans->req_time);
1722 req_it = proto_tree_add_time(ntp_tree, hf_ntp_delta_time, tvb, 0, 0, &delta);
1723 proto_item_set_generated(req_it);
1726 if (flags2 & NTPCTRL_ERROR_MASK) {
1728 * if error bit is set: dissect error status word
1730 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
1731 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1732 * | Error Code | reserved |
1733 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1735 static int * const errorstatus[] = {
1736 &hf_ntpctrl_error_status_word,
1737 NULL
1740 /* Check if this is an error response... */
1741 proto_tree_add_bitmask(ntp_tree, tvb, 4, hf_ntpctrl_status, ett_ntpctrl_status, errorstatus, ENC_BIG_ENDIAN);
1742 } else {
1743 /* ...otherwise status word depends on OpCode */
1744 switch (flags2 & NTPCTRL_OP_MASK) {
1745 case NTPCTRL_OP_READSTAT:
1746 case NTPCTRL_OP_READVAR:
1747 case NTPCTRL_OP_WRITEVAR:
1748 case NTPCTRL_OP_ASYNCMSG:
1749 if (associd)
1750 proto_tree_add_bitmask(ntp_tree, tvb, 4, hf_ntpctrl_status, ett_ntpctrl_status, peer_status_flags, ENC_BIG_ENDIAN);
1751 else
1754 * dissect system status word:
1756 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
1757 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1758 * |LI | ClkSource | Count | Code |
1759 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1761 static int * const systemstatus[] = {
1762 &hf_ntpctrl_sys_status_li,
1763 &hf_ntpctrl_sys_status_clksrc,
1764 &hf_ntpctrl_sys_status_count,
1765 &hf_ntpctrl_sys_status_code,
1766 NULL
1769 proto_tree_add_bitmask(ntp_tree, tvb, 4, hf_ntpctrl_status, ett_ntpctrl_status, systemstatus, ENC_BIG_ENDIAN);
1771 break;
1772 case NTPCTRL_OP_READCLOCK:
1773 case NTPCTRL_OP_WRITECLOCK:
1776 * dissect clock status word:
1778 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
1779 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1780 * | Clock Status | Event Code |
1781 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1783 static int * const clockstatus[] = {
1784 &hf_ntpctrl_clk_status,
1785 &hf_ntpctrl_clk_status_code,
1786 NULL
1789 proto_tree_add_bitmask(ntp_tree, tvb, 4, hf_ntpctrl_status, ett_ntpctrl_status, clockstatus, ENC_BIG_ENDIAN);
1791 break;
1792 case NTPCTRL_OP_SETTRAP:
1793 case NTPCTRL_OP_UNSETTRAP:
1794 default:
1795 proto_tree_add_item(ntp_tree, hf_ntpctrl_status, tvb, 4, 2, ENC_BIG_ENDIAN);
1796 break;
1800 else
1802 if (!PINFO_FD_VISITED(pinfo)) {
1803 ntp_trans = wmem_new(wmem_file_scope(), ntp_trans_info_t);
1804 ntp_trans->req_frame = pinfo->num;
1805 ntp_trans->resp_frame = 0;
1806 ntp_trans->req_time = pinfo->abs_ts;
1807 ntp_trans->seq = seq;
1808 wmem_tree_insert32_array(ntp_conv->trans, key, (void *)ntp_trans);
1809 } else {
1810 ntp_trans = (ntp_trans_info_t *)wmem_tree_lookup32_array_le(ntp_conv->trans, key);
1811 if (ntp_trans && ntp_trans->resp_frame != 0 && ntp_trans->seq == seq) {
1812 proto_item *resp_it;
1814 resp_it = proto_tree_add_uint(ntp_tree, hf_ntp_response_in, tvb, 0, 0, ntp_trans->resp_frame);
1815 proto_item_set_generated(resp_it);
1818 proto_tree_add_item(ntp_tree, hf_ntpctrl_status, tvb, 4, 2, ENC_BIG_ENDIAN);
1820 proto_tree_add_item(ntp_tree, hf_ntpctrl_associd, tvb, 6, 2, ENC_BIG_ENDIAN);
1821 proto_tree_add_item(ntp_tree, hf_ntpctrl_offset, tvb, 8, 2, ENC_BIG_ENDIAN);
1822 datalen = tvb_get_ntohs(tvb, 10);
1823 proto_tree_add_uint(ntp_tree, hf_ntpctrl_count, tvb, 10, 2, datalen);
1826 * dissect Data part of the NTP control message
1828 if (datalen) {
1829 data_offset = 12;
1830 td = proto_tree_add_item(ntp_tree, hf_ntpctrl_data, tvb, data_offset, datalen, ENC_NA);
1831 data_tree = proto_item_add_subtree(td, ett_ntpctrl_data);
1832 switch(flags2 & NTPCTRL_OP_MASK) {
1833 case NTPCTRL_OP_READSTAT:
1834 if (!associd) {
1836 * if associd == 0 then data part contains a list of the form
1837 * <association identifier><status word>,
1839 while(datalen) {
1840 ti = proto_tree_add_item(data_tree, hf_ntpctrl_item, tvb, data_offset, 4, ENC_NA);
1841 item_tree = proto_item_add_subtree(ti, ett_ntpctrl_item);
1842 proto_tree_add_item(item_tree, hf_ntpctrl_associd, tvb, data_offset, 2, ENC_BIG_ENDIAN);
1843 data_offset += 2;
1844 proto_tree_add_bitmask(ntp_tree, tvb, data_offset, hf_ntpctrl_status, ett_ntpctrl_status, peer_status_flags, ENC_BIG_ENDIAN);
1845 data_offset += 2;
1846 datalen -= 4;
1848 break;
1851 * but if associd != 0,
1852 * then data part could be the same as if opcode is NTPCTRL_OP_READVAR
1853 * --> so, no "break" here!
1855 /* FALL THROUGH */
1856 case NTPCTRL_OP_READVAR:
1857 case NTPCTRL_OP_WRITEVAR:
1858 case NTPCTRL_OP_READCLOCK:
1859 case NTPCTRL_OP_WRITECLOCK:
1860 tt = tvbparse_init(pinfo->pool, tvb, data_offset, datalen, NULL, want_ignore);
1861 while( (element = tvbparse_get(tt, want)) != NULL ) {
1862 tvbparse_tree_add_elem(data_tree, element);
1864 break;
1865 case NTPCTRL_OP_ASYNCMSG:
1866 proto_tree_add_item(data_tree, hf_ntpctrl_trapmsg, tvb, data_offset, datalen, ENC_ASCII);
1867 break;
1868 case NTPCTRL_OP_CONFIGURE:
1869 case NTPCTRL_OP_SAVECONFIG:
1870 proto_tree_add_item(data_tree, hf_ntpctrl_configuration, tvb, data_offset, datalen, ENC_ASCII);
1871 auth_diss = true;
1872 break;
1873 case NTPCTRL_OP_READ_MRU:
1874 proto_tree_add_item(data_tree, hf_ntpctrl_mru, tvb, data_offset, datalen, ENC_ASCII);
1875 auth_diss = true;
1876 break;
1877 case NTPCTRL_OP_READ_ORDLIST_A:
1878 proto_tree_add_item(data_tree, hf_ntpctrl_ordlist, tvb, data_offset, datalen, ENC_ASCII);
1879 auth_diss = true;
1880 break;
1881 case NTPCTRL_OP_REQ_NONCE:
1882 proto_tree_add_item(data_tree, hf_ntpctrl_nonce, tvb, data_offset, datalen, ENC_ASCII);
1883 auth_diss = true;
1884 break;
1885 /* these opcodes doesn't carry any data: NTPCTRL_OP_SETTRAP, NTPCTRL_OP_UNSETTRAP, NTPCTRL_OP_UNSPEC */
1889 data_offset = 12+datalen;
1891 /* Check if there is authentication */
1892 if (((flags2 & NTPCTRL_R_MASK) == 0) || auth_diss == true)
1894 int padding_length;
1896 length_remaining = tvb_reported_length_remaining(tvb, data_offset);
1897 /* Check padding presence */
1898 padding_length = (data_offset & 7) ? 8 - (data_offset & 7) : 0;
1899 if (length_remaining > padding_length)
1901 if (padding_length)
1903 proto_tree_add_item(ntp_tree, hf_ntp_padding, tvb, data_offset, padding_length, ENC_NA);
1904 data_offset += padding_length;
1905 length_remaining -= padding_length;
1907 auth_tree = proto_tree_add_subtree(ntp_tree, tvb, data_offset, -1, ett_ntp_authenticator, NULL, "Authenticator");
1908 switch (length_remaining)
1910 case 20:
1911 ti = proto_tree_add_uint(auth_tree, hf_ntp_key_type, tvb, data_offset, 0, NTP_MD5_ALGO);
1912 proto_item_set_generated(ti);
1913 proto_tree_add_item(auth_tree, hf_ntp_key_index, tvb, data_offset, 4, ENC_BIG_ENDIAN);
1914 proto_tree_add_item(auth_tree, hf_ntp_key_signature, tvb, data_offset+4, 16, ENC_NA);
1915 break;
1916 case 24:
1917 ti = proto_tree_add_uint(auth_tree, hf_ntp_key_type, tvb, data_offset, 0, NTP_SHA_ALGO);
1918 proto_item_set_generated(ti);
1919 proto_tree_add_item(auth_tree, hf_ntp_key_index, tvb, data_offset, 4, ENC_BIG_ENDIAN);
1920 proto_tree_add_item(auth_tree, hf_ntp_key_signature, tvb, data_offset+4, 20, ENC_NA);
1921 break;
1928 * Initialize tvb-parser, which is used to dissect data part of NTP control
1929 * messages
1931 * Here some constants are defined, which describes character groups used for
1932 * various purposes. These groups are then used to configure the two global
1933 * variables "want_ignore" and "want" that we use for dissection
1935 static void
1936 init_parser(void)
1938 /* specify what counts as character */
1939 tvbparse_wanted_t *want_identifier_str = tvbparse_chars(-1, 1, 0,
1940 "abcdefghijklmnopqrstuvwxyz-_ABCDEFGHIJKLMNOPQRSTUVWXYZ.0123456789", NULL, NULL, NULL);
1941 /* this is the equal sign used in assignments */
1942 tvbparse_wanted_t *want_equalsign = tvbparse_char(-1, "=", NULL, NULL, NULL);
1943 /* possible characters allowed for values */
1944 tvbparse_wanted_t *want_value = tvbparse_set_oneof(0, NULL, NULL, NULL,
1945 tvbparse_quoted(-1, NULL, NULL, tvbparse_shrink_token_cb, '\"', '\\'),
1946 tvbparse_quoted(-1, NULL, NULL, tvbparse_shrink_token_cb, '\'', '\\'),
1947 tvbparse_chars(-1, 1, 0, "abcdefghijklmnopqrstuvwxyz-_ABCDEFGHIJKLMNOPQRSTUVWXYZ.0123456789 ", NULL, NULL, NULL),
1948 NULL);
1949 tvbparse_wanted_t *want_comma = tvbparse_until(-1, NULL, NULL, NULL,
1950 tvbparse_char(-1, ",", NULL, NULL, NULL), TP_UNTIL_SPEND);
1951 /* the following specifies an identifier */
1952 tvbparse_wanted_t *want_identifier = tvbparse_set_seq(-1, NULL, NULL, NULL,
1953 want_identifier_str,
1954 tvbparse_some(-1, 0, 1, NULL, NULL, NULL, want_comma),
1955 NULL);
1956 /* the following specifies an assignment of the form identifier=value */
1957 tvbparse_wanted_t *want_assignment = tvbparse_set_seq(-1, NULL, NULL, NULL,
1958 want_identifier_str,
1959 want_equalsign,
1960 tvbparse_some(-1, 0, 1, NULL, NULL, NULL, want_value),
1961 tvbparse_some(-1, 0, 1, NULL, NULL, NULL, want_comma),
1962 NULL);
1964 /* we ignore white space characters */
1965 want_ignore = tvbparse_chars(-1, 1, 0, " \t\r\n", NULL, NULL, NULL);
1966 /* data part of control messages consists of either identifiers or assignments */
1967 want = tvbparse_set_oneof(-1, NULL, NULL, NULL,
1968 want_assignment,
1969 want_identifier,
1970 NULL);
1973 static void
1974 dissect_ntp_priv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *ntp_tree, ntp_conv_info_t *ntp_conv)
1976 uint32_t impl, reqcode;
1977 uint64_t flags, auth_seq;
1978 ntp_trans_info_t *ntp_trans;
1979 wmem_tree_key_t key[3];
1980 uint32_t seq;
1982 static int * const priv_flags[] = {
1983 &hf_ntppriv_flags_r,
1984 &hf_ntppriv_flags_more,
1985 &hf_ntp_flags_vn,
1986 &hf_ntp_flags_mode,
1987 NULL
1990 static int * const auth_flags[] = {
1991 &hf_ntppriv_auth,
1992 &hf_ntppriv_seq,
1993 NULL
1996 proto_tree_add_bitmask_ret_uint64(ntp_tree, tvb, 0, hf_ntp_flags, ett_ntp_flags, priv_flags, ENC_NA, &flags);
1997 proto_tree_add_bitmask_ret_uint64(ntp_tree, tvb, 1, hf_ntppriv_auth_seq, ett_ntppriv_auth_seq, auth_flags, ENC_NA, &auth_seq);
1998 proto_tree_add_item_ret_uint(ntp_tree, hf_ntppriv_impl, tvb, 2, 1, ENC_NA, &impl);
1999 proto_tree_add_item_ret_uint(ntp_tree, hf_ntppriv_reqcode, tvb, 3, 1, ENC_NA, &reqcode);
2001 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s, %s",
2002 (flags & NTPPRIV_R_MASK) ? "Response" : "Request",
2003 val_to_str_ext_const(reqcode, &priv_rc_types_ext, "Unknown"));
2006 seq = 0xff000000 | impl;
2007 key[0].length = 1;
2008 key[0].key = &seq;
2009 key[1].length = 1;
2010 key[1].key = &pinfo->num;
2011 key[2].length = 0;
2012 key[2].key = NULL;
2014 if (flags & NTPPRIV_R_MASK) {
2015 /* response */
2016 ntp_trans = (ntp_trans_info_t *)wmem_tree_lookup32_array_le(ntp_conv->trans, key);
2017 if (ntp_trans && ntp_trans->seq == seq) {
2018 if (!PINFO_FD_VISITED(pinfo)) {
2019 if (ntp_trans->resp_frame == 0) {
2020 ntp_trans->resp_frame = pinfo->num;
2022 } else {
2023 proto_item *req_it;
2024 nstime_t delta;
2026 req_it = proto_tree_add_uint(ntp_tree, hf_ntp_request_in, tvb, 0, 0, ntp_trans->req_frame);
2027 proto_item_set_generated(req_it);
2028 nstime_delta(&delta, &pinfo->abs_ts, &ntp_trans->req_time);
2029 req_it = proto_tree_add_time(ntp_tree, hf_ntp_delta_time, tvb, 0, 0, &delta);
2030 proto_item_set_generated(req_it);
2033 } else {
2034 /* request */
2035 if (!PINFO_FD_VISITED(pinfo)) {
2036 ntp_trans = wmem_new(wmem_file_scope(), ntp_trans_info_t);
2037 ntp_trans->req_frame = pinfo->num;
2038 ntp_trans->resp_frame = 0;
2039 ntp_trans->req_time = pinfo->abs_ts;
2040 ntp_trans->seq = seq;
2041 wmem_tree_insert32_array(ntp_conv->trans, key, (void *)ntp_trans);
2042 } else {
2043 ntp_trans = (ntp_trans_info_t *)wmem_tree_lookup32_array_le(ntp_conv->trans, key);
2044 if (ntp_trans && ntp_trans->resp_frame != 0 && ntp_trans->seq == seq) {
2045 proto_item *resp_it;
2047 resp_it = proto_tree_add_uint(ntp_tree, hf_ntp_response_in, tvb, 0, 0, ntp_trans->resp_frame);
2048 proto_item_set_generated(resp_it);
2053 if (impl == XNTPD) {
2055 uint64_t numitems;
2056 uint64_t itemsize;
2057 uint16_t offset;
2058 unsigned i;
2060 uint32_t v6_flag = 0;
2062 proto_item *mode7_item;
2063 proto_tree *mode7_item_tree = NULL;
2065 proto_tree_add_bits_item(ntp_tree, hf_ntppriv_errcode, tvb, 32, 4, ENC_BIG_ENDIAN);
2066 proto_tree_add_bits_ret_val(ntp_tree, hf_ntppriv_numitems, tvb, 36, 12, &numitems, ENC_BIG_ENDIAN);
2067 proto_tree_add_bits_item(ntp_tree, hf_ntppriv_mbz, tvb, 48, 4, ENC_BIG_ENDIAN);
2068 proto_tree_add_bits_ret_val(ntp_tree, hf_ntppriv_itemsize, tvb, 52, 12, &itemsize, ENC_BIG_ENDIAN);
2070 for (i = 0; i < (uint16_t)numitems; i++) {
2072 offset = 8 + (uint16_t)itemsize * i;
2074 if ((reqcode != PRIV_RC_MON_GETLIST) && (reqcode != PRIV_RC_MON_GETLIST_1)) {
2075 mode7_item = proto_tree_add_string_format(ntp_tree, hf_ntppriv_mode7_item, tvb, offset,(int)itemsize,
2076 "", "%s Item", val_to_str_ext_const(reqcode, &priv_rc_types_ext, "Unknown") );
2077 mode7_item_tree = proto_item_add_subtree(mode7_item, ett_mode7_item);
2080 switch (reqcode) {
2081 case PRIV_RC_MON_GETLIST:
2082 case PRIV_RC_MON_GETLIST_1:
2084 mode7_item = proto_tree_add_string_format(ntp_tree, hf_ntppriv_mode7_item, tvb, offset,
2085 (int)itemsize, "Monlist Item", "Monlist item: address: %s:%u",
2086 tvb_ip_to_str(pinfo->pool, tvb, offset + 16), tvb_get_ntohs(tvb, offset + ((reqcode == PRIV_RC_MON_GETLIST_1) ? 28 : 20)));
2087 mode7_item_tree = proto_item_add_subtree(mode7_item, ett_mode7_item);
2089 proto_tree_add_item(mode7_item_tree, hf_ntppriv_avgint, tvb, offset, 4, ENC_BIG_ENDIAN);
2090 offset += 4;
2091 proto_tree_add_item(mode7_item_tree, hf_ntppriv_lsint, tvb, offset, 4, ENC_BIG_ENDIAN);
2092 offset += 4;
2093 proto_tree_add_item(mode7_item_tree, hf_ntppriv_restr, tvb, offset, 4, ENC_BIG_ENDIAN);
2094 offset += 4;
2095 proto_tree_add_item(mode7_item_tree, hf_ntppriv_count, tvb, offset, 4, ENC_BIG_ENDIAN);
2096 offset += 4;
2097 proto_tree_add_item(mode7_item_tree, hf_ntppriv_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
2098 offset += 4;
2099 if (reqcode == PRIV_RC_MON_GETLIST_1) {
2100 proto_tree_add_item(mode7_item_tree, hf_ntppriv_daddr, tvb, offset, 4, ENC_BIG_ENDIAN);
2101 offset += 4;
2102 proto_tree_add_item(mode7_item_tree, hf_ntppriv_flags, tvb, offset, 4, ENC_BIG_ENDIAN);
2103 offset += 4;
2105 proto_tree_add_item(mode7_item_tree, hf_ntppriv_port, tvb, offset, 2, ENC_BIG_ENDIAN);
2106 offset += 2;
2107 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode, tvb, offset, 1, ENC_BIG_ENDIAN);
2108 offset += 1;
2109 proto_tree_add_item(mode7_item_tree, hf_ntppriv_version, tvb, offset, 1, ENC_BIG_ENDIAN);
2110 offset += 1;
2111 proto_tree_add_item_ret_uint(mode7_item_tree, hf_ntppriv_v6_flag, tvb, offset, 4, ENC_BIG_ENDIAN, &v6_flag);
2112 offset += 4;
2113 proto_tree_add_item(mode7_item_tree, hf_ntppriv_unused, tvb, offset, 4, ENC_BIG_ENDIAN);
2114 offset += 4;
2115 if (v6_flag != 0) {
2116 proto_tree_add_item(mode7_item_tree, hf_ntppriv_addr6, tvb, offset, 16, ENC_NA);
2117 offset += 16;
2118 if (reqcode == PRIV_RC_MON_GETLIST_1)
2119 proto_tree_add_item(mode7_item_tree, hf_ntppriv_daddr6, tvb, offset, 16, ENC_NA);
2121 break;
2123 case PRIV_RC_PEER_LIST:
2125 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
2126 offset += 4;
2127 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_port, tvb, offset, 2, ENC_BIG_ENDIAN);
2128 offset += 2;
2129 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_hmode, tvb, offset, 1, ENC_BIG_ENDIAN);
2130 offset += 1;
2131 proto_tree_add_bitmask(mode7_item_tree, tvb, offset, hf_ntppriv_mode7_peer_flags, ett_ntppriv_peer_list_flags, ntppriv_peer_list_flags, ENC_BIG_ENDIAN);
2132 offset += 1;
2133 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_v6_flag, tvb, offset, 4, ENC_BIG_ENDIAN);
2134 offset += 4;
2135 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 4, ENC_NA);
2136 offset += 4;
2137 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_addr6, tvb, offset, 16, ENC_NA);
2138 break;
2140 case PRIV_RC_PEER_LIST_SUM:
2142 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_dstaddr, tvb, offset, 4, ENC_BIG_ENDIAN);
2143 offset += 4;
2144 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_srcaddr, tvb, offset, 4, ENC_BIG_ENDIAN);
2145 offset += 4;
2146 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_srcport, tvb, offset, 2, ENC_BIG_ENDIAN);
2147 offset += 2;
2148 proto_tree_add_item(mode7_item_tree, hf_ntp_stratum, tvb, offset, 1, ENC_BIG_ENDIAN);
2149 offset += 1;
2150 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_hpoll, tvb, offset, 1, ENC_BIG_ENDIAN);
2151 offset += 1;
2152 proto_tree_add_item(mode7_item_tree, hf_ntp_ppoll, tvb, offset, 1, ENC_BIG_ENDIAN);
2153 offset += 1;
2154 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_reach, tvb, offset, 1, ENC_BIG_ENDIAN);
2155 offset += 1;
2156 proto_tree_add_bitmask(mode7_item_tree, tvb, offset, hf_ntppriv_mode7_peer_flags, ett_ntppriv_peer_list_flags, ntppriv_peer_list_flags, ENC_BIG_ENDIAN);
2157 offset += 1;
2158 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_hmode, tvb, offset, 1, ENC_BIG_ENDIAN);
2159 offset += 1;
2160 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_delay, tvb, offset, 4, ENC_BIG_ENDIAN);
2161 offset += 4;
2162 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_offset, tvb, offset, 8, ENC_BIG_ENDIAN);
2163 offset += 8;
2164 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_dispersion, tvb, offset, 4, ENC_BIG_ENDIAN);
2165 offset += 4;
2166 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_v6_flag, tvb, offset, 4, ENC_BIG_ENDIAN);
2167 offset += 4;
2168 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 4, ENC_NA);
2169 offset += 4;
2170 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_dstaddr6, tvb, offset, 16, ENC_NA);
2171 offset += 16;
2172 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_srcaddr6, tvb, offset, 16, ENC_NA);
2173 break;
2175 case PRIV_RC_PEER_INFO:
2177 if (flags & NTPPRIV_R_MASK) {
2178 /* response */
2179 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_dstaddr, tvb, offset, 4, ENC_BIG_ENDIAN);
2180 offset += 4;
2181 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_srcaddr, tvb, offset, 4, ENC_BIG_ENDIAN);
2182 offset += 4;
2183 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_srcport, tvb, offset, 2, ENC_BIG_ENDIAN);
2184 offset += 2;
2185 proto_tree_add_bitmask(mode7_item_tree, tvb, offset, hf_ntppriv_mode7_peer_flags, ett_ntppriv_peer_list_flags, ntppriv_peer_list_flags, ENC_BIG_ENDIAN);
2186 offset += 1;
2187 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_leap, tvb, offset, 1, ENC_BIG_ENDIAN);
2188 offset += 1;
2189 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_hmode, tvb, offset, 1, ENC_BIG_ENDIAN);
2190 offset += 1;
2191 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_pmode, tvb, offset, 1, ENC_BIG_ENDIAN);
2192 offset += 1;
2193 proto_tree_add_item(mode7_item_tree, hf_ntp_stratum, tvb, offset, 1, ENC_BIG_ENDIAN);
2194 offset += 1;
2195 proto_tree_add_item(mode7_item_tree, hf_ntp_ppoll, tvb, offset, 1, ENC_BIG_ENDIAN);
2196 offset += 1;
2197 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_hpoll, tvb, offset, 1, ENC_BIG_ENDIAN);
2198 offset += 1;
2199 proto_tree_add_item(mode7_item_tree, hf_ntp_precision, tvb, offset, 1, ENC_BIG_ENDIAN);
2200 offset += 1;
2201 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_version, tvb, offset, 1, ENC_BIG_ENDIAN);
2202 offset += 1;
2203 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 1, ENC_NA);
2204 offset += 1;
2205 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_reach, tvb, offset, 1, ENC_BIG_ENDIAN);
2206 offset += 1;
2207 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unreach, tvb, offset, 1, ENC_BIG_ENDIAN);
2208 offset += 1;
2209 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_flash, tvb, offset, 1, ENC_BIG_ENDIAN);
2210 offset += 1;
2211 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_ttl, tvb, offset, 1, ENC_BIG_ENDIAN);
2212 offset += 1;
2213 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_flash2, tvb, offset, 2, ENC_BIG_ENDIAN);
2214 offset += 2;
2215 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_associd, tvb, offset, 2, ENC_BIG_ENDIAN);
2216 offset += 2;
2217 proto_tree_add_item(mode7_item_tree, hf_ntp_keyid, tvb, offset, 4, ENC_NA);
2218 offset += 4;
2219 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_pkeyid, tvb, offset, 4, ENC_BIG_ENDIAN);
2220 offset += 4;
2221 proto_tree_add_item(mode7_item_tree, hf_ntp_refid, tvb, offset, 4, ENC_NA);
2222 offset += 4;
2223 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_timer, tvb, offset, 4, ENC_BIG_ENDIAN);
2224 offset += 4;
2225 proto_tree_add_item(mode7_item_tree, hf_ntp_rootdelay, tvb, offset, 4, ENC_BIG_ENDIAN);
2226 offset += 4;
2227 proto_tree_add_item(mode7_item_tree, hf_ntp_rootdispersion, tvb, offset, 4, ENC_BIG_ENDIAN);
2228 offset += 4;
2229 proto_tree_add_item(mode7_item_tree, hf_ntp_reftime, tvb, offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
2230 offset += 8;
2231 proto_tree_add_item(mode7_item_tree, hf_ntp_org, tvb, offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
2232 offset += 8;
2233 proto_tree_add_item(mode7_item_tree, hf_ntp_rec, tvb, offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
2234 offset += 8;
2235 proto_tree_add_item(mode7_item_tree, hf_ntp_xmt, tvb, offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
2236 offset += 8;
2237 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_filtdelay, tvb, offset, 4, ENC_BIG_ENDIAN);
2238 offset += 4;
2239 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_filtoffset, tvb, offset, 8, ENC_BIG_ENDIAN);
2240 offset += 8;
2241 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_order, tvb, offset, 1, ENC_BIG_ENDIAN);
2242 offset += 1;
2243 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_delay, tvb, offset, 4, ENC_BIG_ENDIAN);
2244 offset += 4;
2245 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_dispersion, tvb, offset, 4, ENC_BIG_ENDIAN);
2246 offset += 4;
2247 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_offset, tvb, offset, 8, ENC_BIG_ENDIAN);
2248 offset += 8;
2249 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_selectdis, tvb, offset, 4, ENC_BIG_ENDIAN);
2250 offset += 4;
2251 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 4, ENC_NA);
2252 offset += 4;
2253 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 4, ENC_NA);
2254 offset += 4;
2255 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 4, ENC_NA);
2256 offset += 4;
2257 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 4, ENC_NA);
2258 offset += 4;
2259 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 4, ENC_NA);
2260 offset += 4;
2261 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 4, ENC_NA);
2262 offset += 4;
2263 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 4, ENC_NA);
2264 offset += 4;
2265 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_estbdelay, tvb, offset, 4, ENC_BIG_ENDIAN);
2266 offset += 4;
2267 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_v6_flag, tvb, offset, 4, ENC_BIG_ENDIAN);
2268 offset += 4;
2269 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 4, ENC_NA);
2270 offset += 4;
2271 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_dstaddr6, tvb, offset, 16, ENC_NA);
2272 offset += 16;
2273 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_srcaddr6, tvb, offset, 16, ENC_NA);
2274 } else {
2275 /* request */
2276 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
2277 offset += 4;
2278 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_port, tvb, offset, 2, ENC_BIG_ENDIAN);
2279 offset += 2;
2280 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_hmode, tvb, offset, 1, ENC_BIG_ENDIAN);
2281 offset += 1;
2282 proto_tree_add_bitmask(mode7_item_tree, tvb, offset, hf_ntppriv_mode7_peer_flags, ett_ntppriv_peer_list_flags, ntppriv_peer_list_flags, ENC_BIG_ENDIAN);
2283 offset += 1;
2284 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_v6_flag, tvb, offset, 4, ENC_BIG_ENDIAN);
2285 offset += 4;
2286 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 4, ENC_NA);
2287 offset += 4;
2288 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_addr6, tvb, offset, 16, ENC_NA);
2290 break;
2292 case PRIV_RC_PEER_STATS:
2294 if (flags & NTPPRIV_R_MASK) {
2295 /* response */
2296 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_dstaddr, tvb, offset, 4, ENC_BIG_ENDIAN);
2297 offset += 4;
2298 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_srcaddr, tvb, offset, 4, ENC_BIG_ENDIAN);
2299 offset += 4;
2300 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_srcport, tvb, offset, 2, ENC_BIG_ENDIAN);
2301 offset += 2;
2302 proto_tree_add_bitmask(mode7_item_tree, tvb, offset, hf_ntppriv_mode7_peer_flags, ett_ntppriv_peer_list_flags, ntppriv_peer_list_flags, ENC_BIG_ENDIAN);
2303 offset += 1;
2304 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_timereset, tvb, offset, 4, ENC_BIG_ENDIAN);
2305 offset += 4;
2306 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_timereceived, tvb, offset, 4, ENC_BIG_ENDIAN);
2307 offset += 4;
2308 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_timetosend, tvb, offset, 4, ENC_BIG_ENDIAN);
2309 offset += 4;
2310 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_timereachable, tvb, offset, 4, ENC_BIG_ENDIAN);
2311 offset += 4;
2312 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_sent, tvb, offset, 4, ENC_BIG_ENDIAN);
2313 offset += 4;
2314 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 4, ENC_NA);
2315 offset += 4;
2316 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_processed, tvb, offset, 4, ENC_BIG_ENDIAN);
2317 offset += 4;
2318 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 4, ENC_NA);
2319 offset += 4;
2320 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_badauth, tvb, offset, 4, ENC_BIG_ENDIAN);
2321 offset += 4;
2322 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_bogusorg, tvb, offset, 4, ENC_BIG_ENDIAN);
2323 offset += 4;
2324 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_oldpkt, tvb, offset, 4, ENC_BIG_ENDIAN);
2325 offset += 4;
2326 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 4, ENC_NA);
2327 offset += 4;
2328 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 4, ENC_NA);
2329 offset += 4;
2330 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_seldisp, tvb, offset, 4, ENC_BIG_ENDIAN);
2331 offset += 4;
2332 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_selbroken, tvb, offset, 4, ENC_BIG_ENDIAN);
2333 offset += 4;
2334 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 4, ENC_NA);
2335 offset += 4;
2336 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_candidate, tvb, offset, 1, ENC_BIG_ENDIAN);
2337 offset += 1;
2338 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 1, ENC_NA);
2339 offset += 1;
2340 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 1, ENC_NA);
2341 offset += 1;
2342 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 1, ENC_NA);
2343 offset += 1;
2344 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_v6_flag, tvb, offset, 4, ENC_BIG_ENDIAN);
2345 offset += 4;
2346 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 4, ENC_NA);
2347 offset += 4;
2348 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_dstaddr6, tvb, offset, 16, ENC_NA);
2349 offset += 16;
2350 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_srcaddr6, tvb, offset, 16, ENC_NA);
2351 } else {
2352 /* request */
2353 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
2354 offset += 4;
2355 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_port, tvb, offset, 2, ENC_BIG_ENDIAN);
2356 offset += 2;
2357 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_hmode, tvb, offset, 1, ENC_BIG_ENDIAN);
2358 offset += 1;
2359 proto_tree_add_bitmask(mode7_item_tree, tvb, offset, hf_ntppriv_mode7_peer_flags, ett_ntppriv_peer_list_flags, ntppriv_peer_list_flags, ENC_BIG_ENDIAN);
2360 offset += 1;
2361 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_v6_flag, tvb, offset, 4, ENC_BIG_ENDIAN);
2362 offset += 4;
2363 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 4, ENC_NA);
2364 offset += 4;
2365 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_addr6, tvb, offset, 16, ENC_NA);
2367 break;
2369 case PRIV_RC_SYS_INFO:
2370 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
2371 offset += 4;
2372 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_pmode, tvb, offset, 1, ENC_BIG_ENDIAN);
2373 offset += 1;
2374 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_leap, tvb, offset, 1, ENC_BIG_ENDIAN);
2375 offset += 1;
2376 proto_tree_add_item(mode7_item_tree, hf_ntp_stratum, tvb, offset, 1, ENC_BIG_ENDIAN);
2377 offset += 1;
2378 proto_tree_add_item(mode7_item_tree, hf_ntp_precision, tvb, offset, 1, ENC_BIG_ENDIAN);
2379 offset += 1;
2380 proto_tree_add_item(mode7_item_tree, hf_ntp_rootdelay, tvb, offset, 4, ENC_BIG_ENDIAN);
2381 offset += 4;
2382 proto_tree_add_item(mode7_item_tree, hf_ntp_rootdispersion, tvb, offset, 4, ENC_BIG_ENDIAN);
2383 offset += 4;
2384 proto_tree_add_item(mode7_item_tree, hf_ntp_refid, tvb, offset, 4, ENC_NA);
2385 offset += 4;
2386 proto_tree_add_item(mode7_item_tree, hf_ntp_reftime, tvb, offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
2387 offset += 8;
2388 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_poll32, tvb, offset, 4, ENC_BIG_ENDIAN);
2389 offset += 4;
2390 proto_tree_add_bitmask(mode7_item_tree, tvb, offset, hf_ntppriv_mode7_sys_flags8, ett_ntppriv_sys_flag_flags, ntppriv_sys_flag_flags, ENC_BIG_ENDIAN);
2391 offset += 1;
2392 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 3, ENC_NA);
2393 offset += 3;
2394 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_bdelay, tvb, offset, 4, ENC_BIG_ENDIAN);
2395 offset += 4;
2396 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_freq, tvb, offset, 4, ENC_BIG_ENDIAN);
2397 offset += 4;
2398 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_authdelay, tvb, offset, 8, ENC_BIG_ENDIAN);
2399 offset += 8;
2400 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_stability, tvb, offset, 4, ENC_BIG_ENDIAN);
2401 offset += 4;
2402 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_v6_flag, tvb, offset, 4, ENC_BIG_ENDIAN);
2403 offset += 4;
2404 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 4, ENC_NA);
2405 offset += 4;
2406 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_addr6, tvb, offset, 16, ENC_NA);
2407 break;
2409 case PRIV_RC_SYS_STATS:
2410 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_timeup, tvb, offset, 4, ENC_BIG_ENDIAN);
2411 offset += 4;
2412 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_timereset, tvb, offset, 4, ENC_BIG_ENDIAN);
2413 offset += 4;
2414 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_denied, tvb, offset, 4, ENC_BIG_ENDIAN);
2415 offset += 4;
2416 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_oldversion, tvb, offset, 4, ENC_BIG_ENDIAN);
2417 offset += 4;
2418 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_newversion, tvb, offset, 4, ENC_BIG_ENDIAN);
2419 offset += 4;
2420 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_badversion, tvb, offset, 4, ENC_BIG_ENDIAN);
2421 offset += 4;
2422 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_badlength, tvb, offset, 4, ENC_BIG_ENDIAN);
2423 offset += 4;
2424 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_processed, tvb, offset, 4, ENC_BIG_ENDIAN);
2425 offset += 4;
2426 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_badauth, tvb, offset, 4, ENC_BIG_ENDIAN);
2427 offset += 4;
2428 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_timereceived, tvb, offset, 4, ENC_BIG_ENDIAN);
2429 offset += 4;
2430 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_limitrejected, tvb, offset, 4, ENC_BIG_ENDIAN);
2431 offset += 4;
2432 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_lamport, tvb, offset, 4, ENC_BIG_ENDIAN);
2433 offset += 4;
2434 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_tsrounding, tvb, offset, 4, ENC_BIG_ENDIAN);
2435 break;
2437 case PRIV_RC_IO_STATS:
2438 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_timereset, tvb, offset, 4, ENC_BIG_ENDIAN);
2439 offset += 4;
2440 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_totalrecvbufs, tvb, offset, 2, ENC_BIG_ENDIAN);
2441 offset += 2;
2442 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_freerecvbufs, tvb, offset, 2, ENC_BIG_ENDIAN);
2443 offset += 2;
2444 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_fullrecvbufs, tvb, offset, 2, ENC_BIG_ENDIAN);
2445 offset += 2;
2446 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_lowwater, tvb, offset, 2, ENC_BIG_ENDIAN);
2447 offset += 2;
2448 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_dropped, tvb, offset, 4, ENC_BIG_ENDIAN);
2449 offset += 4;
2450 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_ignored, tvb, offset, 4, ENC_BIG_ENDIAN);
2451 offset += 4;
2452 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_received, tvb, offset, 4, ENC_BIG_ENDIAN);
2453 offset += 4;
2454 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_sent, tvb, offset, 4, ENC_BIG_ENDIAN);
2455 offset += 4;
2456 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_notsent, tvb, offset, 4, ENC_BIG_ENDIAN);
2457 offset += 4;
2458 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_interrupts, tvb, offset, 4, ENC_BIG_ENDIAN);
2459 offset += 4;
2460 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_int_received, tvb, offset, 4, ENC_BIG_ENDIAN);
2461 break;
2463 case PRIV_RC_MEM_STATS:
2464 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_timereset, tvb, offset, 4, ENC_BIG_ENDIAN);
2465 offset += 4;
2466 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_totalmem, tvb, offset, 2, ENC_BIG_ENDIAN);
2467 offset += 2;
2468 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_freemem, tvb, offset, 2, ENC_BIG_ENDIAN);
2469 offset += 2;
2470 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_findpeer_calls, tvb, offset, 4, ENC_BIG_ENDIAN);
2471 offset += 4;
2472 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_allocations, tvb, offset, 4, ENC_BIG_ENDIAN);
2473 offset += 4;
2474 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_demobilizations, tvb, offset, 4, ENC_BIG_ENDIAN);
2475 offset += 4;
2476 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_hashcount, tvb, offset, (int)itemsize - 20, ENC_NA);
2477 break;
2479 case PRIV_RC_LOOP_INFO:
2480 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_last_offset, tvb, offset, 8, ENC_BIG_ENDIAN);
2481 offset += 8;
2482 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_drift_comp, tvb, offset, 8, ENC_BIG_ENDIAN);
2483 offset += 8;
2484 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_compliance, tvb, offset, 4, ENC_BIG_ENDIAN);
2485 offset += 4;
2486 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_watchdog_timer, tvb, offset, 4, ENC_BIG_ENDIAN);
2487 break;
2489 case PRIV_RC_TIMER_STATS:
2490 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_timereset, tvb, offset, 4, ENC_BIG_ENDIAN);
2491 offset += 4;
2492 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_alarms, tvb, offset, 4, ENC_BIG_ENDIAN);
2493 offset += 4;
2494 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_overflows, tvb, offset, 4, ENC_BIG_ENDIAN);
2495 offset += 4;
2496 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_xmtcalls, tvb, offset, 4, ENC_BIG_ENDIAN);
2497 break;
2499 case PRIV_RC_CONFIG:
2501 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
2502 offset += 4;
2503 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_hmode, tvb, offset, 1, ENC_BIG_ENDIAN);
2504 offset += 1;
2505 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_version, tvb, offset, 1, ENC_BIG_ENDIAN);
2506 offset += 1;
2507 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_minpoll, tvb, offset, 1, ENC_BIG_ENDIAN);
2508 offset += 1;
2509 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_maxpoll, tvb, offset, 1, ENC_BIG_ENDIAN);
2510 offset += 1;
2511 proto_tree_add_bitmask(mode7_item_tree, tvb, offset, hf_ntppriv_mode7_config_flags, ett_ntppriv_config_flags, ntppriv_config_flags, ENC_BIG_ENDIAN);
2512 offset += 1;
2513 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_ttl, tvb, offset, 1, ENC_BIG_ENDIAN);
2514 offset += 1;
2515 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 2, ENC_NA);
2516 offset += 2;
2517 proto_tree_add_item(mode7_item_tree, hf_ntp_keyid, tvb, offset, 4, ENC_NA);
2518 offset += 4;
2519 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_key_file, tvb, offset, 128, ENC_ASCII);
2520 offset += 128;
2521 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_v6_flag, tvb, offset, 4, ENC_BIG_ENDIAN);
2522 offset += 4;
2523 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 4, ENC_NA);
2524 offset += 4;
2525 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_addr6, tvb, offset, 16, ENC_NA);
2526 break;
2528 case PRIV_RC_UNCONFIG:
2530 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
2531 offset += 4;
2532 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_v6_flag, tvb, offset, 4, ENC_BIG_ENDIAN);
2533 offset += 4;
2534 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_addr6, tvb, offset, 16, ENC_NA);
2535 break;
2537 case PRIV_RC_SET_SYS_FLAG:
2538 case PRIV_RC_CLR_SYS_FLAG:
2540 proto_tree_add_bitmask(mode7_item_tree, tvb, offset, hf_ntppriv_mode7_sys_flags, ett_ntppriv_sys_flag_flags, ntppriv_sys_flag_flags, ENC_BIG_ENDIAN);
2541 break;
2543 case PRIV_RC_GET_RESTRICT:
2544 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
2545 offset += 4;
2546 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_mask, tvb, offset, 4, ENC_BIG_ENDIAN);
2547 offset += 4;
2548 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_count, tvb, offset, 4, ENC_BIG_ENDIAN);
2549 offset += 4;
2550 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_rflags, tvb, offset, 2, ENC_BIG_ENDIAN);
2551 offset += 2;
2552 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_mflags, tvb, offset, 2, ENC_BIG_ENDIAN);
2553 offset += 2;
2554 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_v6_flag, tvb, offset, 4, ENC_BIG_ENDIAN);
2555 offset += 4;
2556 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 4, ENC_NA);
2557 offset += 4;
2558 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_addr6, tvb, offset, 16, ENC_NA);
2559 offset += 16;
2560 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_mask6, tvb, offset, 16, ENC_NA);
2561 break;
2563 case PRIV_RC_RESADDFLAGS:
2564 case PRIV_RC_RESSUBFLAGS:
2565 case PRIV_RC_UNRESTRICT:
2566 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
2567 offset += 4;
2568 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_mask, tvb, offset, 4, ENC_BIG_ENDIAN);
2569 offset += 4;
2570 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_ippeerlimit, tvb, offset, 2, ENC_BIG_ENDIAN);
2571 offset += 2;
2572 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_restrict_flags, tvb, offset, 2, ENC_BIG_ENDIAN);
2573 offset += 2;
2574 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_mflags, tvb, offset, 2, ENC_BIG_ENDIAN);
2575 offset += 2;
2576 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 4, ENC_NA);
2577 offset += 4;
2578 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_addr6, tvb, offset, 16, ENC_NA);
2579 offset += 16;
2580 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_mask6, tvb, offset, 16, ENC_NA);
2581 break;
2583 case PRIV_RC_RESET_STATS:
2585 proto_tree_add_bitmask(mode7_item_tree, tvb, offset, hf_ntppriv_mode7_reset_stats_flags, ett_ntppriv_reset_stats_flags, ntppriv_reset_stats_flags, ENC_BIG_ENDIAN);
2586 break;
2588 case PRIV_RC_RESET_PEER:
2590 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
2591 offset += 4;
2592 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_v6_flag, tvb, offset, 4, ENC_BIG_ENDIAN);
2593 offset += 4;
2594 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_addr6, tvb, offset, 16, ENC_NA);
2595 break;
2597 case PRIV_RC_TRUSTKEY:
2598 case PRIV_RC_UNTRUSTKEY:
2600 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_key, tvb, offset, 8, ENC_LITTLE_ENDIAN);
2601 break;
2603 case PRIV_RC_AUTHINFO:
2605 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_timereset, tvb, offset, 4, ENC_BIG_ENDIAN);
2606 offset += 4;
2607 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_numkeys, tvb, offset, 4, ENC_BIG_ENDIAN);
2608 offset += 4;
2609 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_numfreekeys, tvb, offset, 4, ENC_BIG_ENDIAN);
2610 offset += 4;
2611 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_keylookups, tvb, offset, 4, ENC_BIG_ENDIAN);
2612 offset += 4;
2613 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_keynotfound, tvb, offset, 4, ENC_BIG_ENDIAN);
2614 offset += 4;
2615 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_encryptions, tvb, offset, 4, ENC_BIG_ENDIAN);
2616 offset += 4;
2617 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_decryptions, tvb, offset, 4, ENC_BIG_ENDIAN);
2618 offset += 4;
2619 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_expired, tvb, offset, 4, ENC_BIG_ENDIAN);
2620 offset += 4;
2621 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_keyuncached, tvb, offset, 4, ENC_BIG_ENDIAN);
2622 break;
2624 case PRIV_RC_TRAPS:
2626 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_local_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
2627 offset += 4;
2628 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_trap_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
2629 offset += 4;
2630 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_trap_port, tvb, offset, 2, ENC_BIG_ENDIAN);
2631 offset += 2;
2632 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_sequence, tvb, offset, 2, ENC_BIG_ENDIAN);
2633 offset += 2;
2634 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_settime, tvb, offset, 4, ENC_BIG_ENDIAN);
2635 offset += 4;
2636 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_origtime, tvb, offset, 4, ENC_BIG_ENDIAN);
2637 offset += 4;
2638 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_resets, tvb, offset, 4, ENC_BIG_ENDIAN);
2639 offset += 4;
2640 proto_tree_add_item(mode7_item_tree, hf_ntppriv_traps_flags, tvb, offset, 4, ENC_BIG_ENDIAN);
2641 offset += 4;
2642 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_v6_flag, tvb, offset, 4, ENC_BIG_ENDIAN);
2643 offset += 4;
2644 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_local_addr6, tvb, offset, 16, ENC_NA);
2645 offset += 16;
2646 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_trap_addr6, tvb, offset, 16, ENC_NA);
2647 break;
2649 case PRIV_RC_ADD_TRAP:
2650 case PRIV_RC_CLR_TRAP:
2652 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_local_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
2653 offset += 4;
2654 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_trap_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
2655 offset += 4;
2656 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_trap_port, tvb, offset, 2, ENC_BIG_ENDIAN);
2657 offset += 2;
2658 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 2, ENC_NA);
2659 offset += 2;
2660 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_v6_flag, tvb, offset, 4, ENC_BIG_ENDIAN);
2661 offset += 4;
2662 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_local_addr6, tvb, offset, 16, ENC_NA);
2663 offset += 16;
2664 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_trap_addr6, tvb, offset, 16, ENC_NA);
2665 break;
2667 case PRIV_RC_REQUEST_KEY:
2668 case PRIV_RC_CONTROL_KEY:
2670 proto_tree_add_item(mode7_item_tree, hf_ntp_keyid, tvb, offset, 4, ENC_NA);
2671 break;
2673 case PRIV_RC_CTL_STATS:
2675 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_timereset, tvb, offset, 4, ENC_BIG_ENDIAN);
2676 offset += 4;
2677 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_req, tvb, offset, 4, ENC_BIG_ENDIAN);
2678 offset += 4;
2679 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_badpkts, tvb, offset, 4, ENC_BIG_ENDIAN);
2680 offset += 4;
2681 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_responses, tvb, offset, 4, ENC_BIG_ENDIAN);
2682 offset += 4;
2683 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_frags, tvb, offset, 4, ENC_BIG_ENDIAN);
2684 offset += 4;
2685 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_errors, tvb, offset, 4, ENC_BIG_ENDIAN);
2686 offset += 4;
2687 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_tooshort, tvb, offset, 4, ENC_BIG_ENDIAN);
2688 offset += 4;
2689 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_inputresp, tvb, offset, 4, ENC_BIG_ENDIAN);
2690 offset += 4;
2691 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_inputfrag, tvb, offset, 4, ENC_BIG_ENDIAN);
2692 offset += 4;
2693 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_inputerr, tvb, offset, 4, ENC_BIG_ENDIAN);
2694 offset += 4;
2695 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_badoffset, tvb, offset, 4, ENC_BIG_ENDIAN);
2696 offset += 4;
2697 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_badversion, tvb, offset, 4, ENC_BIG_ENDIAN);
2698 offset += 4;
2699 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_datatooshort, tvb, offset, 4, ENC_BIG_ENDIAN);
2700 offset += 4;
2701 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_badop, tvb, offset, 4, ENC_BIG_ENDIAN);
2702 offset += 4;
2703 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_asyncmsgs, tvb, offset, 4, ENC_BIG_ENDIAN);
2704 break;
2706 case PRIV_RC_GET_CLOCKINFO:
2708 if (flags & NTPPRIV_R_MASK) {
2709 /* response */
2710 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
2711 offset += 4;
2712 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_type, tvb, offset, 1, ENC_BIG_ENDIAN);
2713 offset += 1;
2714 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_clock_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
2715 offset += 1;
2716 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_lastevent, tvb, offset, 1, ENC_BIG_ENDIAN);
2717 offset += 1;
2718 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_currentstatus, tvb, offset, 1, ENC_BIG_ENDIAN);
2719 offset += 1;
2720 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_polls, tvb, offset, 4, ENC_BIG_ENDIAN);
2721 offset += 4;
2722 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_noresponse, tvb, offset, 4, ENC_BIG_ENDIAN);
2723 offset += 4;
2724 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_badformat, tvb, offset, 4, ENC_BIG_ENDIAN);
2725 offset += 4;
2726 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_baddata, tvb, offset, 4, ENC_BIG_ENDIAN);
2727 offset += 4;
2728 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_timestarted, tvb, offset, 4, ENC_BIG_ENDIAN);
2729 offset += 4;
2730 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_fudgetime1, tvb, offset, 8, ENC_BIG_ENDIAN);
2731 offset += 8;
2732 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_fudgetime2, tvb, offset, 8, ENC_BIG_ENDIAN);
2733 offset += 8;
2734 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_fudgeval1, tvb, offset, 4, ENC_BIG_ENDIAN);
2735 offset += 4;
2736 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_fudgeval2, tvb, offset, 4, ENC_BIG_ENDIAN);
2737 } else {
2738 /* request */
2739 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
2741 break;
2743 case PRIV_RC_SET_CLKFUDGE:
2744 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
2745 offset += 4;
2746 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_which, tvb, offset, 4, ENC_BIG_ENDIAN);
2747 offset += 4;
2748 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_fudgetime, tvb, offset, 8, ENC_BIG_ENDIAN);
2749 offset += 8;
2750 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_fudgeval_flags, tvb, offset, 4, ENC_BIG_ENDIAN);
2751 break;
2753 case PRIV_RC_GET_KERNEL:
2755 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_kernel_offset, tvb, offset, 4, ENC_BIG_ENDIAN);
2756 offset += 4;
2757 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_freq, tvb, offset, 4, ENC_BIG_ENDIAN);
2758 offset += 4;
2759 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_maxerror, tvb, offset, 4, ENC_BIG_ENDIAN);
2760 offset += 4;
2761 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_esterror, tvb, offset, 4, ENC_BIG_ENDIAN);
2762 offset += 4;
2763 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_status, tvb, offset, 2, ENC_BIG_ENDIAN);
2764 offset += 2;
2765 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_shift, tvb, offset, 2, ENC_BIG_ENDIAN);
2766 offset += 2;
2767 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_constant, tvb, offset, 4, ENC_BIG_ENDIAN);
2768 offset += 4;
2769 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_precision, tvb, offset, 4, ENC_BIG_ENDIAN);
2770 offset += 4;
2771 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_tolerance, tvb, offset, 4, ENC_BIG_ENDIAN);
2772 offset += 4;
2773 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_ppsfreq, tvb, offset, 4, ENC_BIG_ENDIAN);
2774 offset += 4;
2775 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_jitter, tvb, offset, 4, ENC_BIG_ENDIAN);
2776 offset += 4;
2777 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_stabil, tvb, offset, 4, ENC_BIG_ENDIAN);
2778 offset += 4;
2779 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_jitcnt, tvb, offset, 4, ENC_BIG_ENDIAN);
2780 offset += 4;
2781 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_calcnt, tvb, offset, 4, ENC_BIG_ENDIAN);
2782 offset += 4;
2783 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_errcnt, tvb, offset, 4, ENC_BIG_ENDIAN);
2784 offset += 4;
2785 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_stbcnt, tvb, offset, 4, ENC_BIG_ENDIAN);
2786 break;
2788 case PRIV_RC_GET_CLKBUGINFO:
2789 if (flags & NTPPRIV_R_MASK) {
2790 /* response */
2791 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
2792 offset += 4;
2793 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_nvalues, tvb, offset, 1, ENC_BIG_ENDIAN);
2794 offset += 1;
2795 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_ntimes, tvb, offset, 1, ENC_BIG_ENDIAN);
2796 offset += 1;
2797 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_svalues, tvb, offset, 2, ENC_BIG_ENDIAN);
2798 offset += 2;
2799 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_stimes, tvb, offset, 4, ENC_BIG_ENDIAN);
2800 offset += 4;
2801 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_values, tvb, offset, 64, ENC_NA);
2802 offset += 64;
2803 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_times, tvb, offset, 256, ENC_NA);
2804 } else {
2805 /* request */
2806 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
2808 break;
2810 case PRIV_RC_IF_STATS:
2811 case PRIV_RC_IF_RELOAD:
2812 v6_flag = tvb_get_ntohl(tvb, offset + 48);
2813 if (v6_flag == 0) {
2814 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
2815 offset += 16;
2816 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_bcast, tvb, offset, 4, ENC_BIG_ENDIAN);
2817 offset += 16;
2818 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_mask, tvb, offset, 4, ENC_BIG_ENDIAN);
2819 offset += 16;
2820 } else {
2821 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_addr6, tvb, offset, 16, ENC_NA);
2822 offset += 16;
2823 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_bcast6, tvb, offset, 16, ENC_NA);
2824 offset += 16;
2825 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_mask6, tvb, offset, 16, ENC_NA);
2826 offset += 16;
2828 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_v6_flag, tvb, offset, 4, ENC_BIG_ENDIAN);
2829 offset += 4;
2830 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_int_name, tvb, offset, 32, ENC_ASCII);
2831 offset += 32;
2832 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_int_flags, tvb, offset, 4, ENC_BIG_ENDIAN);
2833 offset += 4;
2834 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_last_ttl, tvb, offset, 4, ENC_BIG_ENDIAN);
2835 offset += 4;
2836 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_num_mcast, tvb, offset, 4, ENC_BIG_ENDIAN);
2837 offset += 4;
2838 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_received, tvb, offset, 4, ENC_BIG_ENDIAN);
2839 offset += 4;
2840 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_sent, tvb, offset, 4, ENC_BIG_ENDIAN);
2841 offset += 4;
2842 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_notsent, tvb, offset, 4, ENC_BIG_ENDIAN);
2843 offset += 4;
2844 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_uptime, tvb, offset, 4, ENC_BIG_ENDIAN);
2845 offset += 4;
2846 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_scopeid, tvb, offset, 4, ENC_BIG_ENDIAN);
2847 offset += 4;
2848 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_ifindex, tvb, offset, 4, ENC_BIG_ENDIAN);
2849 offset += 4;
2850 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_ifnum, tvb, offset, 4, ENC_BIG_ENDIAN);
2851 offset += 4;
2852 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_peercnt, tvb, offset, 4, ENC_BIG_ENDIAN);
2853 offset += 4;
2854 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_family, tvb, offset, 2, ENC_BIG_ENDIAN);
2855 offset += 2;
2856 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_ignore_pkt, tvb, offset, 1, ENC_BIG_ENDIAN);
2857 offset += 1;
2858 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_action, tvb, offset, 1, ENC_BIG_ENDIAN);
2859 offset += 1;
2860 proto_tree_add_item(mode7_item_tree, hf_ntppriv_mode7_unused, tvb, offset, 4, ENC_NA);
2861 break;
2866 if ((flags & NTPPRIV_R_MASK) == 0 && (auth_seq & NTPPRIV_AUTH_MASK)) {
2867 /* request message with authentication bit */
2868 int len;
2869 proto_tree_add_item(ntp_tree, hf_ntppriv_tstamp, tvb, 184, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
2870 proto_tree_add_item(ntp_tree, hf_ntp_keyid, tvb, 192, 4, ENC_NA);
2871 len = tvb_reported_length_remaining(tvb, 196);
2872 if (len)
2873 proto_tree_add_item(ntp_tree, hf_ntp_mac, tvb, 196, len, ENC_NA);
2877 /* dissect_ntp - dissects NTP packet data
2878 * tvb - tvbuff for packet data (IN)
2879 * pinfo - packet info
2880 * proto_tree - resolved protocol tree
2882 static int
2883 dissect_ntp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2885 proto_tree *ntp_tree;
2886 proto_item *ti = NULL;
2887 uint8_t flags;
2888 conversation_t *conversation;
2889 ntp_conv_info_t *ntp_conv;
2890 void (*dissector)(tvbuff_t *, packet_info *, proto_tree *, ntp_conv_info_t *);
2892 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NTP");
2894 col_clear(pinfo->cinfo, COL_INFO);
2896 /* Reset NTS cookie, UID TVB and AAD reminders */
2897 nts_cookie = NULL;
2898 nts_tvb_uid_offset = 0;
2899 nts_tvb_uid_length = 0;
2900 nts_aad_start = 0;
2902 flags = tvb_get_uint8(tvb, 0);
2903 switch (flags & NTP_MODE_MASK) {
2904 default:
2905 dissector = dissect_ntp_std;
2906 break;
2907 case NTP_MODE_CTRL:
2908 dissector = dissect_ntp_ctrl;
2909 break;
2910 case NTP_MODE_PRIV:
2911 dissector = dissect_ntp_priv;
2912 break;
2915 /* Adding NTP item and subtree */
2916 ti = proto_tree_add_item(tree, proto_ntp, tvb, 0, -1, ENC_NA);
2917 ntp_tree = proto_item_add_subtree(ti, ett_ntp);
2919 /* Show version and mode in info column and NTP root */
2920 col_add_fstr(pinfo->cinfo, COL_INFO, "%s, %s",
2921 val_to_str_const((flags & NTP_VN_MASK) >> 3, ver_nums, "Unknown version"),
2922 val_to_str_const(flags & NTP_MODE_MASK, info_mode_types, "Unknown"));
2924 proto_item_append_text(ti, " (%s, %s)",
2925 val_to_str_const((flags & NTP_VN_MASK) >> 3, ver_nums, "Unknown version"),
2926 val_to_str_const(flags & NTP_MODE_MASK, info_mode_types, "Unknown"));
2928 conversation = find_or_create_conversation(pinfo);
2929 ntp_conv = (ntp_conv_info_t *)conversation_get_proto_data(conversation, proto_ntp);
2930 if (!ntp_conv) {
2931 ntp_conv = wmem_new(wmem_file_scope(), ntp_conv_info_t);
2932 ntp_conv->trans = wmem_tree_new(wmem_file_scope());
2933 conversation_add_proto_data(conversation, proto_ntp, ntp_conv);
2936 /* Dissect according to mode */
2937 (*dissector)(tvb, pinfo, ntp_tree, ntp_conv);
2938 return tvb_captured_length(tvb);
2941 void
2942 proto_register_ntp(void)
2944 static hf_register_info hf[] = {
2945 { &hf_ntp_flags, {
2946 "Flags", "ntp.flags", FT_UINT8, BASE_HEX,
2947 NULL, 0, "Flags (Leap/Version/Mode)", HFILL }},
2948 { &hf_ntp_flags_li, {
2949 "Leap Indicator", "ntp.flags.li", FT_UINT8, BASE_DEC,
2950 VALS(li_types), NTP_LI_MASK, "Warning of an impending leap second to be inserted or deleted in the last minute of the current month", HFILL }},
2951 { &hf_ntp_flags_vn, {
2952 "Version number", "ntp.flags.vn", FT_UINT8, BASE_DEC,
2953 VALS(ver_nums), NTP_VN_MASK, NULL, HFILL }},
2954 { &hf_ntp_flags_mode, {
2955 "Mode", "ntp.flags.mode", FT_UINT8, BASE_DEC,
2956 VALS(mode_types), NTP_MODE_MASK, NULL, HFILL }},
2957 { &hf_ntp_stratum, {
2958 "Peer Clock Stratum", "ntp.stratum", FT_UINT8, BASE_DEC|BASE_RANGE_STRING,
2959 RVALS(stratum_rvals), 0, NULL, HFILL }},
2960 { &hf_ntp_ppoll, {
2961 "Peer Polling Interval", "ntp.ppoll", FT_INT8, BASE_DEC,
2962 NULL, 0, "Maximum interval between successive messages", HFILL }},
2963 { &hf_ntp_precision, {
2964 "Peer Clock Precision", "ntp.precision", FT_INT8, BASE_DEC,
2965 NULL, 0, "The precision of the system clock", HFILL }},
2966 { &hf_ntp_rootdelay, {
2967 "Root Delay", "ntp.rootdelay", FT_UINT32, BASE_DEC,
2968 NULL, 0, "Total round-trip delay to the reference clock", HFILL }},
2969 { &hf_ntp_rootdispersion, {
2970 "Root Dispersion", "ntp.rootdispersion", FT_UINT32, BASE_DEC,
2971 NULL, 0, "Total dispersion to the reference clock", HFILL }},
2972 { &hf_ntp_refid, {
2973 "Reference ID", "ntp.refid", FT_BYTES, BASE_NONE,
2974 NULL, 0, "Particular server or reference clock being used", HFILL }},
2975 { &hf_ntp_reftime, {
2976 "Reference Timestamp", "ntp.reftime", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_NTP_UTC,
2977 NULL, 0, "Time when the system clock was last set or corrected", HFILL }},
2978 { &hf_ntp_org, {
2979 "Origin Timestamp", "ntp.org", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_NTP_UTC,
2980 NULL, 0, "Time at the client when the request departed for the server", HFILL }},
2981 { &hf_ntp_rec, {
2982 "Receive Timestamp", "ntp.rec", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_NTP_UTC,
2983 NULL, 0, "Time at the server when the request arrived from the client", HFILL }},
2984 { &hf_ntp_xmt, {
2985 "Transmit Timestamp", "ntp.xmt", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_NTP_UTC,
2986 NULL, 0, "Time at the server when the response left for the client", HFILL }},
2987 { &hf_ntp_keyid, {
2988 "Key ID", "ntp.keyid", FT_BYTES, BASE_NONE,
2989 NULL, 0, NULL, HFILL }},
2990 { &hf_ntp_mac, {
2991 "Message Authentication Code", "ntp.mac", FT_BYTES, BASE_NONE,
2992 NULL, 0, NULL, HFILL }},
2993 { &hf_ntp_padding, {
2994 "Padding", "ntp.padding", FT_BYTES, BASE_NONE,
2995 NULL, 0, NULL, HFILL }},
2996 { &hf_ntp_key_type, {
2997 "Key type", "ntp.key_type", FT_UINT8, BASE_DEC,
2998 VALS(authentication_types), 0, "Authentication algorithm used", HFILL }},
2999 { &hf_ntp_key_index, {
3000 "KeyIndex", "ntp.key_index", FT_UINT32, BASE_HEX,
3001 NULL, 0, NULL, HFILL }},
3002 { &hf_ntp_key_signature, {
3003 "Signature", "ntp.key_signature", FT_BYTES, BASE_NONE,
3004 NULL, 0, NULL, HFILL }},
3005 { &hf_ntp_response_in, {
3006 "Response In", "ntp.response_in", FT_FRAMENUM, BASE_NONE,
3007 FRAMENUM_TYPE(FT_FRAMENUM_RESPONSE), 0, NULL, HFILL }},
3008 { &hf_ntp_request_in, {
3009 "Request In", "ntp.request_in", FT_FRAMENUM, BASE_NONE,
3010 FRAMENUM_TYPE(FT_FRAMENUM_REQUEST), 0, NULL, HFILL }},
3011 { &hf_ntp_delta_time, {
3012 "Delta Time", "ntp.delta_time", FT_RELATIVE_TIME, BASE_NONE,
3013 NULL, 0, "Time between request and response", HFILL }},
3015 { &hf_ntp_ext, {
3016 "Extension", "ntp.ext", FT_NONE, BASE_NONE,
3017 NULL, 0, NULL, HFILL }},
3018 { &hf_ntp_ext_type, {
3019 "Field Type", "ntp.ext.type", FT_UINT16, BASE_HEX,
3020 VALS(ntp_ext_field_types), 0, NULL, HFILL }},
3021 { &hf_ntp_ext_length, {
3022 "Length", "ntp.ext.length", FT_UINT16, BASE_DEC,
3023 NULL, 0, "Entire extension length including padding", HFILL }},
3024 { &hf_ntp_ext_value, {
3025 "Value", "ntp.ext.value", FT_BYTES, BASE_NONE,
3026 NULL, 0, "Type-specific value", HFILL }},
3028 { &hf_ntp_ext_nts, {
3029 "Network Time Security", "ntp.ext.nts", FT_NONE, BASE_NONE,
3030 NULL, 0, NULL, HFILL }},
3031 { &hf_ntp_nts_nonce_length, {
3032 "Nonce Length", "ntp.nts.nonce.length", FT_UINT16, BASE_DEC,
3033 NULL, 0, "Length of NTS nonce", HFILL }},
3034 { &hf_ntp_nts_ciphertext_length, {
3035 "Ciphertext Length", "ntp.nts.ciphertext.length", FT_UINT16, BASE_DEC,
3036 NULL, 0, "Length of NTS ciphertext", HFILL }},
3037 { &hf_ntp_nts_nonce, {
3038 "Nonce", "ntp.nts.nonce", FT_BYTES, BASE_NONE,
3039 NULL, 0, "Length of NTS ciphertext", HFILL }},
3040 { &hf_ntp_nts_ciphertext, {
3041 "Ciphertext", "ntp.nts.ciphertext", FT_BYTES, BASE_NONE,
3042 NULL, 0, "Length of NTS ciphertext", HFILL }},
3043 { &hf_ntp_nts_cookie_receive_frame, {
3044 "Received cookie in", "ntp.nts.cookie.receive_frame", FT_FRAMENUM, BASE_NONE,
3045 NULL, 0, "Frame where cookie was received", HFILL }},
3046 { &hf_ntp_nts_cookie_used_frame, {
3047 "Used cookie in", "ntp.nts.cookie.use_frame", FT_FRAMENUM, BASE_NONE,
3048 NULL, 0, NULL, HFILL }},
3049 { &hf_ntp_nts_crypto_success, {
3050 "Cryptography Success", "ntp.nts.crypto_success", FT_BOOLEAN, BASE_NONE,
3051 TFS(&tfs_yes_no), 0, "Decryption and authentication was successful", HFILL }},
3053 { &hf_ntpctrl_flags2, {
3054 "Flags 2", "ntp.ctrl.flags2", FT_UINT8, BASE_HEX,
3055 NULL, 0, "Flags (Response/Error/More/Opcode)", HFILL }},
3056 { &hf_ntpctrl_flags2_r, {
3057 "Response bit", "ntp.ctrl.flags2.r", FT_BOOLEAN, 8,
3058 TFS(&tfs_response_request), NTPCTRL_R_MASK, NULL, HFILL }},
3059 { &hf_ntpctrl_flags2_error, {
3060 "Error bit", "ntp.ctrl.flags2.error", FT_UINT8, BASE_DEC,
3061 NULL, NTPCTRL_ERROR_MASK, NULL, HFILL }},
3062 { &hf_ntpctrl_flags2_more, {
3063 "More bit", "ntp.ctrl.flags2.more", FT_UINT8, BASE_DEC,
3064 NULL, NTPCTRL_MORE_MASK, NULL, HFILL }},
3065 { &hf_ntpctrl_flags2_opcode, {
3066 "Opcode", "ntp.ctrl.flags2.opcode", FT_UINT8, BASE_DEC,
3067 VALS(ctrl_op_types), NTPCTRL_OP_MASK, NULL, HFILL }},
3068 { &hf_ntpctrl_sequence, {
3069 "Sequence", "ntp.ctrl.sequence", FT_UINT16, BASE_DEC,
3070 NULL, 0, NULL, HFILL }},
3071 { &hf_ntpctrl_status, {
3072 "Status", "ntp.ctrl.status", FT_UINT16, BASE_HEX,
3073 NULL, 0, NULL, HFILL }},
3074 { &hf_ntpctrl_error_status_word, {
3075 "Error Status Word", "ntp.ctrl.err_status", FT_UINT16, BASE_DEC,
3076 VALS(ctrl_err_status_types), NTP_CTRL_ERRSTATUS_CODE_MASK, NULL, HFILL }},
3077 { &hf_ntpctrl_sys_status_li, {
3078 "Leap Indicator", "ntp.ctrl.sys_status.li", FT_UINT16, BASE_DEC,
3079 VALS(li_types), NTPCTRL_SYSSTATUS_LI_MASK, "Warning of an impending leap second to be inserted or deleted in the last minute of the current month", HFILL }},
3080 { &hf_ntpctrl_sys_status_clksrc, {
3081 "Clock Source", "ntp.ctrl.sys_status.clksrc", FT_UINT16, BASE_DEC,
3082 VALS(ctrl_sys_status_clksource_types), NTPCTRL_SYSSTATUS_CLK_MASK, NULL, HFILL }},
3083 { &hf_ntpctrl_sys_status_count, {
3084 "System Event Counter", "ntp.ctrl.sys_status.count", FT_UINT16, BASE_DEC,
3085 NULL, NTPCTRL_SYSSTATUS_COUNT_MASK, NULL, HFILL }},
3086 { &hf_ntpctrl_sys_status_code, {
3087 "System Event Code", "ntp.ctrl.sys_status.code", FT_UINT16, BASE_DEC,
3088 VALS(ctrl_sys_status_event_types), NTPCTRL_SYSSTATUS_CODE_MASK, NULL, HFILL }},
3089 { &hf_ntpctrl_peer_status_b0, {
3090 "Peer Status", "ntp.ctrl.peer_status.config", FT_BOOLEAN, 16,
3091 TFS(&tfs_ctrl_peer_status_config), NTPCTRL_PEERSTATUS_CONFIG_MASK, NULL, HFILL }},
3092 { &hf_ntpctrl_peer_status_b1, {
3093 "Peer Status", "ntp.ctrl.peer_status.authenable", FT_BOOLEAN, 16,
3094 TFS(&tfs_ctrl_peer_status_authenable), NTPCTRL_PEERSTATUS_AUTHENABLE_MASK, NULL, HFILL }},
3095 { &hf_ntpctrl_peer_status_b2, {
3096 "Peer Status", "ntp.ctrl.peer_status.authentic", FT_BOOLEAN, 16,
3097 TFS(&tfs_ctrl_peer_status_authentic), NTPCTRL_PEERSTATUS_AUTHENTIC_MASK, NULL, HFILL }},
3098 { &hf_ntpctrl_peer_status_b3, {
3099 "Peer Status", "ntp.ctrl.peer_status.reach", FT_BOOLEAN, 16,
3100 TFS(&tfs_ctrl_peer_status_reach), NTPCTRL_PEERSTATUS_REACH_MASK, NULL, HFILL }},
3101 { &hf_ntpctrl_peer_status_b4, {
3102 "Peer Status broadcast association", "ntp.ctrl.peer_status.bcast", FT_BOOLEAN, 16,
3103 TFS(&tfs_set_notset), NTPCTRL_PEERSTATUS_BCAST_MASK, NULL, HFILL }},
3104 { &hf_ntpctrl_peer_status_selection, {
3105 "Peer Selection", "ntp.ctrl.peer_status.selection", FT_UINT16, BASE_DEC,
3106 VALS(ctrl_peer_status_selection_types), NTPCTRL_PEERSTATUS_SEL_MASK, NULL, HFILL }},
3107 { &hf_ntpctrl_peer_status_count, {
3108 "Peer Event Counter", "ntp.ctrl.peer_status.count", FT_UINT16, BASE_DEC,
3109 NULL, NTPCTRL_PEERSTATUS_COUNT_MASK, NULL, HFILL }},
3110 { &hf_ntpctrl_peer_status_code, {
3111 "Peer Event Code", "ntp.ctrl.peer_status.code", FT_UINT16, BASE_DEC,
3112 VALS(ctrl_peer_status_event_types), NTPCTRL_PEERSTATUS_CODE_MASK, NULL, HFILL }},
3113 { &hf_ntpctrl_clk_status, {
3114 "Clock Status", "ntp.ctrl.clock_status.status", FT_UINT16, BASE_DEC,
3115 VALS(ctrl_clk_status_types), NTPCTRL_CLKSTATUS_STATUS_MASK, NULL, HFILL }},
3116 { &hf_ntpctrl_clk_status_code, {
3117 "Clock Event Code", "ntp.ctrl.clock_status.code", FT_UINT16, BASE_DEC,
3118 NULL, NTPCTRL_CLKSTATUS_CODE_MASK, NULL, HFILL }},
3119 { &hf_ntpctrl_data, {
3120 "Data", "ntp.ctrl.data", FT_NONE, BASE_NONE,
3121 NULL, 0, NULL, HFILL }},
3122 { &hf_ntpctrl_item, {
3123 "Item", "ntp.ctrl.item", FT_NONE, BASE_NONE,
3124 NULL, 0, NULL, HFILL }},
3125 { &hf_ntpctrl_associd, {
3126 "AssociationID", "ntp.ctrl.associd", FT_UINT16, BASE_DEC,
3127 NULL, 0, NULL, HFILL }},
3128 { &hf_ntpctrl_offset, {
3129 "Offset", "ntp.ctrl.offset", FT_UINT16, BASE_DEC,
3130 NULL, 0, NULL, HFILL }},
3131 { &hf_ntpctrl_count, {
3132 "Count", "ntp.ctrl.count", FT_UINT16, BASE_DEC,
3133 NULL, 0, NULL, HFILL }},
3134 { &hf_ntpctrl_trapmsg, {
3135 "Trap message", "ntp.ctrl.trapmsg", FT_STRING, BASE_NONE,
3136 NULL, 0, NULL, HFILL }},
3137 { &hf_ntpctrl_configuration, {
3138 "Configuration", "ntp.ctrl.configuration", FT_STRING, BASE_NONE,
3139 NULL, 0, NULL, HFILL }},
3140 { &hf_ntpctrl_mru, {
3141 "MRU", "ntp.ctrl.mru", FT_STRING, BASE_NONE,
3142 NULL, 0, NULL, HFILL }},
3143 { &hf_ntpctrl_ordlist, {
3144 "Ordered List", "ntp.ctrl.ordlist", FT_STRING, BASE_NONE,
3145 NULL, 0, NULL, HFILL }},
3146 { &hf_ntpctrl_nonce, {
3147 "Nonce", "ntp.ctrl.nonce", FT_STRING, BASE_NONE,
3148 NULL, 0, NULL, HFILL }},
3150 { &hf_ntppriv_flags_r, {
3151 "Response bit", "ntp.priv.flags.r", FT_BOOLEAN, 8,
3152 TFS(&tfs_response_request), NTPPRIV_R_MASK, NULL, HFILL }},
3153 { &hf_ntppriv_flags_more, {
3154 "More bit", "ntp.priv.flags.more", FT_UINT8, BASE_DEC,
3155 NULL, NTPPRIV_MORE_MASK, NULL, HFILL }},
3156 { &hf_ntppriv_auth_seq, {
3157 "Auth, sequence", "ntp.priv.auth_seq", FT_UINT8, BASE_DEC,
3158 NULL, 0, "Auth bit, sequence number", HFILL }},
3159 { &hf_ntppriv_auth, {
3160 "Auth bit", "ntp.priv.auth", FT_UINT8, BASE_DEC,
3161 NULL, NTPPRIV_AUTH_MASK, NULL, HFILL }},
3162 { &hf_ntppriv_seq, {
3163 "Sequence number", "ntp.priv.seq", FT_UINT8, BASE_DEC,
3164 NULL, NTPPRIV_SEQ_MASK, NULL, HFILL }},
3165 { &hf_ntppriv_impl, {
3166 "Implementation", "ntp.priv.impl", FT_UINT8, BASE_DEC,
3167 VALS(priv_impl_types), 0, NULL, HFILL }},
3168 { &hf_ntppriv_reqcode, {
3169 "Request code", "ntp.priv.reqcode", FT_UINT8, BASE_DEC | BASE_EXT_STRING,
3170 &priv_rc_types_ext, 0, NULL, HFILL }},
3171 { &hf_ntppriv_errcode, {
3172 "Err", "ntp.priv.err", FT_UINT8, BASE_HEX,
3173 VALS(err_values_types), 0, NULL, HFILL }},
3174 { &hf_ntppriv_numitems, {
3175 "Number of data items", "ntp.priv.numitems", FT_UINT16, BASE_DEC,
3176 NULL, 0, NULL, HFILL }},
3177 { &hf_ntppriv_mbz, {
3178 "Reserved", "ntp.priv.reserved", FT_UINT8, BASE_HEX,
3179 NULL, 0, NULL, HFILL }},
3180 { &hf_ntppriv_mode7_item, {
3181 "Mode7 item", "ntp.priv.mode7.item",
3182 FT_STRINGZ, BASE_NONE, NULL, 0x00, NULL, HFILL }},
3183 { &hf_ntppriv_itemsize, {
3184 "Size of data item", "ntp.priv.itemsize", FT_UINT16, BASE_DEC,
3185 NULL, 0, NULL, HFILL }},
3186 { &hf_ntppriv_avgint, {
3187 "avgint", "ntp.priv.monlist.avgint", FT_UINT32, BASE_DEC,
3188 NULL, 0, NULL, HFILL }},
3189 { &hf_ntppriv_lsint, {
3190 "lsint", "ntp.priv.monlist.lsint", FT_UINT32, BASE_DEC,
3191 NULL, 0, NULL, HFILL }},
3192 { &hf_ntppriv_restr, {
3193 "restr", "ntp.priv.monlist.restr", FT_UINT32, BASE_HEX,
3194 NULL, 0, NULL, HFILL }},
3195 { &hf_ntppriv_count, {
3196 "count", "ntp.priv.monlist.count", FT_UINT32, BASE_DEC,
3197 NULL, 0, NULL, HFILL }},
3198 { &hf_ntppriv_addr, {
3199 "remote address", "ntp.priv.monlist.remote_address", FT_IPv4, BASE_NONE,
3200 NULL, 0, NULL, HFILL }},
3201 { &hf_ntppriv_daddr, {
3202 "local address", "ntp.priv.monlist.local_address", FT_IPv4, BASE_NONE,
3203 NULL, 0, NULL, HFILL }},
3204 { &hf_ntppriv_flags, {
3205 "flags", "ntp.priv.monlist.flags", FT_UINT32, BASE_HEX,
3206 NULL, 0, NULL, HFILL }},
3207 { &hf_ntppriv_port, {
3208 "port", "ntp.priv.monlist.port", FT_UINT16, BASE_DEC,
3209 NULL, 0, NULL, HFILL }},
3210 { &hf_ntppriv_mode, {
3211 "mode", "ntp.priv.monlist.mode", FT_UINT8, BASE_DEC,
3212 NULL, 0, NULL, HFILL }},
3213 { &hf_ntppriv_version, {
3214 "version", "ntp.priv.monlist.version", FT_UINT8, BASE_DEC,
3215 NULL, 0, NULL, HFILL }},
3216 { &hf_ntppriv_v6_flag, {
3217 "ipv6", "ntp.priv.monlist.ipv6", FT_UINT32, BASE_HEX,
3218 NULL, 0, NULL, HFILL }},
3219 { &hf_ntppriv_unused, {
3220 "unused", "ntp.priv.monlist.unused", FT_UINT32, BASE_HEX,
3221 NULL, 0, NULL, HFILL }},
3222 { &hf_ntppriv_addr6, {
3223 "ipv6 remote addr", "ntp.priv.monlist.addr6", FT_IPv6, BASE_NONE,
3224 NULL, 0, NULL, HFILL }},
3225 { &hf_ntppriv_daddr6, {
3226 "ipv6 local addr", "ntp.priv.monlist.daddr6", FT_IPv6, BASE_NONE,
3227 NULL, 0, NULL, HFILL }},
3228 { &hf_ntppriv_tstamp, {
3229 "Authentication timestamp", "ntp.priv.tstamp", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_NTP_UTC,
3230 NULL, 0, NULL, HFILL }},
3231 { &hf_ntppriv_mode7_addr, {
3232 "Address", "ntp.priv.mode7.address", FT_IPv4, BASE_NONE,
3233 NULL, 0, NULL, HFILL }},
3234 { &hf_ntppriv_mode7_mask, {
3235 "Mask", "ntp.priv.mode7.mask", FT_IPv4, BASE_NONE,
3236 NULL, 0, NULL, HFILL }},
3237 { &hf_ntppriv_mode7_bcast, {
3238 "Bcast", "ntp.priv.mode7.bcast", FT_IPv4, BASE_NONE,
3239 NULL, 0, NULL, HFILL }},
3240 { &hf_ntppriv_mode7_port, {
3241 "Port", "ntp.priv.mode7.port", FT_UINT16, BASE_DEC,
3242 NULL, 0, NULL, HFILL }},
3243 { &hf_ntppriv_mode7_hmode, {
3244 "HMode", "ntp.priv.mode7.hmode", FT_UINT8, BASE_DEC,
3245 VALS(mode_types), 0, NULL, HFILL }},
3246 { &hf_ntppriv_mode7_peer_flags, {
3247 "Flags", "ntp.priv.mode7.peer.flags", FT_UINT8, BASE_HEX,
3248 NULL, 0xFF, NULL, HFILL }},
3249 { &hf_ntppriv_mode7_v6_flag, {
3250 "IPv6 Flag", "ntp.priv.mode7.ipv6_flag", FT_UINT32, BASE_DEC,
3251 NULL, 0, NULL, HFILL }},
3252 { &hf_ntppriv_mode7_unused, {
3253 "Unused", "ntp.priv.mode7.unused", FT_BYTES, BASE_NONE,
3254 NULL, 0, NULL, HFILL }},
3255 { &hf_ntppriv_mode7_addr6, {
3256 "IPv6 addr", "ntp.priv.mode7.address6", FT_IPv6, BASE_NONE,
3257 NULL, 0, NULL, HFILL }},
3258 { &hf_ntppriv_mode7_mask6, {
3259 "IPv6 mask", "ntp.priv.mode7.mask6", FT_IPv6, BASE_NONE,
3260 NULL, 0, NULL, HFILL }},
3261 { &hf_ntppriv_mode7_bcast6, {
3262 "IPv6 bcast", "ntp.priv.mode7.bcast6", FT_IPv6, BASE_NONE,
3263 NULL, 0, NULL, HFILL }},
3264 { &hf_ntppriv_mode7_peer_flags_config, {
3265 "Config", "ntp.priv.mode7.peer.flags.config", FT_BOOLEAN, 8,
3266 TFS(&tfs_set_notset), PRIV_INFO_FLAG_CONFIG, NULL, HFILL }},
3267 { &hf_ntppriv_mode7_peer_flags_syspeer, {
3268 "Syspeer", "ntp.priv.mode7.peer.flags.syspeer", FT_BOOLEAN, 8,
3269 TFS(&tfs_set_notset), PRIV_INFO_FLAG_SYSPEER, NULL, HFILL }},
3270 { &hf_ntppriv_mode7_peer_flags_burst, {
3271 "Burst", "ntp.priv.mode7.peer.flags.burst", FT_BOOLEAN, 8,
3272 TFS(&tfs_set_notset), PRIV_INFO_FLAG_BURST, NULL, HFILL }},
3273 { &hf_ntppriv_mode7_peer_flags_refclock, {
3274 "Refclock", "ntp.priv.mode7.peer.flags.refclock", FT_BOOLEAN, 8,
3275 TFS(&tfs_set_notset), PRIV_INFO_FLAG_REFCLOCK, NULL, HFILL }},
3276 { &hf_ntppriv_mode7_peer_flags_prefer, {
3277 "Prefer", "ntp.priv.mode7.peer.flags.prefer", FT_BOOLEAN, 8,
3278 TFS(&tfs_set_notset), PRIV_INFO_FLAG_PREFER, NULL, HFILL }},
3279 { &hf_ntppriv_mode7_peer_flags_authenable, {
3280 "Auth enable", "ntp.priv.mode7.peer.flags.authenable", FT_BOOLEAN, 8,
3281 TFS(&tfs_set_notset), PRIV_INFO_FLAG_AUTHENABLE, NULL, HFILL }},
3282 { &hf_ntppriv_mode7_peer_flags_sel_candidate, {
3283 "Sel Candidate", "ntp.priv.mode7.peer.flags.sel_candidate", FT_BOOLEAN, 8,
3284 TFS(&tfs_set_notset), PRIV_INFO_FLAG_SEL_CANDIDATE, NULL, HFILL }},
3285 { &hf_ntppriv_mode7_peer_flags_shortlist, {
3286 "Shortlist", "ntp.priv.mode7.peer.flags.shortlist", FT_BOOLEAN, 8,
3287 TFS(&tfs_set_notset), PRIV_INFO_FLAG_SHORTLIST, NULL, HFILL }},
3288 { &hf_ntppriv_mode7_dstaddr, {
3289 "Destination address", "ntp.priv.mode7.dstaddress", FT_IPv4, BASE_NONE,
3290 NULL, 0, NULL, HFILL }},
3291 { &hf_ntppriv_mode7_srcaddr, {
3292 "Source address", "ntp.priv.mode7.srcaddress", FT_IPv4, BASE_NONE,
3293 NULL, 0, NULL, HFILL }},
3294 { &hf_ntppriv_mode7_srcport, {
3295 "Source port", "ntp.priv.mode7.srcport", FT_UINT16, BASE_DEC,
3296 NULL, 0, NULL, HFILL }},
3297 { &hf_ntppriv_mode7_count, {
3298 "Count", "ntp.priv.mode7.count", FT_UINT32, BASE_DEC,
3299 NULL, 0, NULL, HFILL }},
3300 { &hf_ntppriv_mode7_hpoll, {
3301 "Host polling interval", "ntp.priv.mode7.hpoll", FT_INT8, BASE_DEC,
3302 NULL, 0, NULL, HFILL }},
3303 { &hf_ntppriv_mode7_reach, {
3304 "Reach", "ntp.priv.mode7.reach", FT_UINT8, BASE_DEC,
3305 NULL, 0, NULL, HFILL }},
3306 { &hf_ntppriv_mode7_delay, {
3307 "Delay", "ntp.priv.mode7.delay", FT_INT32, BASE_DEC,
3308 NULL, 0, NULL, HFILL }},
3309 { &hf_ntppriv_mode7_offset, {
3310 "Offset", "ntp.priv.mode7.offset", FT_UINT64, BASE_DEC,
3311 NULL, 0, NULL, HFILL }},
3312 { &hf_ntppriv_mode7_dispersion, {
3313 "Dispersion", "ntp.priv.mode7.dispersion", FT_UINT32, BASE_DEC,
3314 NULL, 0, NULL, HFILL }},
3315 { &hf_ntppriv_mode7_dstaddr6, {
3316 "IPv6 destination addr", "ntp.priv.mode7.dstaddress6", FT_IPv6, BASE_NONE,
3317 NULL, 0, NULL, HFILL }},
3318 { &hf_ntppriv_mode7_srcaddr6, {
3319 "IPv6 source addr", "ntp.priv.mode7.srcaddress6", FT_IPv6, BASE_NONE,
3320 NULL, 0, NULL, HFILL }},
3321 { &hf_ntppriv_mode7_leap, {
3322 "Leap", "ntp.priv.mode7.leap", FT_UINT8, BASE_DEC,
3323 NULL, 0, NULL, HFILL }},
3324 { &hf_ntppriv_mode7_pmode, {
3325 "Peer mode", "ntp.priv.mode7.pmode", FT_UINT8, BASE_DEC,
3326 VALS(mode_types), 0, NULL, HFILL }},
3327 { &hf_ntppriv_mode7_version, {
3328 "Version", "ntp.priv.mode7.version", FT_UINT8, BASE_DEC,
3329 NULL, 0, NULL, HFILL }},
3330 { &hf_ntppriv_mode7_unreach, {
3331 "Unreach", "ntp.priv.mode7.unreach", FT_UINT8, BASE_DEC,
3332 NULL, 0, NULL, HFILL }},
3333 { &hf_ntppriv_mode7_flash, {
3334 "Flash", "ntp.priv.mode7.flash", FT_UINT8, BASE_DEC,
3335 NULL, 0, NULL, HFILL }},
3336 { &hf_ntppriv_mode7_ttl, {
3337 "TTL", "ntp.priv.mode7.ttl", FT_UINT8, BASE_DEC,
3338 NULL, 0, NULL, HFILL }},
3339 { &hf_ntppriv_mode7_flash2, {
3340 "Flash new", "ntp.priv.mode7.flash2", FT_UINT16, BASE_DEC,
3341 NULL, 0, NULL, HFILL }},
3342 { &hf_ntppriv_mode7_associd, {
3343 "Association ID", "ntp.priv.mode7.associd", FT_UINT16, BASE_DEC,
3344 NULL, 0, NULL, HFILL }},
3345 { &hf_ntppriv_mode7_pkeyid, {
3346 "Peer Key ID", "ntp.priv.mode7.pkeyid", FT_UINT32, BASE_DEC,
3347 NULL, 0, NULL, HFILL }},
3348 { &hf_ntppriv_mode7_timer, {
3349 "Timer", "ntp.priv.mode7.timer", FT_UINT32, BASE_DEC,
3350 NULL, 0, NULL, HFILL }},
3351 { &hf_ntppriv_mode7_filtdelay, {
3352 "Filt delay", "ntp.priv.mode7.filtdelay", FT_INT32, BASE_DEC,
3353 NULL, 0, NULL, HFILL }},
3354 { &hf_ntppriv_mode7_filtoffset, {
3355 "Filt offset", "ntp.priv.mode7.filtoffset", FT_INT64, BASE_DEC,
3356 NULL, 0, NULL, HFILL }},
3357 { &hf_ntppriv_mode7_order, {
3358 "Order", "ntp.priv.mode7.order", FT_UINT8, BASE_DEC,
3359 NULL, 0, NULL, HFILL }},
3360 { &hf_ntppriv_mode7_selectdis, {
3361 "Selectdis", "ntp.priv.mode7.selectdis", FT_UINT32, BASE_DEC,
3362 NULL, 0, NULL, HFILL }},
3363 { &hf_ntppriv_mode7_estbdelay, {
3364 "Estbdelay", "ntp.priv.mode7.estbdelay", FT_INT32, BASE_DEC,
3365 NULL, 0, NULL, HFILL }},
3366 { &hf_ntppriv_mode7_bdelay, {
3367 "Bdelay", "ntp.priv.mode7.bdelay", FT_INT32, BASE_DEC,
3368 NULL, 0, NULL, HFILL }},
3369 { &hf_ntppriv_mode7_authdelay, {
3370 "Auth delay", "ntp.priv.mode7.authdelay", FT_INT64, BASE_DEC,
3371 NULL, 0, NULL, HFILL }},
3372 { &hf_ntppriv_mode7_minpoll, {
3373 "Minpoll", "ntp.priv.mode7.minpoll", FT_UINT8, BASE_DEC,
3374 NULL, 0, NULL, HFILL }},
3375 { &hf_ntppriv_mode7_maxpoll, {
3376 "Maxpoll", "ntp.priv.mode7.maxpoll", FT_UINT8, BASE_DEC,
3377 NULL, 0, NULL, HFILL }},
3378 { &hf_ntppriv_mode7_config_flags, {
3379 "Flags", "ntp.priv.config.flags", FT_UINT8, BASE_HEX,
3380 NULL, 0xFF, NULL, HFILL }},
3381 { &hf_ntppriv_mode7_config_flags_auth, {
3382 "Authenable", "ntp.priv.mode7.config.flags.authenable", FT_BOOLEAN, 8,
3383 TFS(&tfs_set_notset), PRIV_CONF_FLAG_AUTHENABLE, NULL, HFILL }},
3384 { &hf_ntppriv_mode7_config_flags_prefer, {
3385 "Prefer", "ntp.priv.mode7.config.flags.prefer", FT_BOOLEAN, 8,
3386 TFS(&tfs_set_notset), PRIV_CONF_FLAG_PREFER, NULL, HFILL }},
3387 { &hf_ntppriv_mode7_config_flags_burst, {
3388 "Burst", "ntp.priv.mode7.config.flags.burst", FT_BOOLEAN, 8,
3389 TFS(&tfs_set_notset), PRIV_CONF_FLAG_BURST, NULL, HFILL }},
3390 { &hf_ntppriv_mode7_config_flags_iburst, {
3391 "IBurst", "ntp.priv.mode7.config.flags.iburst", FT_BOOLEAN, 8,
3392 TFS(&tfs_set_notset), PRIV_CONF_FLAG_IBURST, NULL, HFILL }},
3393 { &hf_ntppriv_mode7_config_flags_noselect, {
3394 "No Select", "ntp.priv.mode7.config.flags.no_select", FT_BOOLEAN, 8,
3395 TFS(&tfs_set_notset), PRIV_CONF_FLAG_NOSELECT, NULL, HFILL }},
3396 { &hf_ntppriv_mode7_config_flags_skey, {
3397 "Skey", "ntp.priv.mode7.config.flags.skey", FT_BOOLEAN, 8,
3398 TFS(&tfs_set_notset), PRIV_CONF_FLAG_SKEY, NULL, HFILL }},
3399 { &hf_ntppriv_mode7_key_file, {
3400 "Key file name", "ntp.priv.mode7.key_file", FT_STRING, BASE_NONE,
3401 NULL, 0, NULL, HFILL }},
3402 { &hf_ntppriv_mode7_sys_flags, {
3403 "Flags", "ntp.priv.mode7.sys.flags", FT_UINT32, BASE_HEX,
3404 NULL, 0xFF, NULL, HFILL }},
3405 { &hf_ntppriv_mode7_sys_flags_bclient, {
3406 "Bclient", "ntp.priv.mode7.sys.flags.bclient", FT_BOOLEAN, 8,
3407 TFS(&tfs_set_notset), PRIV_SYS_FLAG_BCLIENT, NULL, HFILL }},
3408 { &hf_ntppriv_mode7_sys_flags_pps, {
3409 "PPS", "ntp.priv.mode7.sys.flags.pps", FT_BOOLEAN, 8,
3410 TFS(&tfs_set_notset), PRIV_SYS_FLAG_PPS, NULL, HFILL }},
3411 { &hf_ntppriv_mode7_sys_flags_ntp, {
3412 "NTP", "ntp.priv.mode7.sys.flags.ntp", FT_BOOLEAN, 8,
3413 TFS(&tfs_set_notset), PRIV_SYS_FLAG_NTP, NULL, HFILL }},
3414 { &hf_ntppriv_mode7_sys_flags_kernel, {
3415 "Kernel", "ntp.priv.mode7.sys.flags.kernel", FT_BOOLEAN, 8,
3416 TFS(&tfs_set_notset), PRIV_SYS_FLAG_KERNEL, NULL, HFILL }},
3417 { &hf_ntppriv_mode7_sys_flags_monitor, {
3418 "Monitor", "ntp.priv.mode7.sys.flags.monitor", FT_BOOLEAN, 8,
3419 TFS(&tfs_set_notset), PRIV_SYS_FLAG_MONITOR, NULL, HFILL }},
3420 { &hf_ntppriv_mode7_sys_flags_filegen, {
3421 "Filegen", "ntp.priv.mode7.sys.flags.filegen", FT_BOOLEAN, 8,
3422 TFS(&tfs_set_notset), PRIV_SYS_FLAG_FILEGEN, NULL, HFILL }},
3423 { &hf_ntppriv_mode7_sys_flags_auth, {
3424 "Auth", "ntp.priv.mode7.sys.flags.auth", FT_BOOLEAN, 8,
3425 TFS(&tfs_set_notset), PRIV_SYS_FLAG_AUTH, NULL, HFILL }},
3426 { &hf_ntppriv_mode7_sys_flags_cal, {
3427 "Cal", "ntp.priv.mode7.sys.flags.cal", FT_BOOLEAN, 8,
3428 TFS(&tfs_set_notset), PRIV_SYS_FLAG_CAL, NULL, HFILL }},
3429 { &hf_ntppriv_mode7_reset_stats_flags, {
3430 "Flags", "ntp.priv.mode7.reset_stats.flags", FT_UINT32, BASE_HEX,
3431 NULL, 0xFF, NULL, HFILL }},
3432 { &hf_ntppriv_mode7_reset_stats_flags_allpeers, {
3433 "All Peers", "ntp.priv.mode7.reset_stats.flags.allpeers", FT_BOOLEAN, 32,
3434 TFS(&tfs_set_notset), PRIV_RESET_FLAG_ALLPEERS, NULL, HFILL }},
3435 { &hf_ntppriv_mode7_reset_stats_flags_io, {
3436 "IO", "ntp.priv.mode7.reset_stats.flags.io", FT_BOOLEAN, 32,
3437 TFS(&tfs_set_notset), PRIV_RESET_FLAG_IO, NULL, HFILL }},
3438 { &hf_ntppriv_mode7_reset_stats_flags_sys, {
3439 "Sys", "ntp.priv.mode7.reset_stats.flags.sys", FT_BOOLEAN, 32,
3440 TFS(&tfs_set_notset), PRIV_RESET_FLAG_SYS, NULL, HFILL }},
3441 { &hf_ntppriv_mode7_reset_stats_flags_mem, {
3442 "Mem", "ntp.priv.mode7.reset_stats.flags.mem", FT_BOOLEAN, 32,
3443 TFS(&tfs_set_notset), PRIV_RESET_FLAG_MEM, NULL, HFILL }},
3444 { &hf_ntppriv_mode7_reset_stats_flags_timer, {
3445 "Timer", "ntp.priv.mode7.reset_stats.flags.timer", FT_BOOLEAN, 32,
3446 TFS(&tfs_set_notset), PRIV_RESET_FLAG_TIMER, NULL, HFILL }},
3447 { &hf_ntppriv_mode7_reset_stats_flags_auth, {
3448 "Auth", "ntp.priv.mode7.reset_stats.flags.auth", FT_BOOLEAN, 32,
3449 TFS(&tfs_set_notset), PRIV_RESET_FLAG_AUTH, NULL, HFILL }},
3450 { &hf_ntppriv_mode7_reset_stats_flags_ctl, {
3451 "Ctl", "ntp.priv.mode7.reset_stats.flags.ctl", FT_BOOLEAN, 32,
3452 TFS(&tfs_set_notset), PRIV_RESET_FLAG_CTL, NULL, HFILL }},
3453 { &hf_ntppriv_mode7_key, {
3454 "Key", "ntp.priv.mode7.key", FT_UINT64, BASE_HEX,
3455 NULL, 0, NULL, HFILL }},
3456 { &hf_ntppriv_mode7_timeup, {
3457 "Time up", "ntp.priv.mode7.timeup", FT_UINT32, BASE_DEC,
3458 NULL, 0, "time counters were reset", HFILL }},
3459 { &hf_ntppriv_mode7_timereset, {
3460 "Time reset", "ntp.priv.mode7.timereset", FT_UINT32, BASE_DEC,
3461 NULL, 0, "time counters were reset", HFILL }},
3462 { &hf_ntppriv_mode7_timereceived, {
3463 "Time received", "ntp.priv.mode7.timereceived", FT_UINT32, BASE_DEC,
3464 NULL, 0, "time since a packet received", HFILL }},
3465 { &hf_ntppriv_mode7_timetosend, {
3466 "Time to send", "ntp.priv.mode7.timetosend", FT_UINT32, BASE_DEC,
3467 NULL, 0, "time until a packet sent", HFILL }},
3468 { &hf_ntppriv_mode7_timereachable, {
3469 "Time reachable", "ntp.priv.mode7.timereachable", FT_UINT32, BASE_DEC,
3470 NULL, 0, "time peer has been reachable", HFILL }},
3471 { &hf_ntppriv_mode7_sent, {
3472 "Sent", "ntp.priv.mode7.sent", FT_UINT32, BASE_DEC,
3473 NULL, 0, NULL, HFILL }},
3474 { &hf_ntppriv_mode7_processed, {
3475 "Processed", "ntp.priv.mode7.processed", FT_UINT32, BASE_DEC,
3476 NULL, 0, NULL, HFILL }},
3477 { &hf_ntppriv_mode7_badauth, {
3478 "Bad authentication", "ntp.priv.mode7.badauth", FT_UINT32, BASE_DEC,
3479 NULL, 0, NULL, HFILL }},
3480 { &hf_ntppriv_mode7_bogusorg, {
3481 "Bogus origin", "ntp.priv.mode7.bogusorg", FT_UINT32, BASE_DEC,
3482 NULL, 0, NULL, HFILL }},
3483 { &hf_ntppriv_mode7_oldpkt, {
3484 "Old packet", "ntp.priv.mode7.oldpkt", FT_UINT32, BASE_DEC,
3485 NULL, 0, NULL, HFILL }},
3486 { &hf_ntppriv_mode7_seldisp, {
3487 "Bad dispersion", "ntp.priv.mode7.seldisp", FT_UINT32, BASE_DEC,
3488 NULL, 0, NULL, HFILL }},
3489 { &hf_ntppriv_mode7_selbroken, {
3490 "Bad reference time", "ntp.priv.mode7.selbroken", FT_UINT32, BASE_DEC,
3491 NULL, 0, NULL, HFILL }},
3492 { &hf_ntppriv_mode7_candidate, {
3493 "Candidate", "ntp.priv.mode7.candidate", FT_UINT32, BASE_DEC,
3494 NULL, 0, NULL, HFILL }},
3495 { &hf_ntppriv_mode7_numkeys, {
3496 "Num keys", "ntp.priv.mode7.numkeys", FT_UINT32, BASE_DEC,
3497 NULL, 0, NULL, HFILL }},
3498 { &hf_ntppriv_mode7_numfreekeys, {
3499 "Num free keys", "ntp.priv.mode7.numfreekeys", FT_UINT32, BASE_DEC,
3500 NULL, 0, NULL, HFILL }},
3501 { &hf_ntppriv_mode7_keylookups, {
3502 "Keylookups", "ntp.priv.mode7.keylookups", FT_UINT32, BASE_DEC,
3503 NULL, 0, NULL, HFILL }},
3504 { &hf_ntppriv_mode7_keynotfound, {
3505 "Key not found", "ntp.priv.mode7.keynotfound", FT_UINT32, BASE_DEC,
3506 NULL, 0, NULL, HFILL }},
3507 { &hf_ntppriv_mode7_encryptions, {
3508 "Encryptions", "ntp.priv.mode7.encryptions", FT_UINT32, BASE_DEC,
3509 NULL, 0, NULL, HFILL }},
3510 { &hf_ntppriv_mode7_decryptions, {
3511 "Decryptions", "ntp.priv.mode7.decryptions", FT_UINT32, BASE_DEC,
3512 NULL, 0, NULL, HFILL }},
3513 { &hf_ntppriv_mode7_expired, {
3514 "Expired", "ntp.priv.mode7.expired", FT_UINT32, BASE_DEC,
3515 NULL, 0, NULL, HFILL }},
3516 { &hf_ntppriv_mode7_keyuncached, {
3517 "Key uncached", "ntp.priv.mode7.keyuncached", FT_UINT32, BASE_DEC,
3518 NULL, 0, NULL, HFILL }},
3519 { &hf_ntppriv_mode7_local_addr, {
3520 "Local address", "ntp.priv.mode7.local_address", FT_IPv4, BASE_NONE,
3521 NULL, 0, NULL, HFILL }},
3522 { &hf_ntppriv_mode7_trap_addr, {
3523 "Trap address", "ntp.priv.mode7.trap_address", FT_IPv4, BASE_NONE,
3524 NULL, 0, NULL, HFILL }},
3525 { &hf_ntppriv_mode7_trap_port, {
3526 "Trap port", "ntp.priv.mode7.trap_port", FT_UINT16, BASE_DEC,
3527 NULL, 0, NULL, HFILL }},
3528 { &hf_ntppriv_mode7_sequence, {
3529 "Sequence number", "ntp.priv.mode7.sequence", FT_UINT16, BASE_DEC,
3530 NULL, 0, NULL, HFILL }},
3531 { &hf_ntppriv_mode7_settime, {
3532 "Trap set time", "ntp.priv.mode7.settime", FT_UINT32, BASE_DEC,
3533 NULL, 0, NULL, HFILL }},
3534 { &hf_ntppriv_mode7_origtime, {
3535 "Trap originally time", "ntp.priv.mode7.origtime", FT_UINT32, BASE_DEC,
3536 NULL, 0, NULL, HFILL }},
3537 { &hf_ntppriv_mode7_resets, {
3538 "Resets", "ntp.priv.mode7.resets", FT_UINT32, BASE_DEC,
3539 NULL, 0, NULL, HFILL }},
3540 { &hf_ntppriv_traps_flags, {
3541 "Flags", "ntp.priv.traps.flags", FT_UINT32, BASE_HEX,
3542 NULL, 0, NULL, HFILL }},
3543 { &hf_ntppriv_mode7_local_addr6, {
3544 "IPv6 local addr", "ntp.priv.mode7.local_address6", FT_IPv6, BASE_NONE,
3545 NULL, 0, NULL, HFILL }},
3546 { &hf_ntppriv_mode7_trap_addr6, {
3547 "IPv6 trap addr", "ntp.priv.mode7.trap_address6", FT_IPv6, BASE_NONE,
3548 NULL, 0, NULL, HFILL }},
3549 { &hf_ntppriv_mode7_req, {
3550 "Requests", "ntp.priv.mode7.requests", FT_UINT32, BASE_DEC,
3551 NULL, 0, NULL, HFILL }},
3552 { &hf_ntppriv_mode7_badpkts, {
3553 "Bad packets", "ntp.priv.mode7.bad_packets", FT_UINT32, BASE_DEC,
3554 NULL, 0, NULL, HFILL }},
3555 { &hf_ntppriv_mode7_responses, {
3556 "Responses", "ntp.priv.mode7.responses", FT_UINT32, BASE_DEC,
3557 NULL, 0, NULL, HFILL }},
3558 { &hf_ntppriv_mode7_frags, {
3559 "Fragments", "ntp.priv.mode7.fragments", FT_UINT32, BASE_DEC,
3560 NULL, 0, NULL, HFILL }},
3561 { &hf_ntppriv_mode7_errors, {
3562 "Errors", "ntp.priv.mode7.errors", FT_UINT32, BASE_DEC,
3563 NULL, 0, NULL, HFILL }},
3564 { &hf_ntppriv_mode7_tooshort, {
3565 "Too short packets", "ntp.priv.mode7.too_short", FT_UINT32, BASE_DEC,
3566 NULL, 0, NULL, HFILL }},
3567 { &hf_ntppriv_mode7_inputresp, {
3568 "Responses on input", "ntp.priv.mode7.input_responses", FT_UINT32, BASE_DEC,
3569 NULL, 0, NULL, HFILL }},
3570 { &hf_ntppriv_mode7_inputfrag, {
3571 "Fragments on input", "ntp.priv.mode7.input_fragments", FT_UINT32, BASE_DEC,
3572 NULL, 0, NULL, HFILL }},
3573 { &hf_ntppriv_mode7_inputerr, {
3574 "Errors on input", "ntp.priv.mode7.input_errors", FT_UINT32, BASE_DEC,
3575 NULL, 0, NULL, HFILL }},
3576 { &hf_ntppriv_mode7_badoffset, {
3577 "Non zero offset packets", "ntp.priv.mode7.bad_offset", FT_UINT32, BASE_DEC,
3578 NULL, 0, NULL, HFILL }},
3579 { &hf_ntppriv_mode7_badversion, {
3580 "Unknown version packets", "ntp.priv.mode7.bad_version", FT_UINT32, BASE_DEC,
3581 NULL, 0, NULL, HFILL }},
3582 { &hf_ntppriv_mode7_datatooshort, {
3583 "Data too short", "ntp.priv.mode7.data_too_short", FT_UINT32, BASE_DEC,
3584 NULL, 0, NULL, HFILL }},
3585 { &hf_ntppriv_mode7_badop, {
3586 "Bad op code found", "ntp.priv.mode7.badop", FT_UINT32, BASE_DEC,
3587 NULL, 0, NULL, HFILL }},
3588 { &hf_ntppriv_mode7_asyncmsgs, {
3589 "Async messages", "ntp.priv.mode7.async_messages", FT_UINT32, BASE_DEC,
3590 NULL, 0, NULL, HFILL }},
3591 { &hf_ntppriv_mode7_type, {
3592 "Type", "ntp.priv.mode7.type", FT_UINT8, BASE_DEC,
3593 NULL, 0, NULL, HFILL }},
3594 { &hf_ntppriv_mode7_clock_flags, {
3595 "Clock Flags", "ntp.priv.mode7.clock_flags", FT_UINT8, BASE_DEC,
3596 NULL, 0, NULL, HFILL }},
3597 { &hf_ntppriv_mode7_lastevent, {
3598 "Last event", "ntp.priv.mode7.lastevent", FT_UINT8, BASE_DEC,
3599 NULL, 0, NULL, HFILL }},
3600 { &hf_ntppriv_mode7_currentstatus, {
3601 "Current status", "ntp.priv.mode7.currentstatus", FT_UINT8, BASE_DEC,
3602 NULL, 0, NULL, HFILL }},
3603 { &hf_ntppriv_mode7_polls, {
3604 "Polls", "ntp.priv.mode7.polls", FT_UINT32, BASE_DEC,
3605 NULL, 0, NULL, HFILL }},
3606 { &hf_ntppriv_mode7_noresponse, {
3607 "Noresponse", "ntp.priv.mode7.noresponse", FT_UINT32, BASE_DEC,
3608 NULL, 0, NULL, HFILL }},
3609 { &hf_ntppriv_mode7_badformat, {
3610 "Bad format", "ntp.priv.mode7.badformat", FT_UINT32, BASE_DEC,
3611 NULL, 0, NULL, HFILL }},
3612 { &hf_ntppriv_mode7_baddata, {
3613 "Bad data", "ntp.priv.mode7.baddata", FT_UINT32, BASE_DEC,
3614 NULL, 0, NULL, HFILL }},
3615 { &hf_ntppriv_mode7_timestarted, {
3616 "Time started", "ntp.priv.mode7.timestarted", FT_UINT32, BASE_DEC,
3617 NULL, 0, NULL, HFILL }},
3618 { &hf_ntppriv_mode7_fudgetime1, {
3619 "Fudge time 1", "ntp.priv.mode7.fudgetime1", FT_UINT64, BASE_HEX,
3620 NULL, 0, NULL, HFILL }},
3621 { &hf_ntppriv_mode7_fudgetime2, {
3622 "Fudge time 2", "ntp.priv.mode7.fudgetime2", FT_UINT64, BASE_HEX,
3623 NULL, 0, NULL, HFILL }},
3624 { &hf_ntppriv_mode7_fudgeval1, {
3625 "Fudge val 1", "ntp.priv.mode7.fudgeval1", FT_INT32, BASE_DEC,
3626 NULL, 0, NULL, HFILL }},
3627 { &hf_ntppriv_mode7_fudgeval2, {
3628 "Fudge val 2", "ntp.priv.mode7.fudgeval2", FT_UINT32, BASE_DEC,
3629 NULL, 0, NULL, HFILL }},
3630 { &hf_ntppriv_mode7_kernel_offset, {
3631 "Offset", "ntp.priv.mode7.kernel_offset", FT_INT32, BASE_DEC,
3632 NULL, 0, NULL, HFILL }},
3633 { &hf_ntppriv_mode7_freq, {
3634 "Freq", "ntp.priv.mode7.freq", FT_INT32, BASE_DEC,
3635 NULL, 0, NULL, HFILL }},
3636 { &hf_ntppriv_mode7_stability, {
3637 "Stability (ppm)", "ntp.priv.mode7.stability", FT_UINT32, BASE_DEC,
3638 NULL, 0, NULL, HFILL }},
3639 { &hf_ntppriv_mode7_maxerror, {
3640 "Max error", "ntp.priv.mode7.maxerror", FT_INT32, BASE_DEC,
3641 NULL, 0, NULL, HFILL }},
3642 { &hf_ntppriv_mode7_esterror, {
3643 "Est error", "ntp.priv.mode7.esterror", FT_INT32, BASE_DEC,
3644 NULL, 0, NULL, HFILL }},
3645 { &hf_ntppriv_mode7_status, {
3646 "Status", "ntp.priv.mode7.status", FT_UINT16, BASE_DEC,
3647 NULL, 0, NULL, HFILL }},
3648 { &hf_ntppriv_mode7_shift, {
3649 "Shift", "ntp.priv.mode7.shift", FT_UINT16, BASE_DEC,
3650 NULL, 0, NULL, HFILL }},
3651 { &hf_ntppriv_mode7_constant, {
3652 "Constant", "ntp.priv.mode7.constant", FT_INT32, BASE_DEC,
3653 NULL, 0, NULL, HFILL }},
3654 { &hf_ntppriv_mode7_precision, {
3655 "Precision", "ntp.priv.mode7.precision", FT_INT32, BASE_DEC,
3656 NULL, 0, NULL, HFILL }},
3657 { &hf_ntppriv_mode7_tolerance, {
3658 "tolerance", "ntp.priv.mode7.tolerance", FT_INT32, BASE_DEC,
3659 NULL, 0, NULL, HFILL }},
3660 { &hf_ntppriv_mode7_ppsfreq, {
3661 "ppsfreq", "ntp.priv.mode7.ppsfreq", FT_INT32, BASE_DEC,
3662 NULL, 0, NULL, HFILL }},
3663 { &hf_ntppriv_mode7_jitter, {
3664 "jitter", "ntp.priv.mode7.jitter", FT_INT32, BASE_DEC,
3665 NULL, 0, NULL, HFILL }},
3666 { &hf_ntppriv_mode7_stabil, {
3667 "stabil", "ntp.priv.mode7.stabil", FT_INT32, BASE_DEC,
3668 NULL, 0, NULL, HFILL }},
3669 { &hf_ntppriv_mode7_jitcnt, {
3670 "jitcnt", "ntp.priv.mode7.jitcnt", FT_INT32, BASE_DEC,
3671 NULL, 0, NULL, HFILL }},
3672 { &hf_ntppriv_mode7_calcnt, {
3673 "calcnt", "ntp.priv.mode7.calcnt", FT_INT32, BASE_DEC,
3674 NULL, 0, NULL, HFILL }},
3675 { &hf_ntppriv_mode7_errcnt, {
3676 "errcnt", "ntp.priv.mode7.errcnt", FT_INT32, BASE_DEC,
3677 NULL, 0, NULL, HFILL }},
3678 { &hf_ntppriv_mode7_stbcnt, {
3679 "stbcnt", "ntp.priv.mode7.stbcnt", FT_INT32, BASE_DEC,
3680 NULL, 0, NULL, HFILL }},
3681 { &hf_ntppriv_mode7_last_offset, {
3682 "Last offset", "ntp.priv.mode7.last_offset", FT_INT64, BASE_DEC,
3683 NULL, 0, NULL, HFILL }},
3684 { &hf_ntppriv_mode7_drift_comp, {
3685 "Drift comp", "ntp.priv.mode7.drift_comp", FT_INT64, BASE_DEC,
3686 NULL, 0, NULL, HFILL }},
3687 { &hf_ntppriv_mode7_compliance, {
3688 "Compliance", "ntp.priv.mode7.compliance", FT_UINT32, BASE_DEC,
3689 NULL, 0, NULL, HFILL }},
3690 { &hf_ntppriv_mode7_watchdog_timer, {
3691 "Watchdog timer", "ntp.priv.mode7.watchdog_timer", FT_UINT32, BASE_DEC,
3692 NULL, 0, NULL, HFILL }},
3693 { &hf_ntppriv_mode7_poll32, {
3694 "Poll", "ntp.priv.mode7.poll", FT_UINT32, BASE_DEC,
3695 NULL, 0, NULL, HFILL }},
3696 { &hf_ntppriv_mode7_sys_flags8, {
3697 "Flags", "ntp.priv.mode7.sys.flags8", FT_UINT8, BASE_HEX,
3698 NULL, 0xFF, NULL, HFILL }},
3699 { &hf_ntppriv_mode7_denied, {
3700 "Denied", "ntp.priv.mode7.denied", FT_UINT32, BASE_DEC,
3701 NULL, 0, NULL, HFILL }},
3702 { &hf_ntppriv_mode7_oldversion, {
3703 "Old version", "ntp.priv.mode7.oldversion", FT_UINT32, BASE_DEC,
3704 NULL, 0, NULL, HFILL }},
3705 { &hf_ntppriv_mode7_newversion, {
3706 "New version", "ntp.priv.mode7.newversion", FT_UINT32, BASE_DEC,
3707 NULL, 0, NULL, HFILL }},
3708 { &hf_ntppriv_mode7_badlength, {
3709 "Bad length", "ntp.priv.mode7.badlength", FT_UINT32, BASE_DEC,
3710 NULL, 0, NULL, HFILL }},
3711 { &hf_ntppriv_mode7_limitrejected, {
3712 "Limit rejected", "ntp.priv.mode7.limitrejected", FT_UINT32, BASE_DEC,
3713 NULL, 0, NULL, HFILL }},
3714 { &hf_ntppriv_mode7_lamport, {
3715 "Lamport violation", "ntp.priv.mode7.lamport", FT_UINT32, BASE_DEC,
3716 NULL, 0, NULL, HFILL }},
3717 { &hf_ntppriv_mode7_tsrounding, {
3718 "Timestamp rounding error", "ntp.priv.mode7.tsrounding", FT_UINT32, BASE_DEC,
3719 NULL, 0, NULL, HFILL }},
3720 { &hf_ntppriv_mode7_totalmem, {
3721 "Total memory", "ntp.priv.mode7.totalmem", FT_UINT16, BASE_DEC,
3722 NULL, 0, NULL, HFILL }},
3723 { &hf_ntppriv_mode7_freemem, {
3724 "Free memory", "ntp.priv.mode7.freemem", FT_UINT16, BASE_DEC,
3725 NULL, 0, NULL, HFILL }},
3726 { &hf_ntppriv_mode7_findpeer_calls, {
3727 "Find peer calls", "ntp.priv.mode7.findpeer_calls", FT_UINT32, BASE_DEC,
3728 NULL, 0, NULL, HFILL }},
3729 { &hf_ntppriv_mode7_allocations, {
3730 "Allocations", "ntp.priv.mode7.allocations", FT_UINT32, BASE_DEC,
3731 NULL, 0, NULL, HFILL }},
3732 { &hf_ntppriv_mode7_demobilizations, {
3733 "Demobilizations", "ntp.priv.mode7.demobilizations", FT_UINT32, BASE_DEC,
3734 NULL, 0, NULL, HFILL }},
3735 { &hf_ntppriv_mode7_hashcount, {
3736 "Hashcount", "ntp.priv.mode7.hashcount", FT_BYTES, BASE_NONE,
3737 NULL, 0, NULL, HFILL }},
3738 { &hf_ntppriv_mode7_totalrecvbufs, {
3739 "Toal receive buffer", "ntp.priv.mode7.totalrecvbufs", FT_UINT16, BASE_DEC,
3740 NULL, 0, NULL, HFILL }},
3741 { &hf_ntppriv_mode7_freerecvbufs, {
3742 "Free receive buffer", "ntp.priv.mode7.freerecvbufs", FT_UINT16, BASE_DEC,
3743 NULL, 0, NULL, HFILL }},
3744 { &hf_ntppriv_mode7_fullrecvbufs, {
3745 "Full receive buffer", "ntp.priv.mode7.fullrecvbufs", FT_UINT16, BASE_DEC,
3746 NULL, 0, NULL, HFILL }},
3747 { &hf_ntppriv_mode7_lowwater, {
3748 "Low water", "ntp.priv.mode7.lowwater", FT_UINT16, BASE_DEC,
3749 NULL, 0, NULL, HFILL }},
3750 { &hf_ntppriv_mode7_dropped, {
3751 "Dropped packets", "ntp.priv.mode7.dropped", FT_UINT32, BASE_DEC,
3752 NULL, 0, NULL, HFILL }},
3753 { &hf_ntppriv_mode7_ignored, {
3754 "Ignored packets", "ntp.priv.mode7.ignored", FT_UINT32, BASE_DEC,
3755 NULL, 0, NULL, HFILL }},
3756 { &hf_ntppriv_mode7_received, {
3757 "Received packets", "ntp.priv.mode7.received", FT_UINT32, BASE_DEC,
3758 NULL, 0, NULL, HFILL }},
3759 { &hf_ntppriv_mode7_notsent, {
3760 "Not sent packets", "ntp.priv.mode7.notsent", FT_UINT32, BASE_DEC,
3761 NULL, 0, NULL, HFILL }},
3762 { &hf_ntppriv_mode7_interrupts, {
3763 "Interrupts", "ntp.priv.mode7.interrupts", FT_UINT32, BASE_DEC,
3764 NULL, 0, NULL, HFILL }},
3765 { &hf_ntppriv_mode7_int_received, {
3766 "Received by interrupt handler", "ntp.priv.mode7.int_received", FT_UINT32, BASE_DEC,
3767 NULL, 0, NULL, HFILL }},
3768 { &hf_ntppriv_mode7_alarms, {
3769 "Alarms", "ntp.priv.mode7.alarms", FT_UINT32, BASE_DEC,
3770 NULL, 0, NULL, HFILL }},
3771 { &hf_ntppriv_mode7_overflows, {
3772 "Overflows", "ntp.priv.mode7.overflows", FT_UINT32, BASE_DEC,
3773 NULL, 0, NULL, HFILL }},
3774 { &hf_ntppriv_mode7_xmtcalls, {
3775 "Transmitted calls", "ntp.priv.mode7.xmtcalls", FT_UINT32, BASE_DEC,
3776 NULL, 0, NULL, HFILL }},
3777 { &hf_ntppriv_mode7_rflags, {
3778 "Rflags", "ntp.priv.mode7.rflags", FT_UINT16, BASE_DEC,
3779 NULL, 0, NULL, HFILL }},
3780 { &hf_ntppriv_mode7_mflags, {
3781 "Mflags", "ntp.priv.mode7.mflags", FT_UINT16, BASE_DEC,
3782 NULL, 0, NULL, HFILL }},
3783 { &hf_ntppriv_mode7_int_name, {
3784 "Interface name", "ntp.priv.mode7.int_name", FT_STRING, BASE_NONE,
3785 NULL, 0, NULL, HFILL }},
3786 { &hf_ntppriv_mode7_int_flags, {
3787 "Interface flags", "ntp.priv.mode7.int_flags", FT_INT32, BASE_DEC,
3788 NULL, 0, NULL, HFILL }},
3789 { &hf_ntppriv_mode7_last_ttl, {
3790 "Last TTL specified", "ntp.priv.mode7.last_ttl", FT_INT32, BASE_DEC,
3791 NULL, 0, NULL, HFILL }},
3792 { &hf_ntppriv_mode7_num_mcast, {
3793 "Numer multicast sockets", "ntp.priv.mode7.num_mcast", FT_INT32, BASE_DEC,
3794 NULL, 0, NULL, HFILL }},
3795 { &hf_ntppriv_mode7_uptime, {
3796 "Uptime", "ntp.priv.mode7.uptime", FT_INT32, BASE_DEC,
3797 NULL, 0, NULL, HFILL }},
3798 { &hf_ntppriv_mode7_scopeid, {
3799 "Scopeid", "ntp.priv.mode7.scopeid", FT_UINT32, BASE_DEC,
3800 NULL, 0, NULL, HFILL }},
3801 { &hf_ntppriv_mode7_ifindex, {
3802 "Ifindex", "ntp.priv.mode7.ifindex", FT_UINT32, BASE_DEC,
3803 NULL, 0, NULL, HFILL }},
3804 { &hf_ntppriv_mode7_ifnum, {
3805 "Ifnum", "ntp.priv.mode7.ifnum", FT_UINT32, BASE_DEC,
3806 NULL, 0, NULL, HFILL }},
3807 { &hf_ntppriv_mode7_peercnt, {
3808 "Peer count", "ntp.priv.mode7.peercnt", FT_UINT32, BASE_DEC,
3809 NULL, 0, NULL, HFILL }},
3810 { &hf_ntppriv_mode7_family, {
3811 "Address family", "ntp.priv.mode7.family", FT_UINT16, BASE_DEC,
3812 NULL, 0, NULL, HFILL }},
3813 { &hf_ntppriv_mode7_ignore_pkt, {
3814 "Ignore packets", "ntp.priv.mode7.ignore_pkts", FT_UINT8, BASE_DEC,
3815 NULL, 0, NULL, HFILL }},
3816 { &hf_ntppriv_mode7_action, {
3817 "Action", "ntp.priv.mode7.action", FT_UINT8, BASE_DEC,
3818 VALS(priv_mode7_int_action), 0, NULL, HFILL }},
3819 { &hf_ntppriv_mode7_nvalues, {
3820 "Nvalues", "ntp.priv.mode7.nvalues", FT_UINT8, BASE_DEC,
3821 NULL, 0, NULL, HFILL }},
3822 { &hf_ntppriv_mode7_ntimes, {
3823 "Ntimes", "ntp.priv.mode7.ntimes", FT_UINT8, BASE_DEC,
3824 NULL, 0, NULL, HFILL }},
3825 { &hf_ntppriv_mode7_svalues, {
3826 "Svalues", "ntp.priv.mode7.svalues", FT_UINT16, BASE_DEC,
3827 NULL, 0, NULL, HFILL }},
3828 { &hf_ntppriv_mode7_stimes, {
3829 "Stimes", "ntp.priv.mode7.stimes", FT_UINT32, BASE_DEC,
3830 NULL, 0, NULL, HFILL }},
3831 { &hf_ntppriv_mode7_values, {
3832 "Values", "ntp.priv.mode7.values", FT_BYTES, BASE_NONE,
3833 NULL, 0, NULL, HFILL }},
3834 { &hf_ntppriv_mode7_times, {
3835 "Times", "ntp.priv.mode7.times", FT_BYTES, BASE_NONE,
3836 NULL, 0, NULL, HFILL }},
3837 { &hf_ntppriv_mode7_which, {
3838 "Which", "ntp.priv.mode7.which", FT_UINT32, BASE_DEC,
3839 NULL, 0, NULL, HFILL }},
3840 { &hf_ntppriv_mode7_fudgetime, {
3841 "Fudgetime", "ntp.priv.mode7.fudgetime", FT_UINT64, BASE_DEC,
3842 NULL, 0, NULL, HFILL }},
3843 { &hf_ntppriv_mode7_fudgeval_flags, {
3844 "Fudgeval flags", "ntp.priv.mode7.fudgeval_flags", FT_UINT32, BASE_DEC,
3845 NULL, 0, NULL, HFILL }},
3846 { &hf_ntppriv_mode7_ippeerlimit, {
3847 "IP peer limit", "ntp.priv.mode7.ippeerlimit", FT_INT16, BASE_DEC,
3848 NULL, 0, NULL, HFILL }},
3849 { &hf_ntppriv_mode7_restrict_flags, {
3850 "Restrict flags", "ntp.priv.mode7.restrict_flags", FT_UINT16, BASE_DEC,
3851 NULL, 0, NULL, HFILL }},
3852 /* Todo */
3855 static int *ett[] = {
3856 &ett_ntp,
3857 &ett_ntp_flags,
3858 &ett_ntp_ext,
3859 &ett_ntp_ext_flags,
3860 &ett_ntp_ext_nts,
3861 &ett_ntpctrl_flags2,
3862 &ett_ntpctrl_status,
3863 &ett_ntpctrl_data,
3864 &ett_ntpctrl_item,
3865 &ett_ntppriv_auth_seq,
3866 &ett_mode7_item,
3867 &ett_ntppriv_peer_list_flags,
3868 &ett_ntppriv_config_flags,
3869 &ett_ntppriv_sys_flag_flags,
3870 &ett_ntppriv_reset_stats_flags,
3871 &ett_ntp_authenticator
3874 static ei_register_info ei[] = {
3875 { &ei_ntp_ext, { "ntp.ext.invalid_length", PI_PROTOCOL, PI_WARN, "Extension invalid length", EXPFILL }},
3878 expert_module_t* expert_ntp;
3880 proto_ntp = proto_register_protocol("Network Time Protocol", "NTP", "ntp");
3881 proto_register_field_array(proto_ntp, hf, array_length(hf));
3882 proto_register_subtree_array(ett, array_length(ett));
3883 expert_ntp = expert_register_protocol(proto_ntp);
3884 expert_register_field_array(expert_ntp, ei, array_length(ei));
3886 ntp_handle = register_dissector("ntp", dissect_ntp, proto_ntp);
3888 init_parser();
3891 void
3892 proto_reg_handoff_ntp(void)
3894 dissector_add_uint_with_preference("udp.port", UDP_PORT_NTP, ntp_handle);
3895 dissector_add_uint_with_preference("tcp.port", TCP_PORT_NTP, ntp_handle);
3899 * Editor modelines - https://www.wireshark.org/tools/modelines.html
3901 * Local variables:
3902 * c-basic-offset: 8
3903 * tab-width: 8
3904 * indent-tabs-mode: t
3905 * End:
3907 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
3908 * :indentSize=8:tabSize=8:noTabs=false: