Coverage Report

Created: 2025-12-27 06:52

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