SIP: Add a preference to hide the generated/trace Call ID

Change-Id: Id936dfaa5278ce9f3bb62281497268fb4054fc56
Reviewed-on: https://code.wireshark.org/review/32579
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Anders Broman 2019-03-26 15:55:06 +01:00 committed by Anders Broman
parent d5f431b1ec
commit aa39ca68ae
5 changed files with 38 additions and 2 deletions

View File

@ -54,6 +54,9 @@ void proto_reg_handoff_megaco(void);
#define PORT_MEGACO_TXT 2944
#define PORT_MEGACO_BIN 2945
static pref_t *sip_hide_generatd_call_ids;
/* Define the megaco proto */
static int proto_megaco = -1;
@ -3030,6 +3033,11 @@ dissect_megaco_LocalRemotedescriptor(tvbuff_t *tvb, proto_tree *megaco_mediadesc
if ((context != 0) && (context < 0xfffffffe)) {
setup_info.hf_id = hf_megaco_Context;
setup_info.hf_type = SDP_TRACE_ID_HF_TYPE_GUINT32;
if (!sip_hide_generatd_call_ids) {
setup_info.add_hidden = FALSE;
} else {
setup_info.add_hidden = prefs_get_bool_value(sip_hide_generatd_call_ids, pref_current);
}
setup_info.trace_id.num = context;
message_info.data = &setup_info;
}
@ -3888,7 +3896,8 @@ proto_reg_handoff_megaco(void)
{
static gboolean megaco_prefs_initialized = FALSE;
static dissector_handle_t megaco_text_tcp_handle;
/*
/*
* Variables to allow for proper deletion of dissector registration when
* the user changes port from the gui.
*/
@ -3925,6 +3934,8 @@ proto_reg_handoff_megaco(void)
exported_pdu_tap = find_tap_id(EXPORT_PDU_TAP_NAME_LAYER_7);
sip_hide_generatd_call_ids = prefs_find_preference(prefs_find_module("sip"), "hide_generatd_call_id");
}
/*

View File

@ -2587,9 +2587,15 @@ show_setup_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (stored_setup_info->hf_type == SDP_TRACE_ID_HF_TYPE_STR) {
item = proto_tree_add_string(rtp_setup_tree, stored_setup_info->hf_id, tvb, 0, 0, stored_setup_info->trace_id.str);
PROTO_ITEM_SET_GENERATED(item);
if (stored_setup_info->add_hidden == TRUE) {
PROTO_ITEM_SET_HIDDEN(item);
}
} else if (stored_setup_info->hf_type == SDP_TRACE_ID_HF_TYPE_GUINT32) {
item = proto_tree_add_uint(rtp_setup_tree, stored_setup_info->hf_id, tvb, 0, 0, stored_setup_info->trace_id.num);
PROTO_ITEM_SET_GENERATED(item);
if (stored_setup_info->add_hidden == TRUE) {
PROTO_ITEM_SET_HIDDEN(item);
}
}
}
}

View File

@ -2837,9 +2837,15 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
if (stored_setup_info->hf_type == SDP_TRACE_ID_HF_TYPE_STR) {
item = proto_tree_add_string(sdp_tree, stored_setup_info->hf_id, tvb, 0, 0, stored_setup_info->trace_id.str);
PROTO_ITEM_SET_GENERATED(item);
if (stored_setup_info->add_hidden == TRUE) {
PROTO_ITEM_SET_HIDDEN(item);
}
} else if (stored_setup_info->hf_type == SDP_TRACE_ID_HF_TYPE_GUINT32) {
item = proto_tree_add_uint(sdp_tree, stored_setup_info->hf_id, tvb, 0, 0, stored_setup_info->trace_id.num);
PROTO_ITEM_SET_GENERATED(item);
if (stored_setup_info->add_hidden == TRUE) {
PROTO_ITEM_SET_HIDDEN(item);
}
}
}
}

View File

@ -44,6 +44,7 @@ typedef struct _sdp_conv_info {
typedef struct _sdp_setup_info {
int hf_id; /* Header field to use */
enum sdp_trace_id_hf_type hf_type; /* Indicates which of the following variables to use( add guint32 etc as needed)*/
gboolean add_hidden;
union {
gchar *str; /* The trace id if the hf_type is str */
guint32 num; /* Numerical trace id */

View File

@ -900,6 +900,9 @@ static gboolean sip_retrans_the_same_sport = TRUE;
/* whether we hold off tracking RTP conversations until an SDP answer is received */
static gboolean sip_delay_sdp_changes = FALSE;
/* Hide the generated Call IDs or not */
static gboolean sip_hide_generatd_call_ids = FALSE;
/* Extension header subdissectors */
static dissector_table_t ext_hdr_subdissector_table;
@ -4113,6 +4116,9 @@ dissect_sip_common(tvbuff_t *tvb, int offset, int remaining_length, packet_info
offset, next_offset - offset,
value);
PROTO_ITEM_SET_GENERATED(gen_item);
if (sip_hide_generatd_call_ids) {
PROTO_ITEM_SET_HIDDEN(gen_item);
}
sip_proto_set_format_text(hdr_tree, sip_element_item, tvb, offset, linelen);
}
break;
@ -4677,6 +4683,7 @@ dissect_sip_common(tvbuff_t *tvb, int offset, int remaining_length, packet_info
sdp_setup_info_t setup_info;
setup_info.hf_id = hf_sip_call_id_gen;
setup_info.add_hidden = sip_hide_generatd_call_ids;
setup_info.hf_type = SDP_TRACE_ID_HF_TYPE_STR;
setup_info.trace_id.str = wmem_strdup(wmem_file_scope(), call_id);
message_info.data = &setup_info;
@ -7215,7 +7222,7 @@ void proto_register_sip(void)
NULL, HFILL }
},
{ &hf_sip_call_id_gen,
{ "Call-ID", "sip.call_id_generated",
{ "Generated Call-ID", "sip.call_id_generated",
FT_STRING, BASE_NONE,NULL,0x0,
"Use to catch call id across protocols", HFILL }
},
@ -7400,6 +7407,11 @@ void proto_register_sip(void)
"prevents tracking media in early-media call scenarios",
&sip_delay_sdp_changes);
prefs_register_bool_preference(sip_module, "hide_generatd_call_id",
"Hide the generated Call Id",
"Whether the generated call id should be hiddden(not displayed) in the tree or not.",
&sip_hide_generatd_call_ids);
/* UAT */
sip_custom_headers_uat = uat_new("Custom SIP Header Fields",
sizeof(header_field_t),