diff options
author | Michael Mann <mmann78@netscape.net> | 2015-11-26 08:25:32 -0500 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2015-11-27 05:00:37 +0000 |
commit | 10261d120283cb739118fa7178b4e911ed72de14 (patch) | |
tree | 034d43a2eb1757d37cf9cc1453de9b815e0ad2bc /epan/dissectors | |
parent | e2d5089cb9ad555bc0361768a5eaf24b3bd1379c (diff) |
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>
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-arp.c | 9 | ||||
-rw-r--r-- | epan/dissectors/packet-atalk.c | 37 | ||||
-rw-r--r-- | epan/dissectors/packet-bpdu.c | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-clip.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-dcp-etsi.c | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-ieee80211-radio.c | 1 | ||||
-rw-r--r-- | epan/dissectors/packet-nsip.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-osi.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-ositp.c | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-pagp.c | 2 |
10 files changed, 28 insertions, 47 deletions
diff --git a/epan/dissectors/packet-arp.c b/epan/dissectors/packet-arp.c index c55b61901d..7274cc2b57 100644 --- a/epan/dissectors/packet-arp.c +++ b/epan/dissectors/packet-arp.c @@ -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 ); diff --git a/epan/dissectors/packet-atalk.c b/epan/dissectors/packet-atalk.c index 4fe2a68f36..b838e3ea02 100644 --- a/epan/dissectors/packet-atalk.c +++ b/epan/dissectors/packet-atalk.c @@ -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); diff --git a/epan/dissectors/packet-bpdu.c b/epan/dissectors/packet-bpdu.c index 9c69eb08df..b3eb9468e5 100644 --- a/epan/dissectors/packet-bpdu.c +++ b/epan/dissectors/packet-bpdu.c @@ -248,9 +248,6 @@ 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; guint16 tlv_type, tlv_length; @@ -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 */ diff --git a/epan/dissectors/packet-clip.c b/epan/dissectors/packet-clip.c index 28e5350096..e29a86148d 100644 --- a/epan/dissectors/packet-clip.c +++ b/epan/dissectors/packet-clip.c @@ -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); } diff --git a/epan/dissectors/packet-dcp-etsi.c b/epan/dissectors/packet-dcp-etsi.c index d608a9561e..fcb44943ed 100644 --- a/epan/dissectors/packet-dcp-etsi.c +++ b/epan/dissectors/packet-dcp-etsi.c @@ -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); diff --git a/epan/dissectors/packet-ieee80211-radio.c b/epan/dissectors/packet-ieee80211-radio.c index 524a275b6f..ba8b87bd45 100644 --- a/epan/dissectors/packet-ieee80211-radio.c +++ b/epan/dissectors/packet-ieee80211-radio.c @@ -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); } diff --git a/epan/dissectors/packet-nsip.c b/epan/dissectors/packet-nsip.c index d85ad77a91..40bda18d0e 100644 --- a/epan/dissectors/packet-nsip.c +++ b/epan/dissectors/packet-nsip.c @@ -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); diff --git a/epan/dissectors/packet-osi.c b/epan/dissectors/packet-osi.c index 808014876f..29f40f2b6f 100644 --- a/epan/dissectors/packet-osi.c +++ b/epan/dissectors/packet-osi.c @@ -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); /* diff --git a/epan/dissectors/packet-ositp.c b/epan/dissectors/packet-ositp.c index 816f8b3889..7da6b4b1d1 100644 --- a/epan/dissectors/packet-ositp.c +++ b/epan/dissectors/packet-ositp.c @@ -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, ""); diff --git a/epan/dissectors/packet-pagp.c b/epan/dissectors/packet-pagp.c index 80020bb1d8..6bcda313a1 100644 --- a/epan/dissectors/packet-pagp.c +++ b/epan/dissectors/packet-pagp.c @@ -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, |