diff options
author | Ulf Lamping <ulf.lamping@web.de> | 2006-04-14 13:32:03 +0000 |
---|---|---|
committer | Ulf Lamping <ulf.lamping@web.de> | 2006-04-14 13:32:03 +0000 |
commit | cb1f23eecc7d2f95aede5c3aabbfa90302c8ce8f (patch) | |
tree | 3f09a0c87b08c0feb9e82554efe356b473619fac | |
parent | 75f2454646048fde5bd8d1db826961eba8b8554f (diff) |
fix #865: if the timestamps fraction (m/u/nsec) of a packet is out of range (<0 or >1000000000) add a generated line to the protocol tree and a corresponding expert info entry
A special marker in the packet list would be too much effort to implement
svn path=/trunk/; revision=17865
-rw-r--r-- | epan/dissectors/packet-frame.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/epan/dissectors/packet-frame.c b/epan/dissectors/packet-frame.c index 89bb86e154..1d1f52a82e 100644 --- a/epan/dissectors/packet-frame.c +++ b/epan/dissectors/packet-frame.c @@ -41,6 +41,7 @@ int proto_frame = -1; int hf_frame_arrival_time = -1; +static int hf_frame_time_invalid = -1; static int hf_frame_time_delta = -1; static int hf_frame_time_relative = -1; int hf_frame_number = -1; @@ -191,6 +192,12 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_tree_add_time(fh_tree, hf_frame_arrival_time, tvb, 0, 0, &ts); + if(ts.nsecs < 0 || ts.nsecs >= 1000000000) { + item = proto_tree_add_none_format(fh_tree, hf_frame_time_invalid, tvb, + 0, 0, "Arrival Time: Fractional second %09ld is invalid, the valid range is 0-1000000000", (long) ts.nsecs); + PROTO_ITEM_SET_GENERATED(item); + expert_add_info_format(pinfo, item, PI_MALFORMED, PI_WARN, "Arrival Time: Fractional second out of range (0-1000000000)"); + } ts = pinfo->fd->del_ts; @@ -257,7 +264,11 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) 0, 0, color_filter->filter_text); PROTO_ITEM_SET_GENERATED(item); } - } + } else { + if(pinfo->fd->abs_ts.nsecs < 0 || pinfo->fd->abs_ts.nsecs >= 1000000000) { + expert_add_info_format(pinfo, NULL, PI_MALFORMED, PI_WARN, "Arrival Time: Fractional second out of range (0-1000000000)"); + } + } /* Portable Exception Handling to trap Ethereal specific exceptions like BoundsError exceptions */ TRY { @@ -428,6 +439,10 @@ proto_register_frame(void) { "Arrival Time", "frame.time", FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0, "Absolute time when this frame was captured", HFILL }}, + { &hf_frame_time_invalid, + { "Arrival Timestamp invalid", "frame.time_invalid", FT_NONE, BASE_NONE, NULL, 0x0, + "The timestamp from the capture is out of the valid range", HFILL }}, + { &hf_frame_time_delta, { "Time delta from previous packet", "frame.time_delta", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, |