Add preference for disabling 'packet size limited during capture' message in Info column.

Bug: 9827
Change-Id: I8fdba4827b164bd231981bfdd2e1bd0499f4f87c
Reviewed-on: https://code.wireshark.org/review/9669
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Michael Mann 2015-07-16 21:54:38 -04:00
parent b1eaf29d40
commit 6514dece0c
2 changed files with 23 additions and 1 deletions

View File

@ -105,6 +105,7 @@ static gboolean force_docsis_encap = FALSE;
static gboolean generate_md5_hash = FALSE;
static gboolean generate_epoch_time = TRUE;
static gboolean generate_bits_field = TRUE;
static gboolean disable_packet_size_limited_in_summary = FALSE;
static const value_string p2p_dirs[] = {
{ P2P_DIR_UNKNOWN, "Unknown" },
@ -910,6 +911,10 @@ proto_register_frame(void)
"Show the number of bits in the frame",
"Whether or not the number of bits in the frame should be shown.",
&generate_bits_field);
prefs_register_bool_preference(frame_module, "disable_packet_size_limited_in_summary",
"Disable 'packet size limited during capture' message in summary",
"Whether or not 'packet size limited during capture' message in shown in Info column.",
&disable_packet_size_limited_in_summary);
frame_tap=register_tap("frame");
}

View File

@ -27,6 +27,8 @@
#include <epan/packet.h>
#include <epan/exceptions.h>
#include <epan/expert.h>
#include <epan/prefs.h>
#include <epan/prefs-int.h>
#include <epan/show_exception.h>
static int proto_short = -1;
@ -89,13 +91,28 @@ show_exception(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case BoundsError:
col_append_str(pinfo->cinfo, COL_INFO, "[Packet size limited during capture]");
{
gboolean display_info = TRUE;
module_t * frame_module = prefs_find_module("frame");
if (frame_module != NULL)
{
pref_t *display_pref = prefs_find_preference(frame_module, "disable_packet_size_limited_in_summary");
if (display_pref)
{
if (*display_pref->varp.boolp)
display_info = FALSE;
}
}
if (display_info)
col_append_str(pinfo->cinfo, COL_INFO, "[Packet size limited during capture]");
proto_tree_add_protocol_format(tree, proto_short, tvb, 0, 0,
"[Packet size limited during capture: %s truncated]", pinfo->current_proto);
/* Don't record BoundsError exceptions as expert events - they merely
* reflect a capture done with a snapshot length too short to capture
* all of the packet
* (any case where it's caused by something else is a bug). */
}
break;
case FragmentBoundsError: