Show NTP times correctly.

svn path=/trunk/; revision=13560
This commit is contained in:
Guy Harris 2005-03-01 06:03:08 +00:00
parent 3d5b1d5f13
commit cfb9cf0129
1 changed files with 16 additions and 11 deletions

View File

@ -35,6 +35,7 @@
#include <time.h>
#include <epan/packet.h>
#include "packet-ntp.h"
/* Initialize the protocol and registered fields */
static int proto_mip = -1;
@ -69,7 +70,6 @@ static gint ett_mip_exts = -1;
/* Port used for Mobile IP */
#define UDP_PORT_MIP 434
#define NTP_BASETIME 2208988800ul
typedef enum {
REGISTRATION_REQUEST = 1,
@ -260,8 +260,9 @@ dissect_mip( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree *flags_tree;
guint8 type;
guint8 flags;
nstime_t ident_time;
size_t offset=0;
const guint8 *reftime;
gchar buff[NTP_TS_SIZE];
/* Make entries in Protocol column and Info column on summary display */
@ -316,10 +317,12 @@ dissect_mip( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_item(mip_tree, hf_mip_coa, tvb, offset, 4, FALSE);
offset += 4;
/* Identifier */
ident_time.secs = tvb_get_ntohl(tvb,16)-(guint32) NTP_BASETIME;
ident_time.nsecs = tvb_get_ntohl(tvb,20)*1000;
proto_tree_add_time(mip_tree, hf_mip_ident, tvb, offset, 8, &ident_time);
/* Identifier - assumed to be an NTP time here */
reftime = tvb_get_ptr(tvb, offset, 8);
proto_tree_add_bytes_format(mip_tree, hf_mip_ident, tvb, offset, 8,
reftime,
"Identification: %s",
ntp_fmt_ts(reftime, buff));
offset += 8;
} /* if tree */
@ -354,10 +357,12 @@ dissect_mip( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_item(mip_tree, hf_mip_haaddr, tvb, offset, 4, FALSE);
offset += 4;
/* Identifier */
ident_time.secs = tvb_get_ntohl(tvb,12)-(guint32) NTP_BASETIME;
ident_time.nsecs = tvb_get_ntohl(tvb,16)*1000;
proto_tree_add_time(mip_tree, hf_mip_ident, tvb, offset, 8, &ident_time);
/* Identifier - assumed to be an NTP time here */
reftime = tvb_get_ptr(tvb, offset, 8);
proto_tree_add_bytes_format(mip_tree, hf_mip_ident, tvb, offset, 8,
reftime,
"Identification: %s",
ntp_fmt_ts(reftime, buff));
offset += 8;
} /* if tree */
@ -450,7 +455,7 @@ void proto_register_mip(void)
},
{ &hf_mip_ident,
{ "Identification", "mip.ident",
FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0,
FT_BYTES, BASE_NONE, NULL, 0,
"MN Identification.", HFILL }
},
{ &hf_mip_ext_type,