1999-10-14 05:10:33 +00:00
|
|
|
/* packet-ntp.c
|
|
|
|
* Routines for NTP packet dissection
|
|
|
|
* Copyright 1999, Nathan Neulinger <nneul@umr.edu>
|
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
1999-10-14 05:10:33 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
1999-10-14 05:10:33 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* Copied from packet-tftp.c
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-10-14 05:10:33 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-10-14 05:10:33 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-10-14 05:10:33 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2007-01-05 13:42:08 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
1999-10-14 05:10:33 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <string.h>
|
1999-10-22 06:31:39 +00:00
|
|
|
#include <time.h>
|
|
|
|
#include <math.h>
|
1999-10-14 05:10:33 +00:00
|
|
|
#include <glib.h>
|
1999-10-25 20:48:48 +00:00
|
|
|
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/packet.h>
|
2004-08-06 19:57:49 +00:00
|
|
|
#include <epan/addr_resolv.h>
|
2005-09-21 20:05:13 +00:00
|
|
|
#include <epan/emem.h>
|
2009-11-25 21:47:28 +00:00
|
|
|
|
|
|
|
#include <epan/tvbparse.h>
|
|
|
|
|
1999-10-14 05:10:33 +00:00
|
|
|
#include "packet-ntp.h"
|
|
|
|
|
1999-10-25 01:55:45 +00:00
|
|
|
/*
|
|
|
|
* Dissecting NTP packets version 3 and 4 (RFC2030, RFC1769, RFC1361,
|
|
|
|
* RFC1305).
|
|
|
|
*
|
|
|
|
* Those packets have simple structure:
|
|
|
|
* 1 2 3
|
|
|
|
* 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
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* |LI | VN |Mode | Stratum | Poll | Precision |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* | Root Delay |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* | Root Dispersion |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* | Reference Identifier |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* | Reference Timestamp (64) |
|
|
|
|
* | |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* | Originate Timestamp (64) |
|
|
|
|
* | |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* | Receive Timestamp (64) |
|
|
|
|
* | |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* | Transmit Timestamp (64) |
|
|
|
|
* | |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* | Key Identifier (optional) (32) |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* | Message Digest (optional) (128) |
|
|
|
|
* | |
|
|
|
|
* | |
|
|
|
|
* | |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* NTP timestamps are represented as a 64-bit unsigned fixed-point number,
|
|
|
|
* in seconds relative to 0h on 1 January 1900. The integer part is in the
|
|
|
|
* first 32 bits and the fraction part in the last 32 bits.
|
2009-11-25 21:47:28 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* NTP Control messages as defined in version 2, 3 and 4 (RFC1119, RFC1305) use
|
|
|
|
* the following structure:
|
|
|
|
* 1 2 3
|
|
|
|
* 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
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* |00 | VN | 110 |R E M| OpCode | Sequence |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* | Status | Association ID |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* | Offset | Count |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* | |
|
|
|
|
* | Data (468 octets max) |
|
|
|
|
* | |
|
|
|
|
* | | Padding (zeros) |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* | Authenticator (optional) (96) |
|
|
|
|
* | |
|
|
|
|
* | |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
*
|
|
|
|
* Not yet implemented: complete dissection of TPCTRL_OP_SETTRAP,
|
|
|
|
* NTPCTRL_OP_ASYNCMSG, NTPCTRL_OP_UNSETTRAPSETTRAP Control-Messages
|
|
|
|
*
|
1999-10-25 01:55:45 +00:00
|
|
|
*/
|
|
|
|
|
2000-04-08 07:07:42 +00:00
|
|
|
#define UDP_PORT_NTP 123
|
|
|
|
#define TCP_PORT_NTP 123
|
|
|
|
|
2001-01-07 01:47:37 +00:00
|
|
|
/* Leap indicator, 2bit field is used to warn of a inserted/deleted
|
|
|
|
* second, or to alarm loosed synchronization.
|
|
|
|
*/
|
|
|
|
#define NTP_LI_MASK 0xC0
|
|
|
|
|
|
|
|
#define NTP_LI_NONE 0
|
|
|
|
#define NTP_LI_61 1
|
|
|
|
#define NTP_LI_59 2
|
|
|
|
#define NTP_LI_ALARM 3
|
|
|
|
|
1999-10-22 06:31:39 +00:00
|
|
|
static const value_string li_types[] = {
|
|
|
|
{ NTP_LI_NONE, "no warning" },
|
|
|
|
{ NTP_LI_61, "last minute has 61 seconds" },
|
|
|
|
{ NTP_LI_59, "last minute has 59 seconds" },
|
|
|
|
{ NTP_LI_ALARM, "alarm condition (clock not synchronized)" },
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
1999-10-25 01:55:45 +00:00
|
|
|
/* Version info, 3bit field informs about NTP version used in particular
|
|
|
|
* packet. According to rfc2030, version info could be only 3 or 4, but I
|
|
|
|
* have noticed packets with 1 or even 6 as version numbers. They are
|
|
|
|
* produced as a result of ntptrace command. Are those packets mailformed
|
|
|
|
* on purpose? I don't know yet, probably some browsing through ntp sources
|
|
|
|
* would help. My solution is to put them as reserved for now.
|
|
|
|
*/
|
2001-01-07 01:47:37 +00:00
|
|
|
#define NTP_VN_MASK 0x38
|
|
|
|
|
1999-10-22 06:31:39 +00:00
|
|
|
static const value_string ver_nums[] = {
|
2001-01-07 01:47:37 +00:00
|
|
|
{ 0, "reserved" },
|
2009-01-23 19:36:48 +00:00
|
|
|
{ 1, "NTP Version 1" },
|
|
|
|
{ 2, "NTP Version 2" },
|
2001-01-07 01:47:37 +00:00
|
|
|
{ 3, "NTP Version 3" },
|
|
|
|
{ 4, "NTP Version 4" },
|
|
|
|
{ 5, "reserved" },
|
|
|
|
{ 6, "reserved" },
|
|
|
|
{ 7, "reserved" },
|
|
|
|
{ 0, NULL}
|
1999-10-22 06:31:39 +00:00
|
|
|
};
|
|
|
|
|
1999-10-25 01:55:45 +00:00
|
|
|
/* Mode, 3bit field representing mode of comunication.
|
|
|
|
*/
|
2001-01-07 01:47:37 +00:00
|
|
|
#define NTP_MODE_MASK 7
|
|
|
|
|
|
|
|
#define NTP_MODE_RSV 0
|
|
|
|
#define NTP_MODE_SYMACT 1
|
|
|
|
#define NTP_MODE_SYMPAS 2
|
|
|
|
#define NTP_MODE_CLIENT 3
|
|
|
|
#define NTP_MODE_SERVER 4
|
|
|
|
#define NTP_MODE_BCAST 5
|
|
|
|
#define NTP_MODE_CTRL 6
|
|
|
|
#define NTP_MODE_PRIV 7
|
|
|
|
|
1999-10-22 06:31:39 +00:00
|
|
|
static const value_string mode_types[] = {
|
|
|
|
{ NTP_MODE_RSV, "reserved" },
|
|
|
|
{ NTP_MODE_SYMACT, "symmetric active" },
|
|
|
|
{ NTP_MODE_SYMPAS, "symmetric passive" },
|
|
|
|
{ NTP_MODE_CLIENT, "client" },
|
|
|
|
{ NTP_MODE_SERVER, "server" },
|
|
|
|
{ NTP_MODE_BCAST, "broadcast" },
|
|
|
|
{ NTP_MODE_CTRL, "reserved for NTP control message"},
|
|
|
|
{ NTP_MODE_PRIV, "reserved for private use" },
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
2007-01-05 13:42:08 +00:00
|
|
|
static const value_string info_mode_types[] = {
|
|
|
|
{ NTP_MODE_RSV, "NTP reserved" },
|
|
|
|
{ NTP_MODE_SYMACT, "NTP symmetric active" },
|
|
|
|
{ NTP_MODE_SYMPAS, "NTP symmetric passive" },
|
|
|
|
{ NTP_MODE_CLIENT, "NTP client" },
|
|
|
|
{ NTP_MODE_SERVER, "NTP server" },
|
|
|
|
{ NTP_MODE_BCAST, "NTP broadcast" },
|
|
|
|
{ NTP_MODE_CTRL, "NTP control"},
|
|
|
|
{ NTP_MODE_PRIV, "NTP private" },
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
1999-10-25 01:55:45 +00:00
|
|
|
/* According to rfc, primary (stratum-0 and stratum-1) servers should set
|
|
|
|
* their Reference Clock ID (4bytes field) according to following table:
|
|
|
|
*/
|
1999-10-22 06:31:39 +00:00
|
|
|
static const struct {
|
2005-08-05 00:23:22 +00:00
|
|
|
const char *id;
|
|
|
|
const char *data;
|
1999-10-22 06:31:39 +00:00
|
|
|
} primary_sources[] = {
|
|
|
|
{ "LOCL", "uncalibrated local clock" },
|
|
|
|
{ "PPS\0", "atomic clock or other pulse-per-second source" },
|
|
|
|
{ "ACTS", "NIST dialup modem service" },
|
|
|
|
{ "USNO", "USNO modem service" },
|
|
|
|
{ "PTB\0", "PTB (Germany) modem service" },
|
|
|
|
{ "TDF\0", "Allouis (France) Radio 164 kHz" },
|
|
|
|
{ "DCF\0", "Mainflingen (Germany) Radio 77.5 kHz" },
|
|
|
|
{ "MSF\0", "Rugby (UK) Radio 60 kHz" },
|
|
|
|
{ "WWV\0", "Ft. Collins (US) Radio 2.5, 5, 10, 15, 20 MHz" },
|
|
|
|
{ "WWVB", "Boulder (US) Radio 60 kHz" },
|
2008-04-15 21:45:46 +00:00
|
|
|
{ "WWVH", "Kauai Hawaii (US) Radio 2.5, 5, 10, 15 MHz" },
|
1999-10-22 06:31:39 +00:00
|
|
|
{ "CHU\0", "Ottawa (Canada) Radio 3330, 7335, 14670 kHz" },
|
|
|
|
{ "LORC", "LORAN-C radionavigation system" },
|
|
|
|
{ "OMEG", "OMEGA radionavigation system" },
|
|
|
|
{ "GPS\0", "Global Positioning Service" },
|
|
|
|
{ "GOES", "Geostationary Orbit Environment Satellite" },
|
|
|
|
{ "DCN\0", "DCN routing protocol" },
|
|
|
|
{ "NIST", "NIST public modem" },
|
|
|
|
{ "TSP\0", "TSP time protocol" },
|
|
|
|
{ "DTS\0", "Digital Time Service" },
|
|
|
|
{ "ATOM", "Atomic clock (calibrated)" },
|
|
|
|
{ "VLF\0", "VLF radio (OMEGA,, etc.)" },
|
2000-11-17 05:25:59 +00:00
|
|
|
{ "IRIG", "IRIG-B timecode" },
|
|
|
|
{ "1PPS", "External 1 PPS input" },
|
|
|
|
{ "FREE", "(Internal clock)" },
|
2006-08-23 15:51:15 +00:00
|
|
|
{ "INIT", "(Initialization)" },
|
|
|
|
{ "\0\0\0\0", "NULL" },
|
1999-10-22 06:31:39 +00:00
|
|
|
{ NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2003-11-12 20:44:36 +00:00
|
|
|
#define NTP_EXT_R_MASK 0x80
|
|
|
|
|
|
|
|
static const value_string ext_r_types[] = {
|
|
|
|
{ 0, "Request" },
|
|
|
|
{ 1, "Response" },
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
#define NTP_EXT_ERROR_MASK 0x40
|
|
|
|
#define NTP_EXT_VN_MASK 0x3f
|
|
|
|
|
|
|
|
static const value_string ext_op_types[] = {
|
|
|
|
{ 0, "NULL" },
|
|
|
|
{ 1, "ASSOC" },
|
|
|
|
{ 2, "CERT" },
|
|
|
|
{ 3, "COOK" },
|
|
|
|
{ 4, "AUTO" },
|
|
|
|
{ 5, "TAI" },
|
|
|
|
{ 6, "SIGN" },
|
|
|
|
{ 7, "IFF" },
|
|
|
|
{ 8, "GQ" },
|
|
|
|
{ 9, "MV" },
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
#define NTPCTRL_R_MASK 0x80
|
|
|
|
|
|
|
|
#define ctrl_r_types ext_r_types
|
|
|
|
|
|
|
|
#define NTPCTRL_ERROR_MASK 0x40
|
|
|
|
#define NTPCTRL_MORE_MASK 0x20
|
|
|
|
#define NTPCTRL_OP_MASK 0x1f
|
|
|
|
|
2009-11-25 21:47:28 +00:00
|
|
|
#define NTPCTRL_OP_UNSPEC 0
|
|
|
|
#define NTPCTRL_OP_READSTAT 1
|
|
|
|
#define NTPCTRL_OP_READVAR 2
|
|
|
|
#define NTPCTRL_OP_WRITEVAR 3
|
|
|
|
#define NTPCTRL_OP_READCLOCK 4
|
|
|
|
#define NTPCTRL_OP_WRITECLOCK 5
|
|
|
|
#define NTPCTRL_OP_SETTRAP 6
|
|
|
|
#define NTPCTRL_OP_ASYNCMSG 7
|
|
|
|
#define NTPCTRL_OP_UNSETTRAP 31
|
|
|
|
|
2003-11-12 20:44:36 +00:00
|
|
|
static const value_string ctrl_op_types[] = {
|
2009-11-25 21:47:28 +00:00
|
|
|
{ NTPCTRL_OP_UNSPEC, "UNSPEC" },
|
|
|
|
{ NTPCTRL_OP_READSTAT, "READSTAT" },
|
|
|
|
{ NTPCTRL_OP_READVAR, "READVAR" },
|
|
|
|
{ NTPCTRL_OP_WRITEVAR, "WRITEVAR" },
|
|
|
|
{ NTPCTRL_OP_READCLOCK, "READCLOCK" },
|
|
|
|
{ NTPCTRL_OP_WRITECLOCK, "WRITECLOCK" },
|
|
|
|
{ NTPCTRL_OP_SETTRAP, "SETTRAP" },
|
|
|
|
{ NTPCTRL_OP_ASYNCMSG, "ASYNCMSG" },
|
|
|
|
{ NTPCTRL_OP_UNSETTRAP, "UNSETTRAP" },
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
#define NTPCTRL_SYSSTATUS_LI_MASK 0xC000
|
|
|
|
#define NTPCTRL_SYSSTATUS_CLK_MASK 0x3F00
|
|
|
|
#define NTPCTRL_SYSSTATUS_COUNT_MASK 0x00F0
|
|
|
|
#define NTPCTRL_SYSSTATUS_CODE_MASK 0x000F
|
|
|
|
|
|
|
|
static const value_string ctrl_sys_status_clksource_types[] = {
|
|
|
|
{ 0, "unspecified or unknown" },
|
|
|
|
{ 1, "Calibrated atomic clock (e.g. HP 5061)" },
|
|
|
|
{ 2, "VLF (band 4) or LF (band 5) radio (e.g. OMEGA, WWVB)" },
|
|
|
|
{ 3, "HF (band 7) radio (e.g. CHU, MSF, WWV/H)" },
|
|
|
|
{ 4, "UHF (band 9) satellite (e.g. GOES, GPS)" },
|
|
|
|
{ 5, "local net (e.g. DCN, TSP, DTS)" },
|
|
|
|
{ 6, "UDP/NTP" },
|
|
|
|
{ 7, "UDP/TIME" },
|
|
|
|
{ 8, "eyeball-and-wristwatch" },
|
|
|
|
{ 9, "telephone modem (e.g. NIST)" },
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string ctrl_sys_status_event_types[] = {
|
|
|
|
{ 0, "unspecified" },
|
|
|
|
{ 1, "system restart" },
|
|
|
|
{ 2, "system or hardware fault" },
|
|
|
|
{ 3, "system new status word (leap bits or synchronization change)" },
|
|
|
|
{ 4, "system new synchronization source or stratum (sys.peer or sys.stratum change)" },
|
|
|
|
{ 5, "system clock reset (offset correction exceeds CLOCK.MAX)" },
|
|
|
|
{ 6, "system invalid time or date (see NTP spec.)" },
|
|
|
|
{ 7, "system clock exception (see system clock status word)" },
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
#define NTPCTRL_PEERSTATUS_STATUS_MASK 0xF800
|
|
|
|
#define NTPCTRL_PEERSTATUS_CONFIG_MASK 0x8000
|
|
|
|
#define NTPCTRL_PEERSTATUS_AUTHENABLE_MASK 0x4000
|
|
|
|
#define NTPCTRL_PEERSTATUS_AUTHENTIC_MASK 0x2000
|
|
|
|
#define NTPCTRL_PEERSTATUS_REACH_MASK 0x1000
|
|
|
|
#define NTPCTRL_PEERSTATUS_RESERVED_MASK 0x0800
|
|
|
|
#define NTPCTRL_PEERSTATUS_SEL_MASK 0x0700
|
|
|
|
#define NTPCTRL_PEERSTATUS_COUNT_MASK 0x00F0
|
|
|
|
#define NTPCTRL_PEERSTATUS_CODE_MASK 0x000F
|
|
|
|
|
|
|
|
static const value_string ctrl_peer_status_config_types[] = {
|
|
|
|
{ 0, "not configured (peer.config)" },
|
|
|
|
{ 1, "configured (peer.config)" },
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string ctrl_peer_status_authenable_types[] = {
|
|
|
|
{ 0, "authentication disabled (peer.authenable" },
|
|
|
|
{ 1, "authentication enabled (peer.authenable" },
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string ctrl_peer_status_authentic_types[] = {
|
|
|
|
{ 0, "authentication not okay (peer.authentic)" },
|
|
|
|
{ 1, "authentication okay (peer.authentic)" },
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string ctrl_peer_status_reach_types[] = {
|
|
|
|
{ 0, "reachability not okay (peer.reach != 0)" },
|
|
|
|
{ 1, "reachability okay (peer.reach != 0)" },
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string ctrl_peer_status_selection_types[] = {
|
|
|
|
{ 0, "rejected" },
|
|
|
|
{ 1, "passed sanity checks (tests 1 trough 8 in Section 3.4.3)" },
|
|
|
|
{ 2, "passed correctness checks (intersection algorithm in Section 4.2.1)" },
|
|
|
|
{ 3, "passed candidate checks (if limit check implemented)" },
|
|
|
|
{ 4, "passed outlyer checks (clustering algorithm in Section 4.2.2)" },
|
|
|
|
{ 5, "current synchronization source; max distance exceeded (if limit check implemented)" },
|
|
|
|
{ 6, "current synchronization source; max distance okay" },
|
|
|
|
{ 7, "reserved" },
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string ctrl_peer_status_event_types[] = {
|
|
|
|
{ 0, "unspecified" },
|
|
|
|
{ 1, "peer IP error" },
|
|
|
|
{ 2, "peer authentication failure (peer.authentic bit was one now zero)" },
|
|
|
|
{ 3, "peer unreachable (peer.reach was nonzero now zero)" },
|
|
|
|
{ 4, "peer reachable (peer.reach was zero now nonzero)" },
|
|
|
|
{ 5, "peer clock exception (see peer clock status word)" },
|
2003-11-12 20:44:36 +00:00
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
2009-11-25 21:47:28 +00:00
|
|
|
#define NTPCTRL_CLKSTATUS_STATUS_MASK 0xFF00
|
|
|
|
#define NTPCTRL_CLKSTATUS_CODE_MASK 0x00FF
|
|
|
|
|
|
|
|
static const value_string ctrl_clk_status_types[] = {
|
|
|
|
{ 0, "clock operating within nominals" },
|
|
|
|
{ 1, "reply timeout" },
|
|
|
|
{ 2, "bad reply format" },
|
|
|
|
{ 3, "hardware or software fault" },
|
|
|
|
{ 4, "propagation failure" },
|
|
|
|
{ 5, "bad date format or value" },
|
|
|
|
{ 6, "bad time format or value" },
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
#define NTP_CTRL_ERRSTATUS_CODE_MASK 0xFF00
|
|
|
|
|
|
|
|
static const value_string ctrl_err_status_types[] = {
|
|
|
|
{ 0, "unspecified" },
|
|
|
|
{ 1, "authentication failure" },
|
|
|
|
{ 2, "invalid message length or format" },
|
|
|
|
{ 3, "invalid opcode" },
|
|
|
|
{ 4, "unknown association identifier" },
|
|
|
|
{ 5, "unknown variable name" },
|
|
|
|
{ 6, "invalid variable value" },
|
|
|
|
{ 7, "administratively prohibited" },
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-11-12 20:44:36 +00:00
|
|
|
#define NTPPRIV_R_MASK 0x80
|
|
|
|
|
|
|
|
#define priv_r_types ext_r_types
|
|
|
|
|
|
|
|
#define NTPPRIV_MORE_MASK 0x40
|
|
|
|
|
|
|
|
#define NTPPRIV_AUTH_MASK 0x80
|
|
|
|
#define NTPPRIV_SEQ_MASK 0x7f
|
|
|
|
|
|
|
|
static const value_string priv_impl_types[] = {
|
|
|
|
{ 0, "UNIV" },
|
|
|
|
{ 2, "XNTPD_OLD (pre-IPv6)" },
|
|
|
|
{ 3, "XNTPD" },
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string priv_rc_types[] = {
|
|
|
|
{ 0, "PEER_LIST" },
|
|
|
|
{ 1, "PEER_LIST_SUM" },
|
|
|
|
{ 2, "PEER_INFO" },
|
|
|
|
{ 3, "PEER_STATS" },
|
|
|
|
{ 4, "SYS_INFO" },
|
|
|
|
{ 5, "SYS_STATS" },
|
|
|
|
{ 6, "IO_STATS" },
|
|
|
|
{ 7, "MEM_STATS" },
|
|
|
|
{ 8, "LOOP_INFO" },
|
|
|
|
{ 9, "TIMER_STATS" },
|
|
|
|
{ 10, "CONFIG" },
|
|
|
|
{ 11, "UNCONFIG" },
|
|
|
|
{ 12, "SET_SYS_FLAG" },
|
|
|
|
{ 13, "CLR_SYS_FLAG" },
|
|
|
|
{ 16, "GET_RESTRICT" },
|
|
|
|
{ 17, "RESADDFLAGS" },
|
|
|
|
{ 18, "RESSUBFLAGS" },
|
|
|
|
{ 19, "UNRESTRICT" },
|
|
|
|
{ 20, "MON_GETLIST" },
|
|
|
|
{ 21, "RESET_STATS" },
|
|
|
|
{ 22, "RESET_PEER" },
|
|
|
|
{ 23, "REREAD_KEYS" },
|
|
|
|
{ 26, "TRUSTKEY" },
|
|
|
|
{ 27, "UNTRUSTKEY" },
|
|
|
|
{ 28, "AUTHINFO" },
|
|
|
|
{ 29, "TRAPS" },
|
|
|
|
{ 30, "ADD_TRAP" },
|
|
|
|
{ 31, "CLR_TRAP" },
|
|
|
|
{ 32, "REQUEST_KEY" },
|
|
|
|
{ 33, "CONTROL_KEY" },
|
|
|
|
{ 34, "GET_CTLSTATS" },
|
|
|
|
{ 36, "GET_CLOCKINFO" },
|
|
|
|
{ 37, "SET_CLKFUDGE" },
|
|
|
|
{ 38, "GET_KERNEL" },
|
|
|
|
{ 39, "GET_CLKBUGINFO" },
|
|
|
|
{ 42, "MON_GETLIST_1" },
|
|
|
|
{ 43, "HOSTNAME_ASSOCID" },
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Maximum MAC length.
|
|
|
|
*/
|
|
|
|
#define MAX_MAC_LEN (5 * sizeof (guint32))
|
|
|
|
|
1999-10-14 05:10:33 +00:00
|
|
|
static int proto_ntp = -1;
|
2003-11-12 20:44:36 +00:00
|
|
|
|
1999-10-14 05:10:33 +00:00
|
|
|
static int hf_ntp_flags = -1;
|
1999-10-22 06:31:39 +00:00
|
|
|
static int hf_ntp_flags_li = -1;
|
|
|
|
static int hf_ntp_flags_vn = -1;
|
|
|
|
static int hf_ntp_flags_mode = -1;
|
1999-10-14 05:10:33 +00:00
|
|
|
static int hf_ntp_stratum = -1;
|
|
|
|
static int hf_ntp_ppoll = -1;
|
|
|
|
static int hf_ntp_precision = -1;
|
|
|
|
static int hf_ntp_rootdelay = -1;
|
|
|
|
static int hf_ntp_rootdispersion = -1;
|
|
|
|
static int hf_ntp_refid = -1;
|
|
|
|
static int hf_ntp_reftime = -1;
|
|
|
|
static int hf_ntp_org = -1;
|
|
|
|
static int hf_ntp_rec = -1;
|
|
|
|
static int hf_ntp_xmt = -1;
|
|
|
|
static int hf_ntp_keyid = -1;
|
|
|
|
static int hf_ntp_mac = -1;
|
|
|
|
|
2003-11-12 20:44:36 +00:00
|
|
|
static int hf_ntp_ext = -1;
|
|
|
|
static int hf_ntp_ext_flags = -1;
|
|
|
|
static int hf_ntp_ext_flags_r = -1;
|
|
|
|
static int hf_ntp_ext_flags_error = -1;
|
|
|
|
static int hf_ntp_ext_flags_vn = -1;
|
|
|
|
static int hf_ntp_ext_op = -1;
|
|
|
|
static int hf_ntp_ext_len = -1;
|
|
|
|
static int hf_ntp_ext_associd = -1;
|
|
|
|
static int hf_ntp_ext_tstamp = -1;
|
|
|
|
static int hf_ntp_ext_fstamp = -1;
|
|
|
|
static int hf_ntp_ext_vallen = -1;
|
|
|
|
static int hf_ntp_ext_val = -1;
|
|
|
|
static int hf_ntp_ext_siglen = -1;
|
|
|
|
static int hf_ntp_ext_sig = -1;
|
|
|
|
|
|
|
|
static int hf_ntpctrl_flags2 = -1;
|
|
|
|
static int hf_ntpctrl_flags2_r = -1;
|
|
|
|
static int hf_ntpctrl_flags2_error = -1;
|
|
|
|
static int hf_ntpctrl_flags2_more = -1;
|
|
|
|
static int hf_ntpctrl_flags2_opcode = -1;
|
2009-11-25 21:47:28 +00:00
|
|
|
static int hf_ntpctrl_sequence = -1;
|
|
|
|
static int hf_ntpctrl_status = -1;
|
|
|
|
static int hf_ntpctrl_error_status_word = -1;
|
|
|
|
static int hf_ntpctrl_sys_status_li = -1;
|
|
|
|
static int hf_ntpctrl_sys_status_clksrc = -1;
|
|
|
|
static int hf_ntpctrl_sys_status_count = -1;
|
|
|
|
static int hf_ntpctrl_sys_status_code = -1;
|
|
|
|
static int hf_ntpctrl_peer_status_b0 = -1;
|
|
|
|
static int hf_ntpctrl_peer_status_b1 = -1;
|
|
|
|
static int hf_ntpctrl_peer_status_b2 = -1;
|
|
|
|
static int hf_ntpctrl_peer_status_b3 = -1;
|
|
|
|
static int hf_ntpctrl_peer_status_b4 = -1;
|
|
|
|
static int hf_ntpctrl_peer_status_selection = -1;
|
|
|
|
static int hf_ntpctrl_peer_status_count = -1;
|
|
|
|
static int hf_ntpctrl_peer_status_code = -1;
|
|
|
|
static int hf_ntpctrl_clk_status = -1;
|
|
|
|
static int hf_ntpctrl_clk_status_code = -1;
|
|
|
|
static int hf_ntpctrl_associd = -1;
|
|
|
|
static int hf_ntpctrl_offset = -1;
|
|
|
|
static int hf_ntpctrl_count = -1;
|
|
|
|
static int hf_ntpctrl_data = -1;
|
|
|
|
static int hf_ntpctrl_item = -1;
|
|
|
|
static int hf_ntpctrl_trapmsg = -1;
|
2003-11-12 20:44:36 +00:00
|
|
|
|
|
|
|
static int hf_ntppriv_flags_r = -1;
|
|
|
|
static int hf_ntppriv_flags_more = -1;
|
|
|
|
static int hf_ntppriv_auth_seq = -1;
|
|
|
|
static int hf_ntppriv_auth = -1;
|
|
|
|
static int hf_ntppriv_seq = -1;
|
|
|
|
static int hf_ntppriv_impl = -1;
|
|
|
|
static int hf_ntppriv_reqcode = -1;
|
|
|
|
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint ett_ntp = -1;
|
|
|
|
static gint ett_ntp_flags = -1;
|
2003-11-12 20:44:36 +00:00
|
|
|
static gint ett_ntp_ext = -1;
|
|
|
|
static gint ett_ntp_ext_flags = -1;
|
|
|
|
static gint ett_ntpctrl_flags2 = -1;
|
2009-11-25 21:47:28 +00:00
|
|
|
static gint ett_ntpctrl_status = -1;
|
|
|
|
static gint ett_ntpctrl_data = -1;
|
|
|
|
static gint ett_ntpctrl_item = -1;
|
2003-11-12 20:44:36 +00:00
|
|
|
static gint ett_ntppriv_auth_seq = -1;
|
|
|
|
|
|
|
|
static void dissect_ntp_std(tvbuff_t *, proto_tree *, guint8);
|
|
|
|
static void dissect_ntp_ctrl(tvbuff_t *, proto_tree *, guint8);
|
|
|
|
static void dissect_ntp_priv(tvbuff_t *, proto_tree *, guint8);
|
|
|
|
static int dissect_ntp_ext(tvbuff_t *, proto_tree *, int);
|
1999-11-16 11:44:20 +00:00
|
|
|
|
2005-03-01 06:04:31 +00:00
|
|
|
static const char *mon_names[12] = {
|
|
|
|
"Jan",
|
|
|
|
"Feb",
|
|
|
|
"Mar",
|
|
|
|
"Apr",
|
|
|
|
"May",
|
|
|
|
"Jun",
|
|
|
|
"Jul",
|
|
|
|
"Aug",
|
|
|
|
"Sep",
|
|
|
|
"Oct",
|
|
|
|
"Nov",
|
|
|
|
"Dec"
|
|
|
|
};
|
|
|
|
|
2009-11-25 21:47:28 +00:00
|
|
|
|
|
|
|
/* parser definitions */
|
|
|
|
static tvbparse_wanted_t* want;
|
|
|
|
static tvbparse_wanted_t* want_ignore;
|
|
|
|
|
|
|
|
|
1999-12-21 17:21:22 +00:00
|
|
|
/* ntp_fmt_ts - converts NTP timestamp to human readable string.
|
2001-01-06 09:42:10 +00:00
|
|
|
* reftime - 64bit timestamp (IN)
|
2005-09-21 20:05:13 +00:00
|
|
|
* returns pointer to filled buffer. This buffer will be freed automatically once
|
|
|
|
* dissection of the next packet occurs.
|
1999-10-25 01:55:45 +00:00
|
|
|
*/
|
2004-05-13 20:20:34 +00:00
|
|
|
char *
|
2005-09-21 20:05:13 +00:00
|
|
|
ntp_fmt_ts(const guint8 *reftime)
|
1999-10-22 06:31:39 +00:00
|
|
|
{
|
|
|
|
guint32 tempstmp, tempfrac;
|
|
|
|
time_t temptime;
|
|
|
|
struct tm *bd;
|
|
|
|
double fractime;
|
2005-09-21 20:05:13 +00:00
|
|
|
char *buff;
|
1999-10-22 06:31:39 +00:00
|
|
|
|
1999-12-21 17:21:22 +00:00
|
|
|
tempstmp = pntohl(&reftime[0]);
|
|
|
|
tempfrac = pntohl(&reftime[4]);
|
1999-10-22 06:31:39 +00:00
|
|
|
if ((tempstmp == 0) && (tempfrac == 0)) {
|
2005-09-21 20:05:13 +00:00
|
|
|
return "NULL";
|
|
|
|
}
|
|
|
|
|
|
|
|
temptime = tempstmp - (guint32) NTP_BASETIME;
|
|
|
|
bd = gmtime(&temptime);
|
|
|
|
if(!bd){
|
|
|
|
return "Not representable";
|
1999-10-22 06:31:39 +00:00
|
|
|
}
|
2005-09-21 20:05:13 +00:00
|
|
|
|
|
|
|
fractime = bd->tm_sec + tempfrac / 4294967296.0;
|
|
|
|
buff=ep_alloc(NTP_TS_SIZE);
|
|
|
|
g_snprintf(buff, NTP_TS_SIZE,
|
2009-09-17 03:01:26 +00:00
|
|
|
"%s %2d, %d %02d:%02d:%09.6f UTC",
|
2005-09-21 20:05:13 +00:00
|
|
|
mon_names[bd->tm_mon],
|
|
|
|
bd->tm_mday,
|
|
|
|
bd->tm_year + 1900,
|
|
|
|
bd->tm_hour,
|
|
|
|
bd->tm_min,
|
|
|
|
fractime);
|
1999-10-22 06:31:39 +00:00
|
|
|
return buff;
|
|
|
|
}
|
2002-08-28 21:04:11 +00:00
|
|
|
|
1999-10-25 01:55:45 +00:00
|
|
|
/* dissect_ntp - dissects NTP packet data
|
2001-01-06 09:42:10 +00:00
|
|
|
* tvb - tvbuff for packet data (IN)
|
|
|
|
* pinfo - packet info
|
1999-10-25 01:55:45 +00:00
|
|
|
* proto_tree - resolved protocol tree
|
|
|
|
*/
|
2000-04-08 07:07:42 +00:00
|
|
|
static void
|
2001-01-06 09:42:10 +00:00
|
|
|
dissect_ntp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
1999-10-14 05:10:33 +00:00
|
|
|
{
|
2003-11-12 20:44:36 +00:00
|
|
|
proto_tree *ntp_tree;
|
|
|
|
proto_item *ti;
|
2001-01-06 09:42:10 +00:00
|
|
|
guint8 flags;
|
2003-11-12 20:44:36 +00:00
|
|
|
void (*dissector)(tvbuff_t *, proto_item *, guint8);
|
|
|
|
|
2009-08-09 06:26:46 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "NTP");
|
2003-11-12 20:44:36 +00:00
|
|
|
|
2009-08-09 07:36:13 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2003-11-12 20:44:36 +00:00
|
|
|
|
|
|
|
flags = tvb_get_guint8(tvb, 0);
|
|
|
|
switch (flags & NTP_MODE_MASK) {
|
|
|
|
default:
|
|
|
|
dissector = dissect_ntp_std;
|
|
|
|
break;
|
|
|
|
case NTP_MODE_CTRL:
|
|
|
|
dissector = dissect_ntp_ctrl;
|
|
|
|
break;
|
|
|
|
case NTP_MODE_PRIV:
|
|
|
|
dissector = dissect_ntp_priv;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2009-11-25 21:47:28 +00:00
|
|
|
col_add_str(pinfo->cinfo, COL_INFO,
|
|
|
|
val_to_str(flags & NTP_MODE_MASK, info_mode_types, "Unknown"));
|
2003-11-12 20:44:36 +00:00
|
|
|
|
|
|
|
if (tree) {
|
|
|
|
/* Adding NTP item and subtree */
|
|
|
|
ti = proto_tree_add_item(tree, proto_ntp, tvb, 0, -1, FALSE);
|
|
|
|
ntp_tree = proto_item_add_subtree(ti, ett_ntp);
|
|
|
|
|
|
|
|
(*dissector)(tvb, ntp_tree, flags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dissect_ntp_std(tvbuff_t *tvb, proto_tree *ntp_tree, guint8 flags)
|
|
|
|
{
|
|
|
|
proto_tree *flags_tree;
|
|
|
|
proto_item *tf;
|
2001-01-06 09:42:10 +00:00
|
|
|
guint8 stratum;
|
|
|
|
guint8 ppoll;
|
|
|
|
gint8 precision;
|
|
|
|
double rootdelay;
|
|
|
|
double rootdispersion;
|
2001-03-13 21:34:28 +00:00
|
|
|
const guint8 *refid;
|
2002-04-02 01:32:46 +00:00
|
|
|
guint32 refid_addr;
|
2001-03-13 21:34:28 +00:00
|
|
|
const guint8 *reftime;
|
|
|
|
const guint8 *org;
|
|
|
|
const guint8 *rec;
|
|
|
|
const guint8 *xmt;
|
2005-09-21 20:05:13 +00:00
|
|
|
gchar *buff;
|
2001-01-06 09:42:10 +00:00
|
|
|
int i;
|
2003-11-12 20:44:36 +00:00
|
|
|
int macofs;
|
|
|
|
gint maclen;
|
|
|
|
|
|
|
|
tf = proto_tree_add_uint(ntp_tree, hf_ntp_flags, tvb, 0, 1, flags);
|
|
|
|
|
|
|
|
/* Adding flag subtree and items */
|
|
|
|
flags_tree = proto_item_add_subtree(tf, ett_ntp_flags);
|
|
|
|
proto_tree_add_uint(flags_tree, hf_ntp_flags_li, tvb, 0, 1, flags);
|
|
|
|
proto_tree_add_uint(flags_tree, hf_ntp_flags_vn, tvb, 0, 1, flags);
|
|
|
|
proto_tree_add_uint(flags_tree, hf_ntp_flags_mode, tvb, 0, 1, flags);
|
|
|
|
|
|
|
|
/* Stratum, 1byte field represents distance from primary source
|
|
|
|
*/
|
|
|
|
stratum = tvb_get_guint8(tvb, 1);
|
|
|
|
if (stratum == 0) {
|
2005-09-21 20:05:13 +00:00
|
|
|
buff="Peer Clock Stratum: unspecified or unavailable (%u)";
|
2003-11-12 20:44:36 +00:00
|
|
|
} else if (stratum == 1) {
|
2005-09-21 20:05:13 +00:00
|
|
|
buff="Peer Clock Stratum: primary reference (%u)";
|
2003-11-12 20:44:36 +00:00
|
|
|
} else if ((stratum >= 2) && (stratum <= 15)) {
|
2005-09-21 20:05:13 +00:00
|
|
|
buff="Peer Clock Stratum: secondary reference (%u)";
|
2003-11-12 20:44:36 +00:00
|
|
|
} else {
|
2005-09-21 20:05:13 +00:00
|
|
|
buff="Peer Clock Stratum: reserved: %u";
|
2003-11-12 20:44:36 +00:00
|
|
|
}
|
|
|
|
proto_tree_add_uint_format(ntp_tree, hf_ntp_stratum, tvb, 1, 1,
|
|
|
|
stratum, buff, stratum);
|
|
|
|
/* Poll interval, 1byte field indicating the maximum interval
|
|
|
|
* between successive messages, in seconds to the nearest
|
|
|
|
* power of two.
|
|
|
|
*/
|
|
|
|
ppoll = tvb_get_guint8(tvb, 2);
|
|
|
|
proto_tree_add_uint_format(ntp_tree, hf_ntp_ppoll, tvb, 2, 1,
|
|
|
|
ppoll,
|
2009-04-02 03:55:37 +00:00
|
|
|
(((ppoll >= 4) && (ppoll <= 17)) ?
|
2003-11-12 20:44:36 +00:00
|
|
|
"Peer Polling Interval: %u (%u sec)" :
|
|
|
|
"Peer Polling Interval: invalid (%u)"),
|
|
|
|
ppoll,
|
|
|
|
1 << ppoll);
|
|
|
|
|
|
|
|
/* Precision, 1byte field indicating the precision of the
|
|
|
|
* local clock, in seconds to the nearest power of two.
|
|
|
|
*/
|
|
|
|
precision = tvb_get_guint8(tvb, 3);
|
|
|
|
proto_tree_add_int_format(ntp_tree, hf_ntp_precision, tvb, 3, 1,
|
|
|
|
precision,
|
|
|
|
"Peer Clock Precision: %8.6f sec",
|
|
|
|
pow(2, precision));
|
|
|
|
|
|
|
|
/* Root Delay is a 32-bit signed fixed-point number indicating
|
|
|
|
* the total roundtrip delay to the primary reference source,
|
|
|
|
* in seconds with fraction point between bits 15 and 16.
|
|
|
|
*/
|
|
|
|
rootdelay = ((gint16)tvb_get_ntohs(tvb, 4)) +
|
|
|
|
(tvb_get_ntohs(tvb, 6) / 65536.0);
|
|
|
|
proto_tree_add_double_format(ntp_tree, hf_ntp_rootdelay, tvb, 4, 4,
|
|
|
|
rootdelay,
|
|
|
|
"Root Delay: %9.4f sec",
|
|
|
|
rootdelay);
|
|
|
|
|
|
|
|
/* Root Dispersion, 32-bit unsigned fixed-point number indicating
|
|
|
|
* the nominal error relative to the primary reference source, in
|
|
|
|
* seconds with fraction point between bits 15 and 16.
|
|
|
|
*/
|
|
|
|
rootdispersion = ((gint16)tvb_get_ntohs(tvb, 8)) +
|
|
|
|
(tvb_get_ntohs(tvb, 10) / 65536.0);
|
|
|
|
proto_tree_add_double_format(ntp_tree, hf_ntp_rootdispersion, tvb, 8, 4,
|
|
|
|
rootdispersion,
|
2006-10-26 14:36:09 +00:00
|
|
|
"Root Dispersion: %9.4f sec",
|
2003-11-12 20:44:36 +00:00
|
|
|
rootdispersion);
|
|
|
|
|
|
|
|
/* Now, there is a problem with secondary servers. Standards
|
|
|
|
* asks from stratum-2 - stratum-15 servers to set this to the
|
|
|
|
* low order 32 bits of the latest transmit timestamp of the
|
|
|
|
* reference source.
|
|
|
|
* But, all V3 and V4 servers set this to IP adress of their
|
|
|
|
* higher level server. My decision was to resolve this address.
|
|
|
|
*/
|
|
|
|
refid = tvb_get_ptr(tvb, 12, 4);
|
2006-08-23 15:51:15 +00:00
|
|
|
buff = ep_alloc(NTP_TS_SIZE);
|
2003-11-12 20:44:36 +00:00
|
|
|
if (stratum <= 1) {
|
2006-08-23 15:51:15 +00:00
|
|
|
g_snprintf (buff, NTP_TS_SIZE, "Unidentified reference source '%.4s'",
|
2006-01-16 07:59:44 +00:00
|
|
|
refid);
|
2003-11-12 20:44:36 +00:00
|
|
|
for (i = 0; primary_sources[i].id; i++) {
|
2006-01-16 07:59:44 +00:00
|
|
|
if (memcmp (refid, primary_sources[i].id, 4) == 0) {
|
|
|
|
g_snprintf(buff, NTP_TS_SIZE, "%s",
|
|
|
|
primary_sources[i].data);
|
2003-11-12 20:44:36 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2006-01-16 07:59:44 +00:00
|
|
|
int buffpos;
|
2005-09-11 21:25:37 +00:00
|
|
|
refid_addr = tvb_get_ipv4(tvb, 12);
|
2006-07-07 04:01:09 +00:00
|
|
|
buffpos = g_snprintf(buff, NTP_TS_SIZE, "%s", get_hostname (refid_addr));
|
2006-01-16 07:59:44 +00:00
|
|
|
if (buffpos >= NTP_TS_SIZE) {
|
2005-09-21 20:05:13 +00:00
|
|
|
buff[NTP_TS_SIZE-4]='.';
|
|
|
|
buff[NTP_TS_SIZE-3]='.';
|
|
|
|
buff[NTP_TS_SIZE-2]='.';
|
|
|
|
buff[NTP_TS_SIZE-1]=0;
|
|
|
|
}
|
2003-11-12 20:44:36 +00:00
|
|
|
}
|
|
|
|
proto_tree_add_bytes_format(ntp_tree, hf_ntp_refid, tvb, 12, 4,
|
2008-12-19 17:39:52 +00:00
|
|
|
refid,
|
2003-11-12 20:44:36 +00:00
|
|
|
"Reference Clock ID: %s", buff);
|
|
|
|
|
|
|
|
/* Reference Timestamp: This is the time at which the local clock was
|
|
|
|
* last set or corrected.
|
|
|
|
*/
|
|
|
|
reftime = tvb_get_ptr(tvb, 16, 8);
|
|
|
|
proto_tree_add_bytes_format(ntp_tree, hf_ntp_reftime, tvb, 16, 8,
|
2008-12-19 17:39:52 +00:00
|
|
|
reftime,
|
2003-11-12 20:44:36 +00:00
|
|
|
"Reference Clock Update Time: %s",
|
2005-09-21 20:05:13 +00:00
|
|
|
ntp_fmt_ts(reftime));
|
2003-11-12 20:44:36 +00:00
|
|
|
|
|
|
|
/* Originate Timestamp: This is the time at which the request departed
|
|
|
|
* the client for the server.
|
|
|
|
*/
|
|
|
|
org = tvb_get_ptr(tvb, 24, 8);
|
|
|
|
proto_tree_add_bytes_format(ntp_tree, hf_ntp_org, tvb, 24, 8,
|
2008-12-19 17:39:52 +00:00
|
|
|
org,
|
2003-11-12 20:44:36 +00:00
|
|
|
"Originate Time Stamp: %s",
|
2005-09-21 20:05:13 +00:00
|
|
|
ntp_fmt_ts(org));
|
2003-11-12 20:44:36 +00:00
|
|
|
|
|
|
|
/* Receive Timestamp: This is the time at which the request arrived at
|
|
|
|
* the server.
|
|
|
|
*/
|
|
|
|
rec = tvb_get_ptr(tvb, 32, 8);
|
|
|
|
proto_tree_add_bytes_format(ntp_tree, hf_ntp_rec, tvb, 32, 8,
|
2008-12-19 17:39:52 +00:00
|
|
|
rec,
|
2003-11-12 20:44:36 +00:00
|
|
|
"Receive Time Stamp: %s",
|
2005-09-21 20:05:13 +00:00
|
|
|
ntp_fmt_ts(rec));
|
2003-11-12 20:44:36 +00:00
|
|
|
|
|
|
|
/* Transmit Timestamp: This is the time at which the reply departed the
|
|
|
|
* server for the client.
|
|
|
|
*/
|
|
|
|
xmt = tvb_get_ptr(tvb, 40, 8);
|
|
|
|
proto_tree_add_bytes_format(ntp_tree, hf_ntp_xmt, tvb, 40, 8,
|
2008-12-19 17:39:52 +00:00
|
|
|
xmt,
|
2003-11-12 20:44:36 +00:00
|
|
|
"Transmit Time Stamp: %s",
|
2005-09-21 20:05:13 +00:00
|
|
|
ntp_fmt_ts(xmt));
|
2003-11-12 20:44:36 +00:00
|
|
|
|
|
|
|
/* MAX_MAC_LEN is the largest message authentication code
|
|
|
|
* (MAC) length. If we have more data left in the packet
|
|
|
|
* after the header than that, the extra data is NTP4
|
|
|
|
* extensions; parse them as such.
|
|
|
|
*/
|
|
|
|
macofs = 48;
|
|
|
|
while (tvb_reported_length_remaining(tvb, macofs) > (gint)MAX_MAC_LEN)
|
|
|
|
macofs = dissect_ntp_ext(tvb, ntp_tree, macofs);
|
|
|
|
|
|
|
|
/* When the NTP authentication scheme is implemented, the
|
|
|
|
* Key Identifier and Message Digest fields contain the
|
|
|
|
* message authentication code (MAC) information defined in
|
|
|
|
* Appendix C of RFC-1305. Will print this as hex code for now.
|
|
|
|
*/
|
|
|
|
if (tvb_reported_length_remaining(tvb, macofs) >= 4)
|
|
|
|
proto_tree_add_item(ntp_tree, hf_ntp_keyid, tvb, macofs, 4,
|
|
|
|
FALSE);
|
|
|
|
macofs += 4;
|
|
|
|
maclen = tvb_reported_length_remaining(tvb, macofs);
|
|
|
|
if (maclen > 0)
|
|
|
|
proto_tree_add_item(ntp_tree, hf_ntp_mac, tvb, macofs,
|
|
|
|
maclen, FALSE);
|
|
|
|
}
|
1999-10-14 05:10:33 +00:00
|
|
|
|
2003-11-12 20:44:36 +00:00
|
|
|
static int
|
|
|
|
dissect_ntp_ext(tvbuff_t *tvb, proto_tree *ntp_tree, int offset)
|
|
|
|
{
|
|
|
|
proto_tree *ext_tree, *flags_tree;
|
|
|
|
proto_item *tf;
|
|
|
|
guint16 extlen;
|
|
|
|
int endoffset;
|
|
|
|
guint8 flags;
|
|
|
|
guint32 vallen, vallen_round, siglen;
|
|
|
|
|
|
|
|
extlen = tvb_get_ntohs(tvb, offset+2);
|
|
|
|
if (extlen < 8) {
|
|
|
|
/* Extension length isn't enough for the extension header.
|
|
|
|
* Report the error, and return an offset that goes to
|
|
|
|
* the end of the tvbuff, so we stop dissecting.
|
|
|
|
*/
|
|
|
|
proto_tree_add_text(ntp_tree, tvb, offset+2, 2,
|
|
|
|
"Extension length %u < 8", extlen);
|
|
|
|
offset += tvb_length_remaining(tvb, offset);
|
|
|
|
return offset;
|
|
|
|
}
|
2003-11-18 19:28:24 +00:00
|
|
|
if (extlen % 4) {
|
|
|
|
/* Extension length isn't a multiple of 4.
|
|
|
|
* Report the error, and return an offset that goes
|
|
|
|
* to the end of the tvbuff, so we stop dissecting.
|
2003-11-12 20:44:36 +00:00
|
|
|
*/
|
|
|
|
proto_tree_add_text(ntp_tree, tvb, offset+2, 2,
|
2003-11-18 19:28:24 +00:00
|
|
|
"Extension length %u isn't a multiple of 4",
|
2003-11-12 20:44:36 +00:00
|
|
|
extlen);
|
|
|
|
offset += tvb_length_remaining(tvb, offset);
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
endoffset = offset + extlen;
|
|
|
|
|
|
|
|
tf = proto_tree_add_item(ntp_tree, hf_ntp_ext, tvb, offset, extlen,
|
|
|
|
FALSE);
|
|
|
|
ext_tree = proto_item_add_subtree(tf, ett_ntp_ext);
|
|
|
|
|
|
|
|
flags = tvb_get_guint8(tvb, offset);
|
|
|
|
tf = proto_tree_add_uint(ext_tree, hf_ntp_ext_flags, tvb, offset, 1,
|
|
|
|
flags);
|
|
|
|
flags_tree = proto_item_add_subtree(tf, ett_ntp_ext_flags);
|
|
|
|
proto_tree_add_uint(flags_tree, hf_ntp_ext_flags_r, tvb, offset, 1,
|
|
|
|
flags);
|
|
|
|
proto_tree_add_uint(flags_tree, hf_ntp_ext_flags_error, tvb, offset, 1,
|
|
|
|
flags);
|
|
|
|
proto_tree_add_uint(flags_tree, hf_ntp_ext_flags_vn, tvb, offset, 1,
|
|
|
|
flags);
|
|
|
|
offset++;
|
|
|
|
|
|
|
|
proto_tree_add_item(ext_tree, hf_ntp_ext_op, tvb, offset, 1, FALSE);
|
|
|
|
offset++;
|
|
|
|
|
|
|
|
proto_tree_add_uint(ext_tree, hf_ntp_ext_len, tvb, offset, 2, extlen);
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
if ((flags & NTP_EXT_VN_MASK) != 2) {
|
|
|
|
/* don't care about autokey v1 */
|
|
|
|
return endoffset;
|
|
|
|
}
|
2001-01-06 09:42:10 +00:00
|
|
|
|
2003-11-12 20:44:36 +00:00
|
|
|
proto_tree_add_item(ext_tree, hf_ntp_ext_associd, tvb, offset, 4,
|
|
|
|
FALSE);
|
|
|
|
offset += 4;
|
1999-10-14 05:10:33 +00:00
|
|
|
|
2003-11-18 19:28:24 +00:00
|
|
|
/* check whether everything up to "vallen" is present */
|
2003-11-12 20:44:36 +00:00
|
|
|
if (extlen < MAX_MAC_LEN) {
|
|
|
|
/* XXX - report as error? */
|
|
|
|
return endoffset;
|
|
|
|
}
|
1999-10-22 06:31:39 +00:00
|
|
|
|
2003-11-12 20:44:36 +00:00
|
|
|
proto_tree_add_item(ext_tree, hf_ntp_ext_tstamp, tvb, offset, 4,
|
|
|
|
FALSE);
|
|
|
|
offset += 4;
|
|
|
|
proto_tree_add_item(ext_tree, hf_ntp_ext_fstamp, tvb, offset, 4,
|
|
|
|
FALSE);
|
|
|
|
offset += 4;
|
|
|
|
/* XXX fstamp can be server flags */
|
|
|
|
|
|
|
|
vallen = tvb_get_ntohl(tvb, offset);
|
|
|
|
proto_tree_add_uint(ext_tree, hf_ntp_ext_vallen, tvb, offset, 4,
|
|
|
|
vallen);
|
2003-11-18 19:28:24 +00:00
|
|
|
offset += 4;
|
2003-11-12 20:44:36 +00:00
|
|
|
vallen_round = (vallen + 3) & (-4);
|
|
|
|
if (vallen != 0) {
|
|
|
|
if ((guint32)(endoffset - offset) < vallen_round) {
|
|
|
|
/*
|
|
|
|
* Value goes past the length of the extension
|
|
|
|
* field.
|
|
|
|
*/
|
|
|
|
proto_tree_add_text(ext_tree, tvb, offset,
|
|
|
|
endoffset - offset,
|
|
|
|
"Value length makes value go past the end of the extension field");
|
|
|
|
return endoffset;
|
1999-10-22 06:31:39 +00:00
|
|
|
}
|
2003-11-12 20:44:36 +00:00
|
|
|
proto_tree_add_item(ext_tree, hf_ntp_ext_val, tvb, offset,
|
|
|
|
vallen, FALSE);
|
|
|
|
}
|
|
|
|
offset += vallen_round;
|
|
|
|
|
|
|
|
siglen = tvb_get_ntohl(tvb, offset);
|
|
|
|
proto_tree_add_uint(ext_tree, hf_ntp_ext_siglen, tvb, offset, 4,
|
|
|
|
siglen);
|
|
|
|
offset += 4;
|
|
|
|
if (siglen != 0) {
|
|
|
|
if (offset + (int)siglen > endoffset) {
|
|
|
|
/*
|
|
|
|
* Value goes past the length of the extension
|
|
|
|
* field.
|
|
|
|
*/
|
|
|
|
proto_tree_add_text(ext_tree, tvb, offset,
|
|
|
|
endoffset - offset,
|
|
|
|
"Signature length makes value go past the end of the extension field");
|
|
|
|
return endoffset;
|
2000-11-19 21:18:10 +00:00
|
|
|
}
|
2003-11-12 20:44:36 +00:00
|
|
|
proto_tree_add_item(ext_tree, hf_ntp_ext_sig, tvb,
|
|
|
|
offset, siglen, FALSE);
|
|
|
|
}
|
|
|
|
return endoffset;
|
|
|
|
}
|
2001-01-06 09:42:10 +00:00
|
|
|
|
2009-11-25 21:47:28 +00:00
|
|
|
static void
|
|
|
|
dissect_ntp_ctrl_peerstatus(tvbuff_t *tvb, proto_tree *status_tree, guint16 offset, guint16 status)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* dissect peer status word:
|
|
|
|
* 1
|
|
|
|
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* | Status | Sel | Count | Code |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
*/
|
|
|
|
proto_tree_add_uint(status_tree, hf_ntpctrl_peer_status_b0, tvb, offset, 2, status);
|
|
|
|
proto_tree_add_uint(status_tree, hf_ntpctrl_peer_status_b1, tvb, offset, 2, status);
|
|
|
|
proto_tree_add_uint(status_tree, hf_ntpctrl_peer_status_b2, tvb, offset, 2, status);
|
|
|
|
proto_tree_add_uint(status_tree, hf_ntpctrl_peer_status_b3, tvb, offset, 2, status);
|
|
|
|
proto_tree_add_uint(status_tree, hf_ntpctrl_peer_status_b4, tvb, offset, 2, status);
|
|
|
|
proto_tree_add_uint(status_tree, hf_ntpctrl_peer_status_selection, tvb, offset, 2, status);
|
|
|
|
proto_tree_add_uint(status_tree, hf_ntpctrl_peer_status_count, tvb, offset, 2, status);
|
|
|
|
proto_tree_add_uint(status_tree, hf_ntpctrl_peer_status_code, tvb, offset, 2, status);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dissect_ntp_ctrl_systemstatus(tvbuff_t *tvb, proto_tree *status_tree, guint16 offset, guint16 status)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* dissect system status word:
|
|
|
|
* 1
|
|
|
|
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* |LI | ClkSource | Count | Code |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
*/
|
|
|
|
proto_tree_add_uint(status_tree, hf_ntpctrl_sys_status_li, tvb, offset, 2, status);
|
|
|
|
proto_tree_add_uint(status_tree, hf_ntpctrl_sys_status_clksrc, tvb, offset, 2, status);
|
|
|
|
proto_tree_add_uint(status_tree, hf_ntpctrl_sys_status_count, tvb, offset, 2, status);
|
|
|
|
proto_tree_add_uint(status_tree, hf_ntpctrl_sys_status_code, tvb, offset, 2, status);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dissect_ntp_ctrl_errorstatus(tvbuff_t *tvb, proto_tree *status_tree, guint16 offset, guint16 status)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* if error bit is set: dissect error status word
|
|
|
|
* 1
|
|
|
|
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* | Error Code | reserved |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
*/
|
|
|
|
proto_tree_add_uint(status_tree, hf_ntpctrl_error_status_word, tvb, offset, 2, status);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dissect_ntp_ctrl_clockstatus(tvbuff_t *tvb, proto_tree *status_tree, guint16 offset, guint16 status)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* dissect clock status word:
|
|
|
|
* 1
|
|
|
|
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* | Clock Status | Event Code |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
*/
|
|
|
|
proto_tree_add_uint(status_tree, hf_ntpctrl_clk_status, tvb, offset, 2, status);
|
|
|
|
proto_tree_add_uint(status_tree, hf_ntpctrl_clk_status_code, tvb, offset, 2, status);
|
|
|
|
}
|
|
|
|
|
2003-11-12 20:44:36 +00:00
|
|
|
static void
|
|
|
|
dissect_ntp_ctrl(tvbuff_t *tvb, proto_tree *ntp_tree, guint8 flags)
|
|
|
|
{
|
2009-11-25 21:47:28 +00:00
|
|
|
proto_tree *flags_tree;
|
|
|
|
proto_item *tf;
|
2003-11-12 20:44:36 +00:00
|
|
|
guint8 flags2;
|
2009-11-25 21:47:28 +00:00
|
|
|
|
|
|
|
proto_tree *status_tree, *data_tree, *item_tree;
|
|
|
|
proto_item *ts, *td, *ti;
|
|
|
|
guint16 status;
|
|
|
|
guint16 associd;
|
|
|
|
guint16 datalen;
|
|
|
|
guint16 data_offset;
|
|
|
|
|
|
|
|
tvbparse_t *tt;
|
|
|
|
tvbparse_elem_t *element;
|
2003-11-12 20:44:36 +00:00
|
|
|
|
|
|
|
tf = proto_tree_add_uint(ntp_tree, hf_ntp_flags, tvb, 0, 1, flags);
|
|
|
|
|
|
|
|
/* Adding flag subtree and items */
|
|
|
|
flags_tree = proto_item_add_subtree(tf, ett_ntp_flags);
|
|
|
|
proto_tree_add_uint(flags_tree, hf_ntp_flags_li, tvb, 0, 1, flags);
|
|
|
|
proto_tree_add_uint(flags_tree, hf_ntp_flags_vn, tvb, 0, 1, flags);
|
|
|
|
proto_tree_add_uint(flags_tree, hf_ntp_flags_mode, tvb, 0, 1, flags);
|
|
|
|
|
|
|
|
flags2 = tvb_get_guint8(tvb, 1);
|
2009-11-25 21:47:28 +00:00
|
|
|
tf = proto_tree_add_uint(ntp_tree, hf_ntpctrl_flags2, tvb, 1, 1, flags2);
|
2003-11-12 20:44:36 +00:00
|
|
|
flags_tree = proto_item_add_subtree(tf, ett_ntpctrl_flags2);
|
2009-11-25 21:47:28 +00:00
|
|
|
proto_tree_add_uint(flags_tree, hf_ntpctrl_flags2_r, tvb, 1, 1, flags2);
|
|
|
|
proto_tree_add_uint(flags_tree, hf_ntpctrl_flags2_error, tvb, 1, 1, flags2);
|
|
|
|
proto_tree_add_uint(flags_tree, hf_ntpctrl_flags2_more, tvb, 1, 1, flags2);
|
|
|
|
proto_tree_add_uint(flags_tree, hf_ntpctrl_flags2_opcode, tvb, 1, 1, flags2);
|
|
|
|
|
|
|
|
proto_tree_add_uint(ntp_tree, hf_ntpctrl_sequence, tvb, 2, 2, tvb_get_ntohs(tvb, 2));
|
|
|
|
|
|
|
|
status = tvb_get_ntohs(tvb, 4);
|
|
|
|
associd = tvb_get_ntohs(tvb, 6);
|
|
|
|
ts = proto_tree_add_uint(ntp_tree, hf_ntpctrl_status, tvb, 4, 2, status);
|
|
|
|
status_tree = proto_item_add_subtree(ts, ett_ntpctrl_status);
|
|
|
|
/*
|
|
|
|
* further processing of status is only necessary in server responses
|
|
|
|
*/
|
|
|
|
if (flags2 & NTPCTRL_R_MASK) {
|
|
|
|
if (flags2 & NTPCTRL_ERROR_MASK) {
|
|
|
|
/* Check if this is an error response... */
|
|
|
|
dissect_ntp_ctrl_errorstatus(tvb, status_tree, 4, status);
|
|
|
|
} else {
|
|
|
|
/* ...otherwise status word depends on OpCode */
|
|
|
|
switch (flags2 & NTPCTRL_OP_MASK) {
|
|
|
|
case NTPCTRL_OP_READSTAT:
|
|
|
|
case NTPCTRL_OP_READVAR:
|
|
|
|
case NTPCTRL_OP_WRITEVAR:
|
|
|
|
case NTPCTRL_OP_ASYNCMSG:
|
|
|
|
if (associd)
|
|
|
|
dissect_ntp_ctrl_peerstatus(tvb, status_tree, 4, status);
|
|
|
|
else
|
|
|
|
dissect_ntp_ctrl_systemstatus(tvb, status_tree, 4, status);
|
|
|
|
break;
|
|
|
|
case NTPCTRL_OP_READCLOCK:
|
|
|
|
case NTPCTRL_OP_WRITECLOCK:
|
|
|
|
dissect_ntp_ctrl_clockstatus(tvb, status_tree, 4, status);
|
|
|
|
break;
|
|
|
|
case NTPCTRL_OP_SETTRAP:
|
|
|
|
case NTPCTRL_OP_UNSETTRAP:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
proto_tree_add_uint(ntp_tree, hf_ntpctrl_associd, tvb, 6, 2, associd);
|
|
|
|
proto_tree_add_uint(ntp_tree, hf_ntpctrl_offset, tvb, 8, 2, tvb_get_ntohs(tvb, 8));
|
|
|
|
datalen = tvb_get_ntohs(tvb, 10);
|
|
|
|
proto_tree_add_uint(ntp_tree, hf_ntpctrl_count, tvb, 10, 2, datalen);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* dissect Data part of the NTP control message
|
|
|
|
*/
|
|
|
|
if (datalen) {
|
|
|
|
data_offset = 12;
|
|
|
|
td = proto_tree_add_item(ntp_tree, hf_ntpctrl_data, tvb, data_offset, datalen, TRUE);
|
|
|
|
data_tree = proto_item_add_subtree(td, ett_ntpctrl_data);
|
|
|
|
switch(flags2 & NTPCTRL_OP_MASK) {
|
|
|
|
case NTPCTRL_OP_READSTAT:
|
|
|
|
if (!associd) {
|
|
|
|
/*
|
|
|
|
* if associd == 0 then data part contains a list of the form
|
|
|
|
* <association identifier><status word>,
|
|
|
|
*/
|
|
|
|
while(datalen) {
|
|
|
|
ti = proto_tree_add_item(data_tree, hf_ntpctrl_item, tvb, data_offset, 4, TRUE);
|
|
|
|
item_tree = proto_item_add_subtree(ti, ett_ntpctrl_item);
|
|
|
|
proto_tree_add_uint(item_tree, hf_ntpctrl_associd, tvb, data_offset, 2, tvb_get_ntohs(tvb, data_offset));
|
|
|
|
data_offset += 2;
|
|
|
|
status = tvb_get_ntohs(tvb, data_offset);
|
|
|
|
ts = proto_tree_add_uint(item_tree, hf_ntpctrl_status, tvb, data_offset, 2, status);
|
|
|
|
status_tree = proto_item_add_subtree(ts, ett_ntpctrl_status);
|
|
|
|
dissect_ntp_ctrl_peerstatus( tvb, status_tree, 4, status );
|
|
|
|
data_offset += 2;
|
|
|
|
datalen -= 4;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* but if associd != 0,
|
|
|
|
* then data part could be the same as if opcode is NTPCTRL_OP_READVAR
|
|
|
|
* --> so, no "break" here!
|
|
|
|
*/
|
|
|
|
case NTPCTRL_OP_READVAR:
|
|
|
|
case NTPCTRL_OP_WRITEVAR:
|
|
|
|
case NTPCTRL_OP_READCLOCK:
|
|
|
|
case NTPCTRL_OP_WRITECLOCK:
|
|
|
|
tt = tvbparse_init(tvb, data_offset, datalen, NULL, want_ignore);
|
2009-11-25 22:30:41 +00:00
|
|
|
while( (element = tvbparse_get(tt, want)) != NULL ) {
|
2009-11-25 21:47:28 +00:00
|
|
|
tvbparse_tree_add_elem(data_tree, element);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NTPCTRL_OP_ASYNCMSG:
|
|
|
|
proto_tree_add_item(data_tree, hf_ntpctrl_trapmsg, tvb, data_offset, datalen, TRUE);
|
|
|
|
break;
|
|
|
|
/* these opcodes doesn't carry any data: NTPCTRL_OP_SETTRAP, NTPCTRL_OP_UNSETTRAP, NTPCTRL_OP_UNSPEC */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize tvb-parser, which is used to dissect data part of NTP control
|
|
|
|
* messages
|
|
|
|
*
|
|
|
|
* Here some constants are defined, which describes character groups used for
|
|
|
|
* various purposes. These groups are then used to configure the two global
|
|
|
|
* variables "want_ignore" and "want" that we use for dissection
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
init_parser(void)
|
|
|
|
{
|
|
|
|
/* specify what counts as character */
|
|
|
|
tvbparse_wanted_t* want_identifier = tvbparse_chars(-1, 1, 0,
|
|
|
|
"abcdefghijklmnopqrstuvwxyz-_ABCDEFGHIJKLMNOPQRSTUVWXYZ.0123456789", NULL, NULL, NULL);
|
|
|
|
/* this is the equal sign used in assignments */
|
|
|
|
tvbparse_wanted_t* want_equalsign = tvbparse_chars(-1, 1, 0, "=", NULL, NULL, NULL);
|
|
|
|
/* possible characters allowed for values */
|
|
|
|
tvbparse_wanted_t* want_value = tvbparse_set_oneof(0, NULL, NULL, NULL,
|
|
|
|
tvbparse_quoted(-1, NULL, NULL, tvbparse_shrink_token_cb, '\"', '\\'),
|
|
|
|
tvbparse_quoted(-1, NULL, NULL, tvbparse_shrink_token_cb, '\'', '\\'),
|
|
|
|
tvbparse_chars(-1, 1, 0, "abcdefghijklmnopqrstuvwxyz-_ABCDEFGHIJKLMNOPQRSTUVWXYZ.0123456789 ", NULL, NULL, NULL),
|
|
|
|
NULL);
|
|
|
|
/* the following specifies an assignment of the form identifier=value */
|
|
|
|
tvbparse_wanted_t* want_assignment = tvbparse_set_seq(-1, NULL, NULL, NULL,
|
|
|
|
want_identifier,
|
|
|
|
want_equalsign,
|
|
|
|
want_value,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
/* we ignore white space characters */
|
|
|
|
want_ignore = tvbparse_chars(-1, 1, 0, ", \t\r\n", NULL, NULL, NULL);
|
|
|
|
/* data part of control messages consists of either identifiers or assignments */
|
|
|
|
want = tvbparse_set_oneof(-1, NULL, NULL, NULL,
|
|
|
|
want_assignment,
|
|
|
|
want_identifier,
|
|
|
|
NULL);
|
2003-11-12 20:44:36 +00:00
|
|
|
}
|
1999-10-22 06:31:39 +00:00
|
|
|
|
2003-11-12 20:44:36 +00:00
|
|
|
static void
|
|
|
|
dissect_ntp_priv(tvbuff_t *tvb, proto_tree *ntp_tree, guint8 flags)
|
|
|
|
{
|
|
|
|
proto_tree *flags_tree;
|
|
|
|
proto_item *tf;
|
|
|
|
guint8 auth_seq, impl, reqcode;
|
|
|
|
|
|
|
|
tf = proto_tree_add_uint(ntp_tree, hf_ntp_flags, tvb, 0, 1, flags);
|
|
|
|
|
|
|
|
/* Adding flag subtree and items */
|
|
|
|
flags_tree = proto_item_add_subtree(tf, ett_ntp_flags);
|
|
|
|
proto_tree_add_uint(flags_tree, hf_ntppriv_flags_r, tvb, 0, 1, flags);
|
|
|
|
proto_tree_add_uint(flags_tree, hf_ntppriv_flags_more, tvb, 0, 1,
|
|
|
|
flags);
|
|
|
|
proto_tree_add_uint(flags_tree, hf_ntp_flags_vn, tvb, 0, 1, flags);
|
|
|
|
proto_tree_add_uint(flags_tree, hf_ntp_flags_mode, tvb, 0, 1, flags);
|
|
|
|
|
|
|
|
auth_seq = tvb_get_guint8(tvb, 1);
|
|
|
|
tf = proto_tree_add_uint(ntp_tree, hf_ntppriv_auth_seq, tvb, 1, 1,
|
|
|
|
auth_seq);
|
|
|
|
flags_tree = proto_item_add_subtree(tf, ett_ntppriv_auth_seq);
|
|
|
|
proto_tree_add_uint(flags_tree, hf_ntppriv_auth, tvb, 1, 1, auth_seq);
|
|
|
|
proto_tree_add_uint(flags_tree, hf_ntppriv_seq, tvb, 1, 1, auth_seq);
|
|
|
|
|
|
|
|
impl = tvb_get_guint8(tvb, 2);
|
|
|
|
proto_tree_add_uint(ntp_tree, hf_ntppriv_impl, tvb, 2, 1, impl);
|
|
|
|
|
|
|
|
reqcode = tvb_get_guint8(tvb, 3);
|
|
|
|
proto_tree_add_uint(ntp_tree, hf_ntppriv_reqcode, tvb, 3, 1, reqcode);
|
1999-10-14 05:10:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_ntp(void)
|
|
|
|
{
|
|
|
|
static hf_register_info hf[] = {
|
2002-08-28 21:04:11 +00:00
|
|
|
{ &hf_ntp_flags, {
|
|
|
|
"Flags", "ntp.flags", FT_UINT8, BASE_HEX,
|
2001-06-18 02:18:27 +00:00
|
|
|
NULL, 0, "Flags (Leap/Version/Mode)", HFILL }},
|
2001-01-06 09:42:10 +00:00
|
|
|
{ &hf_ntp_flags_li, {
|
|
|
|
"Leap Indicator", "ntp.flags.li", FT_UINT8, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
VALS(li_types), NTP_LI_MASK, NULL, HFILL }},
|
2001-01-06 09:42:10 +00:00
|
|
|
{ &hf_ntp_flags_vn, {
|
|
|
|
"Version number", "ntp.flags.vn", FT_UINT8, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
VALS(ver_nums), NTP_VN_MASK, NULL, HFILL }},
|
2001-01-06 09:42:10 +00:00
|
|
|
{ &hf_ntp_flags_mode, {
|
2001-01-07 01:47:37 +00:00
|
|
|
"Mode", "ntp.flags.mode", FT_UINT8, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
VALS(mode_types), NTP_MODE_MASK, NULL, HFILL }},
|
2002-08-28 21:04:11 +00:00
|
|
|
{ &hf_ntp_stratum, {
|
2001-01-06 09:42:10 +00:00
|
|
|
"Peer Clock Stratum", "ntp.stratum", FT_UINT8, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, 0, NULL, HFILL }},
|
2002-08-28 21:04:11 +00:00
|
|
|
{ &hf_ntp_ppoll, {
|
|
|
|
"Peer Polling Interval", "ntp.ppoll", FT_UINT8, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, 0, NULL, HFILL }},
|
2002-08-28 21:04:11 +00:00
|
|
|
{ &hf_ntp_precision, {
|
2003-07-08 01:52:19 +00:00
|
|
|
"Peer Clock Precision", "ntp.precision", FT_INT8, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, 0, NULL, HFILL }},
|
2002-08-28 21:04:11 +00:00
|
|
|
{ &hf_ntp_rootdelay, {
|
2009-07-07 09:02:59 +00:00
|
|
|
"Root Delay", "ntp.rootdelay", FT_DOUBLE, BASE_NONE,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, 0, NULL, HFILL }},
|
2002-08-28 21:04:11 +00:00
|
|
|
{ &hf_ntp_rootdispersion, {
|
2009-07-07 09:02:59 +00:00
|
|
|
"Root Dispersion", "ntp.rootdispersion", FT_DOUBLE, BASE_NONE,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, 0, NULL, HFILL }},
|
2002-08-28 21:04:11 +00:00
|
|
|
{ &hf_ntp_refid, {
|
|
|
|
"Reference Clock ID", "ntp.refid", FT_BYTES, BASE_NONE,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, 0, NULL, HFILL }},
|
2002-08-28 21:04:11 +00:00
|
|
|
{ &hf_ntp_reftime, {
|
|
|
|
"Reference Clock Update Time", "ntp.reftime", FT_BYTES, BASE_NONE,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, 0, NULL, HFILL }},
|
2002-08-28 21:04:11 +00:00
|
|
|
{ &hf_ntp_org, {
|
|
|
|
"Originate Time Stamp", "ntp.org", FT_BYTES, BASE_NONE,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, 0, NULL, HFILL }},
|
2002-08-28 21:04:11 +00:00
|
|
|
{ &hf_ntp_rec, {
|
|
|
|
"Receive Time Stamp", "ntp.rec", FT_BYTES, BASE_NONE,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, 0, NULL, HFILL }},
|
2002-08-28 21:04:11 +00:00
|
|
|
{ &hf_ntp_xmt, {
|
|
|
|
"Transmit Time Stamp", "ntp.xmt", FT_BYTES, BASE_NONE,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, 0, NULL, HFILL }},
|
2002-08-28 21:04:11 +00:00
|
|
|
{ &hf_ntp_keyid, {
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
"Key ID", "ntp.keyid", FT_BYTES, BASE_NONE,
|
|
|
|
NULL, 0, NULL, HFILL }},
|
2002-08-28 21:04:11 +00:00
|
|
|
{ &hf_ntp_mac, {
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
"Message Authentication Code", "ntp.mac", FT_BYTES, BASE_NONE,
|
|
|
|
NULL, 0, NULL, HFILL }},
|
2003-11-12 20:44:36 +00:00
|
|
|
|
|
|
|
{ &hf_ntp_ext, {
|
|
|
|
"Extension", "ntp.ext", FT_NONE, BASE_NONE,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, 0, NULL, HFILL }},
|
2003-11-12 20:44:36 +00:00
|
|
|
{ &hf_ntp_ext_flags, {
|
|
|
|
"Flags", "ntp.ext.flags", FT_UINT8, BASE_HEX,
|
|
|
|
NULL, 0, "Flags (Response/Error/Version)", HFILL }},
|
|
|
|
{ &hf_ntp_ext_flags_r, {
|
|
|
|
"Response bit", "ntp.ext.flags.r", FT_UINT8, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
VALS(ext_r_types), NTP_EXT_R_MASK, NULL, HFILL }},
|
2003-11-12 20:44:36 +00:00
|
|
|
{ &hf_ntp_ext_flags_error, {
|
|
|
|
"Error bit", "ntp.ext.flags.error", FT_UINT8, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, NTP_EXT_ERROR_MASK, NULL, HFILL }},
|
2003-11-12 20:44:36 +00:00
|
|
|
{ &hf_ntp_ext_flags_vn, {
|
|
|
|
"Version", "ntp.ext.flags.vn", FT_UINT8, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, NTP_EXT_VN_MASK, NULL, HFILL }},
|
2003-11-12 20:44:36 +00:00
|
|
|
{ &hf_ntp_ext_op, {
|
|
|
|
"Opcode", "ntp.ext.op", FT_UINT8, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
VALS(ext_op_types), 0, NULL, HFILL }},
|
2003-11-12 20:44:36 +00:00
|
|
|
{ &hf_ntp_ext_len, {
|
|
|
|
"Extension length", "ntp.ext.len", FT_UINT16, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, 0, NULL, HFILL }},
|
2003-11-12 20:44:36 +00:00
|
|
|
{ &hf_ntp_ext_associd, {
|
|
|
|
"Association ID", "ntp.ext.associd", FT_UINT32, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, 0, NULL, HFILL }},
|
2003-11-12 20:44:36 +00:00
|
|
|
{ &hf_ntp_ext_tstamp, {
|
|
|
|
"Timestamp", "ntp.ext.tstamp", FT_UINT32, BASE_HEX,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, 0, NULL, HFILL }},
|
2003-11-12 20:44:36 +00:00
|
|
|
{ &hf_ntp_ext_fstamp, {
|
|
|
|
"File Timestamp", "ntp.ext.fstamp", FT_UINT32, BASE_HEX,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, 0, NULL, HFILL }},
|
2003-11-12 20:44:36 +00:00
|
|
|
{ &hf_ntp_ext_vallen, {
|
|
|
|
"Value length", "ntp.ext.vallen", FT_UINT32, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, 0, NULL, HFILL }},
|
2003-11-12 20:44:36 +00:00
|
|
|
{ &hf_ntp_ext_val, {
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
"Value", "ntp.ext.val", FT_BYTES, BASE_NONE,
|
|
|
|
NULL, 0, NULL, HFILL }},
|
2003-11-12 20:44:36 +00:00
|
|
|
{ &hf_ntp_ext_siglen, {
|
|
|
|
"Signature length", "ntp.ext.siglen", FT_UINT32, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, 0, NULL, HFILL }},
|
2003-11-12 20:44:36 +00:00
|
|
|
{ &hf_ntp_ext_sig, {
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
"Signature", "ntp.ext.sig", FT_BYTES, BASE_NONE,
|
|
|
|
NULL, 0, NULL, HFILL }},
|
2003-11-12 20:44:36 +00:00
|
|
|
|
|
|
|
{ &hf_ntpctrl_flags2, {
|
|
|
|
"Flags 2", "ntpctrl.flags2", FT_UINT8, BASE_HEX,
|
|
|
|
NULL, 0, "Flags (Response/Error/More/Opcode)", HFILL }},
|
|
|
|
{ &hf_ntpctrl_flags2_r, {
|
|
|
|
"Response bit", "ntpctrl.flags2.r", FT_UINT8, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
VALS(ctrl_r_types), NTPCTRL_R_MASK, NULL, HFILL }},
|
2003-11-12 20:44:36 +00:00
|
|
|
{ &hf_ntpctrl_flags2_error, {
|
|
|
|
"Error bit", "ntpctrl.flags2.error", FT_UINT8, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, NTPCTRL_ERROR_MASK, NULL, HFILL }},
|
2003-11-12 20:44:36 +00:00
|
|
|
{ &hf_ntpctrl_flags2_more, {
|
|
|
|
"More bit", "ntpctrl.flags2.more", FT_UINT8, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, NTPCTRL_MORE_MASK, NULL, HFILL }},
|
2003-11-12 20:44:36 +00:00
|
|
|
{ &hf_ntpctrl_flags2_opcode, {
|
|
|
|
"Opcode", "ntpctrl.flags2.opcode", FT_UINT8, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
VALS(ctrl_op_types), NTPCTRL_OP_MASK, NULL, HFILL }},
|
2009-11-25 21:47:28 +00:00
|
|
|
{ &hf_ntpctrl_sequence, {
|
|
|
|
"Sequence", "ntpctrl.sequence", FT_UINT16, BASE_DEC,
|
|
|
|
NULL, 0, NULL, HFILL }},
|
|
|
|
{ &hf_ntpctrl_status, {
|
|
|
|
"Status", "ntpctrl.status", FT_UINT16, BASE_DEC,
|
|
|
|
NULL, 0, NULL, HFILL }},
|
|
|
|
{ &hf_ntpctrl_error_status_word, {
|
|
|
|
"Error Status Word", "ntpctrl.err_status", FT_UINT16, BASE_DEC,
|
|
|
|
VALS(ctrl_err_status_types), NTP_CTRL_ERRSTATUS_CODE_MASK, NULL, HFILL }},
|
|
|
|
{ &hf_ntpctrl_sys_status_li, {
|
|
|
|
"Leap Indicator", "ntpctrl.sys_status.li", FT_UINT16, BASE_DEC,
|
|
|
|
VALS(li_types), NTPCTRL_SYSSTATUS_LI_MASK, NULL, HFILL }},
|
|
|
|
{ &hf_ntpctrl_sys_status_clksrc, {
|
|
|
|
"Clock Source", "ntpctrl.sys_status.clksrc", FT_UINT16, BASE_DEC,
|
|
|
|
VALS(ctrl_sys_status_clksource_types), NTPCTRL_SYSSTATUS_CLK_MASK, NULL, HFILL }},
|
|
|
|
{ &hf_ntpctrl_sys_status_count, {
|
|
|
|
"System Event Counter", "ntpctrl.sys_status.count", FT_UINT16, BASE_DEC,
|
|
|
|
NULL, NTPCTRL_SYSSTATUS_COUNT_MASK, NULL, HFILL }},
|
|
|
|
{ &hf_ntpctrl_sys_status_code, {
|
|
|
|
"System Event Code", "ntpctrl.sys_status.code", FT_UINT16, BASE_DEC,
|
|
|
|
VALS(ctrl_sys_status_event_types), NTPCTRL_SYSSTATUS_CODE_MASK, NULL, HFILL }},
|
|
|
|
{ &hf_ntpctrl_peer_status_b0, {
|
|
|
|
"Peer Status", "ntpctrl.peer_status.config", FT_UINT16, BASE_DEC,
|
|
|
|
VALS(ctrl_peer_status_config_types), NTPCTRL_PEERSTATUS_CONFIG_MASK, NULL, HFILL }},
|
|
|
|
{ &hf_ntpctrl_peer_status_b1, {
|
|
|
|
"Peer Status", "ntpctrl.peer_status.authenable", FT_UINT16, BASE_DEC,
|
|
|
|
VALS(ctrl_peer_status_authenable_types), NTPCTRL_PEERSTATUS_AUTHENABLE_MASK, NULL, HFILL }},
|
|
|
|
{ &hf_ntpctrl_peer_status_b2, {
|
|
|
|
"Peer Status", "ntpctrl.peer_status.authentic", FT_UINT16, BASE_DEC,
|
|
|
|
VALS(ctrl_peer_status_authentic_types), NTPCTRL_PEERSTATUS_AUTHENTIC_MASK, NULL, HFILL }},
|
|
|
|
{ &hf_ntpctrl_peer_status_b3, {
|
|
|
|
"Peer Status", "ntpctrl.peer_status.reach", FT_UINT16, BASE_DEC,
|
|
|
|
VALS(ctrl_peer_status_reach_types), NTPCTRL_PEERSTATUS_REACH_MASK, NULL, HFILL }},
|
|
|
|
{ &hf_ntpctrl_peer_status_b4, {
|
|
|
|
"Peer Status: reserved", "", FT_UINT16, BASE_DEC,
|
|
|
|
NULL, NTPCTRL_PEERSTATUS_RESERVED_MASK, NULL, HFILL }},
|
|
|
|
{ &hf_ntpctrl_peer_status_selection, {
|
|
|
|
"Peer Selection", "ntpctrl.peer_status.selection", FT_UINT16, BASE_DEC,
|
|
|
|
VALS(ctrl_peer_status_selection_types), NTPCTRL_PEERSTATUS_SEL_MASK, NULL, HFILL }},
|
|
|
|
{ &hf_ntpctrl_peer_status_count, {
|
|
|
|
"Peer Event Counter", "ntpctrl.peer_status.count", FT_UINT16, BASE_DEC,
|
|
|
|
NULL, NTPCTRL_PEERSTATUS_COUNT_MASK, NULL, HFILL }},
|
|
|
|
{ &hf_ntpctrl_peer_status_code, {
|
|
|
|
"Peer Event Code", "ntpctrl.peer_status.code", FT_UINT16, BASE_DEC,
|
|
|
|
VALS(ctrl_peer_status_event_types), NTPCTRL_PEERSTATUS_CODE_MASK, NULL, HFILL }},
|
|
|
|
{ &hf_ntpctrl_clk_status, {
|
|
|
|
"Clock Status", "ntpctrl.clock_status.status", FT_UINT16, BASE_DEC,
|
|
|
|
VALS(ctrl_clk_status_types), NTPCTRL_CLKSTATUS_STATUS_MASK, NULL, HFILL }},
|
|
|
|
{ &hf_ntpctrl_clk_status_code, {
|
|
|
|
"Clock Event Code", "ntpctrl.clock_status.code", FT_UINT16, BASE_DEC,
|
|
|
|
NULL, NTPCTRL_CLKSTATUS_CODE_MASK, NULL, HFILL }},
|
|
|
|
{ &hf_ntpctrl_data, {
|
|
|
|
"Data", "ntpctrl.data", FT_NONE, BASE_NONE,
|
|
|
|
NULL, 0, NULL, HFILL }},
|
|
|
|
{ &hf_ntpctrl_item, {
|
|
|
|
"Item", "ntpctrl.item", FT_NONE, BASE_NONE,
|
|
|
|
NULL, 0, NULL, HFILL }},
|
|
|
|
{ &hf_ntpctrl_associd, {
|
|
|
|
"AssociationID", "ntpctrl.associd", FT_UINT16, BASE_DEC,
|
|
|
|
NULL, 0, NULL, HFILL }},
|
|
|
|
{ &hf_ntpctrl_offset, {
|
|
|
|
"Offset", "ntpctrl.offset", FT_UINT16, BASE_DEC,
|
|
|
|
NULL, 0, NULL, HFILL }},
|
|
|
|
{ &hf_ntpctrl_count, {
|
|
|
|
"Count", "ntpctrl.count", FT_UINT16, BASE_DEC,
|
|
|
|
NULL, 0, NULL, HFILL }},
|
|
|
|
{ &hf_ntpctrl_trapmsg, {
|
|
|
|
"Trap message", "ntpctrl.trapmsg", FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0, NULL, HFILL }},
|
|
|
|
|
2003-11-12 20:44:36 +00:00
|
|
|
{ &hf_ntppriv_flags_r, {
|
|
|
|
"Response bit", "ntppriv.flags.r", FT_UINT8, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
VALS(priv_r_types), NTPPRIV_R_MASK, NULL, HFILL }},
|
2003-11-12 20:44:36 +00:00
|
|
|
{ &hf_ntppriv_flags_more, {
|
|
|
|
"More bit", "ntppriv.flags.more", FT_UINT8, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, NTPPRIV_MORE_MASK, NULL, HFILL }},
|
2003-11-12 20:44:36 +00:00
|
|
|
{ &hf_ntppriv_auth_seq, {
|
|
|
|
"Auth, sequence", "ntppriv.auth_seq", FT_UINT8, BASE_DEC,
|
|
|
|
NULL, 0, "Auth bit, sequence number", HFILL }},
|
|
|
|
{ &hf_ntppriv_auth, {
|
|
|
|
"Auth bit", "ntppriv.auth", FT_UINT8, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, NTPPRIV_AUTH_MASK, NULL, HFILL }},
|
2003-11-12 20:44:36 +00:00
|
|
|
{ &hf_ntppriv_seq, {
|
|
|
|
"Sequence number", "ntppriv.seq", FT_UINT8, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, NTPPRIV_SEQ_MASK, NULL, HFILL }},
|
2003-11-12 20:44:36 +00:00
|
|
|
{ &hf_ntppriv_impl, {
|
|
|
|
"Implementation", "ntppriv.impl", FT_UINT8, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
VALS(priv_impl_types), 0, NULL, HFILL }},
|
2003-11-12 20:44:36 +00:00
|
|
|
{ &hf_ntppriv_reqcode, {
|
|
|
|
"Request code", "ntppriv.reqcode", FT_UINT8, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
VALS(priv_rc_types), 0, NULL, HFILL }}
|
1999-10-14 05:10:33 +00:00
|
|
|
};
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_ntp,
|
|
|
|
&ett_ntp_flags,
|
2003-11-12 20:44:36 +00:00
|
|
|
&ett_ntp_ext,
|
|
|
|
&ett_ntp_ext_flags,
|
|
|
|
&ett_ntpctrl_flags2,
|
2009-11-25 21:47:28 +00:00
|
|
|
&ett_ntpctrl_status,
|
|
|
|
&ett_ntpctrl_data,
|
|
|
|
&ett_ntpctrl_item,
|
2007-01-05 13:42:08 +00:00
|
|
|
&ett_ntppriv_auth_seq
|
1999-11-16 11:44:20 +00:00
|
|
|
};
|
1999-10-14 05:10:33 +00:00
|
|
|
|
2001-01-06 09:42:10 +00:00
|
|
|
proto_ntp = proto_register_protocol("Network Time Protocol", "NTP",
|
|
|
|
"ntp");
|
1999-10-14 05:10:33 +00:00
|
|
|
proto_register_field_array(proto_ntp, hf, array_length(hf));
|
1999-11-16 11:44:20 +00:00
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
2009-11-25 21:47:28 +00:00
|
|
|
|
|
|
|
init_parser();
|
1999-10-14 05:10:33 +00:00
|
|
|
}
|
2000-04-08 07:07:42 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_ntp(void)
|
|
|
|
{
|
2001-12-03 04:00:26 +00:00
|
|
|
dissector_handle_t ntp_handle;
|
|
|
|
|
|
|
|
ntp_handle = create_dissector_handle(dissect_ntp, proto_ntp);
|
|
|
|
dissector_add("udp.port", UDP_PORT_NTP, ntp_handle);
|
|
|
|
dissector_add("tcp.port", TCP_PORT_NTP, ntp_handle);
|
2000-04-08 07:07:42 +00:00
|
|
|
}
|