Remove manual setting of pinfo->current_proto.

Calling a protocol dissection function will properly set/restore pinfo->current_proto, so there's no need to duplicate it.

Change-Id: Ic2ec0b35fa4d46a98f3410bf238056425076e4a9
Reviewed-on: https://code.wireshark.org/review/12205
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Michael Mann 2015-11-26 08:25:32 -05:00
parent e2d5089cb9
commit 10261d1202
11 changed files with 28 additions and 50 deletions

View File

@ -854,9 +854,6 @@ dissect_atmarp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _
const gchar *tha_str, *tsa_str, *tpa_str;
proto_tree *tl_tree;
/* Override the setting to "ARP/RARP". */
pinfo->current_proto = "ATMARP";
ar_hrd = tvb_get_ntohs(tvb, ATM_AR_HRD);
ar_pro = tvb_get_ntohs(tvb, ATM_AR_PRO);
ar_shtl = tvb_get_guint8(tvb, ATM_AR_SHTL);
@ -1960,16 +1957,20 @@ proto_register_arp(void)
module_t *arp_module;
expert_module_t* expert_arp;
int proto_atmarp;
proto_arp = proto_register_protocol("Address Resolution Protocol",
"ARP/RARP", "arp");
proto_atmarp = proto_register_protocol("ATM Address Resolution Protocol",
"ATMARP", "atmarp");
proto_register_field_array(proto_arp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
expert_arp = expert_register_protocol(proto_arp);
expert_register_field_array(expert_arp, ei, array_length(ei));
atmarp_handle = new_create_dissector_handle(dissect_atmarp, proto_arp);
atmarp_handle = new_create_dissector_handle(dissect_atmarp, proto_atmarp);
ax25arp_handle = new_create_dissector_handle(dissect_ax25arp, proto_arp);
arp_handle = new_register_dissector( "arp" , dissect_arp, proto_arp );

View File

@ -72,6 +72,7 @@ static int hf_ddp_src_socket = -1;
static int hf_ddp_type = -1;
static dissector_handle_t ddp_handle;
static dissector_handle_t ddp_short_handle;
/* --------------------------------------
* ATP protocol parameters
@ -1414,9 +1415,15 @@ dissect_ddp_zip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
return tvb_captured_length(tvb);
}
static void
dissect_ddp_short(tvbuff_t *tvb, packet_info *pinfo, guint8 dnode,
guint8 snode, proto_tree *tree)
typedef struct ddp_nodes
{
guint8 dnode;
guint8 snode;
} ddp_nodes_t;
static int
dissect_ddp_short(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
guint16 len;
guint8 dport;
@ -1427,6 +1434,7 @@ dissect_ddp_short(tvbuff_t *tvb, packet_info *pinfo, guint8 dnode,
struct atalk_ddp_addr *src = wmem_new0(pinfo->pool, struct atalk_ddp_addr),
*dst = wmem_new0(pinfo->pool, struct atalk_ddp_addr);
tvbuff_t *new_tvb;
ddp_nodes_t *ddp_node = (ddp_nodes_t*)data;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DDP");
col_clear(pinfo->cinfo, COL_INFO);
@ -1448,9 +1456,9 @@ dissect_ddp_short(tvbuff_t *tvb, packet_info *pinfo, guint8 dnode,
type = tvb_get_guint8(tvb, 4);
src->net = 0;
src->node = snode;
src->node = ddp_node->snode;
dst->net = 0;
dst->node = dnode;
dst->node = ddp_node->dnode;
set_address(&pinfo->net_src, atalk_address_type, sizeof(struct atalk_ddp_addr), src);
copy_address_shallow(&pinfo->src, &pinfo->net_src);
set_address(&pinfo->net_dst, atalk_address_type, sizeof(struct atalk_ddp_addr), dst);
@ -1477,6 +1485,8 @@ dissect_ddp_short(tvbuff_t *tvb, packet_info *pinfo, guint8 dnode,
if (!dissector_try_uint(ddp_dissector_table, type, new_tvb, pinfo, tree))
call_dissector(data_handle,new_tvb, pinfo, tree);
return tvb_captured_length(tvb);
}
static int
@ -1578,8 +1588,7 @@ capture_llap(packet_counts *ld)
static int
dissect_llap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
guint8 dnode;
guint8 snode;
ddp_nodes_t ddp_node;
guint8 type;
proto_tree *llap_tree;
proto_item *ti;
@ -1591,11 +1600,11 @@ dissect_llap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
ti = proto_tree_add_item(tree, proto_llap, tvb, 0, 3, ENC_NA);
llap_tree = proto_item_add_subtree(ti, ett_llap);
dnode = tvb_get_guint8(tvb, 0);
proto_tree_add_uint(llap_tree, hf_llap_dst, tvb, 0, 1, dnode);
ddp_node.dnode = tvb_get_guint8(tvb, 0);
proto_tree_add_uint(llap_tree, hf_llap_dst, tvb, 0, 1, ddp_node.dnode);
snode = tvb_get_guint8(tvb, 1);
proto_tree_add_uint(llap_tree, hf_llap_src, tvb, 1, 1, snode);
ddp_node.snode = tvb_get_guint8(tvb, 1);
proto_tree_add_uint(llap_tree, hf_llap_src, tvb, 1, 1, ddp_node.snode);
type = tvb_get_guint8(tvb, 2);
col_add_str(pinfo->cinfo, COL_INFO,
@ -1606,11 +1615,8 @@ dissect_llap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
switch (type) {
case 0x01:
if (proto_is_protocol_enabled(find_protocol_by_id(proto_ddp))) {
pinfo->current_proto = "DDP";
dissect_ddp_short(new_tvb, pinfo, dnode, snode, tree);
if (call_dissector_with_data(ddp_short_handle, new_tvb, pinfo, tree, &ddp_node))
return tvb_captured_length(tvb);
}
break;
case 0x02:
if (call_dissector(ddp_handle, new_tvb, pinfo, tree))
@ -2086,6 +2092,7 @@ proto_reg_handoff_atalk(void)
dissector_handle_t zip_ddp_handle;
dissector_handle_t rtmp_data_handle, llap_handle;
ddp_short_handle = new_create_dissector_handle(dissect_ddp_short, proto_ddp);
ddp_handle = new_create_dissector_handle(dissect_ddp, proto_ddp);
dissector_add_uint("ethertype", ETHERTYPE_ATALK, ddp_handle);
dissector_add_uint("chdlc.protocol", ETHERTYPE_ATALK, ddp_handle);

View File

@ -247,9 +247,6 @@ static const value_string role_vals[] = {
static const char initial_sep[] = " (";
static const char cont_sep[] = ", ";
static void
dissect_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_bpdu_pvst);
static void
dissect_bpdu_pvst_tlv(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb) {
gboolean pvst_tlv_origvlan_present = FALSE;
@ -401,9 +398,6 @@ dissect_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_bp
call_dissector(gvrp_handle, tvb, pinfo, tree);
return;
}
pinfo->current_proto = "GARP";
col_set_str(pinfo->cinfo, COL_PROTOCOL, "GARP");
/* Generic Attribute Registration Protocol */

View File

@ -54,8 +54,6 @@ dissect_clip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
{
proto_item *fh_item;
pinfo->current_proto = "CLIP";
/* load the top pane info. This should be overwritten by
the next protocol in the stack */
col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "N/A");
@ -123,7 +121,7 @@ proto_reg_handoff_clip(void)
*/
ip_handle = find_dissector("ip");
clip_handle = new_create_dissector_handle(dissect_clip, -1);
clip_handle = new_create_dissector_handle(dissect_clip, proto_clip);
/* XXX - no protocol, can't be disabled */
dissector_add_uint("wtap_encap", WTAP_ENCAP_LINUX_ATM_CLIP, clip_handle);
}

View File

@ -38,7 +38,6 @@ void proto_register_dcp_etsi(void);
void proto_reg_handoff_dcp_etsi(void);
static int dissect_af (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data);
static int dissect_pft (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data);
static int dissect_tpl(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data);
static dissector_table_t dcp_dissector_table;
static dissector_table_t af_dissector_table;
@ -192,8 +191,6 @@ dissect_dcp_etsi (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void *
if(word != 0x4146 && word != 0x5046)
return FALSE;
pinfo->current_proto = "DCP (ETSI)";
/* Clear out stuff in the info column */
col_clear(pinfo->cinfo, COL_INFO);
col_set_str (pinfo->cinfo, COL_PROTOCOL, "DCP (ETSI)");
@ -454,7 +451,6 @@ dissect_pft(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _
gboolean fec = FALSE;
guint16 rsk=0, rsz=0;
pinfo->current_proto = "DCP-PFT";
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DCP-PFT");
ti = proto_tree_add_item (tree, proto_pft, tvb, 0, -1, ENC_NA);
@ -546,7 +542,6 @@ dissect_af (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _
guint32 payload_len;
tvbuff_t *next_tvb = NULL;
pinfo->current_proto = "DCP-AF";
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DCP-AF");
ti = proto_tree_add_item (tree, proto_af, tvb, 0, -1, ENC_NA);
@ -614,7 +609,6 @@ dissect_tpl(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _
proto_item *ti;
guint16 maj, min;
pinfo->current_proto = "DCP-TPL";
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DCP-TPL");
ti = proto_tree_add_item (tree, proto_tpl, tvb, 0, -1, ENC_NA);

View File

@ -972,7 +972,6 @@ dissect_wlan_radio (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void
}
/* dissect the 802.11 packet next */
pinfo->current_proto = "IEEE 802.11";
return call_dissector_with_data(ieee80211_handle, tvb, pinfo, tree, data);
}

View File

@ -929,8 +929,6 @@ dissect_nsip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
bi.pinfo = pinfo;
bi.parent_tree = tree;
pinfo->current_proto = "GPRS-NS";
if (!nsip_is_recursive) {
col_set_str(pinfo->cinfo, COL_PROTOCOL, "GPRS-NS");
col_clear(pinfo->cinfo, COL_INFO);

View File

@ -478,8 +478,6 @@ static int dissect_osi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
guint8 nlpid;
tvbuff_t *new_tvb;
pinfo->current_proto = "OSI";
nlpid = tvb_get_guint8(tvb, 0);
/*

View File

@ -2108,12 +2108,6 @@ static gint dissect_ositp_internal(tvbuff_t *tvb, packet_info *pinfo,
gboolean is_cltp = FALSE;
gboolean subdissector_found = FALSE;
if (!proto_is_protocol_enabled(find_protocol_by_id(proto_cotp)))
return FALSE; /* COTP has been disabled */
/* XXX - what about CLTP? */
pinfo->current_proto = "COTP";
/* Initialize the COL_INFO field; each of the TPDUs will have its
information appended. */
col_set_str(pinfo->cinfo, COL_INFO, "");

View File

@ -175,8 +175,6 @@ dissect_pagp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
col_clear(pinfo->cinfo, COL_INFO);
pinfo->current_proto = "PAGP";
raw_octet = tvb_get_guint8(tvb, PAGP_VERSION_NUMBER);
if (tree) {
pagp_item = proto_tree_add_protocol_format(tree, proto_pagp, tvb,

View File

@ -1855,9 +1855,6 @@ static void dissect_irlap(tvbuff_t* tvb, packet_info* pinfo, proto_tree* root)
*/
static int dissect_irda(tvbuff_t* tvb, packet_info* pinfo, proto_tree* root, void* data _U_)
{
/* load the display labels */
pinfo->current_proto = "IrDA";
/* check if log message */
if ((pinfo->pseudo_header->irda.pkttype & IRDA_CLASS_MASK) == IRDA_CLASS_LOG)
{