diff options
author | Guy Harris <guy@alum.mit.edu> | 2005-03-01 06:03:08 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2005-03-01 06:03:08 +0000 |
commit | cfb9cf012974008f14038cceba0fc67b6365432f (patch) | |
tree | 6f15693985cd55785ceddab06aadbbfafe74f3e8 /epan/dissectors/packet-mip.c | |
parent | 3d5b1d5f13ffd9d8d6a486a3278107188a534b3f (diff) |
Show NTP times correctly.
svn path=/trunk/; revision=13560
Diffstat (limited to 'epan/dissectors/packet-mip.c')
-rw-r--r-- | epan/dissectors/packet-mip.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/epan/dissectors/packet-mip.c b/epan/dissectors/packet-mip.c index ce2e46bd80..9444c471b2 100644 --- a/epan/dissectors/packet-mip.c +++ b/epan/dissectors/packet-mip.c @@ -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, |