Remove more "CHECK_DISPLAY_AS_DATA()" calls and "pinfo->current_proto ="

statements.

Move the setting of the Protocol column in the Appletalk ARP and IPX
dissectors before anything is fetched from the packet, and also clear
the Info column at that point in those and some other dissectors, so
that if an exception is thrown, the columns don't reflect the previous
protocol.

Fix the registration of the IPX RIP dissector to use the right protocol
ID.

svn path=/trunk/; revision=2928
This commit is contained in:
Guy Harris 2001-01-22 00:20:29 +00:00
parent d9718a693d
commit 79e1fdb9e5
9 changed files with 36 additions and 69 deletions

View File

@ -1,7 +1,7 @@
/* packet-aarp.c
* Routines for Appletalk ARP packet disassembly
*
* $Id: packet-aarp.c,v 1.27 2001/01/09 06:31:33 guy Exp $
* $Id: packet-aarp.c,v 1.28 2001/01/22 00:20:29 guy Exp $
*
* Simon Wilkinson <sxw@dcs.ed.ac.uk>
*
@ -141,9 +141,10 @@ dissect_aarp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
guint8 *sha_val, *spa_val, *tha_val, *tpa_val;
gchar *sha_str, *spa_str, *tha_str, *tpa_str;
CHECK_DISPLAY_AS_DATA(proto_aarp, tvb, pinfo, tree);
pinfo->current_proto = "AARP";
if(check_col(pinfo->fd, COL_PROTOCOL))
col_set_str(pinfo->fd, COL_PROTOCOL, "AARP");
if(check_col(pinfo->fd, COL_INFO))
col_clear(pinfo->fd, COL_INFO);
ar_hrd = tvb_get_ntohs(tvb, AR_HRD);
ar_pro = tvb_get_ntohs(tvb, AR_PRO);
@ -168,9 +169,6 @@ dissect_aarp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
tpa_val = tvb_get_ptr(tvb, tpa_offset, ar_pln);
tpa_str = aarpproaddr_to_str(tpa_val, ar_pln, ar_pro);
if(check_col(pinfo->fd, COL_PROTOCOL))
col_set_str(pinfo->fd, COL_PROTOCOL, "AARP");
if (check_col(pinfo->fd, COL_INFO)) {
switch (ar_op) {
case AARP_REQUEST:

View File

@ -1,7 +1,7 @@
/* packet-bpdu.c
* Routines for BPDU (Spanning Tree Protocol) disassembly
*
* $Id: packet-bpdu.c,v 1.20 2001/01/14 08:25:14 guy Exp $
* $Id: packet-bpdu.c,v 1.21 2001/01/22 00:20:29 guy Exp $
*
* Copyright 1999 Christophe Tronche <ch.tronche@computer.org>
*
@ -101,8 +101,6 @@ dissect_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
proto_tree *bpdu_tree;
proto_item *ti;
CHECK_DISPLAY_AS_DATA(proto_bpdu, tvb, pinfo, tree);
/* GARP application frames require special interpretation of the
destination address field; otherwise, they will be mistaken as
BPDU frames.
@ -148,8 +146,6 @@ dissect_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
return;
}
pinfo->current_proto = "STP";
bpdu_type = tvb_get_guint8(tvb, BPDU_TYPE);
flags = tvb_get_guint8(tvb, BPDU_FLAGS);
root_identifier_bridge_priority = tvb_get_ntohs(tvb, BPDU_ROOT_IDENTIFIER);

View File

@ -2,7 +2,7 @@
* Routines for the Generic Routing Encapsulation (GRE) protocol
* Brad Robel-Forrest <brad.robel-forrest@watchguard.com>
*
* $Id: packet-gre.c,v 1.38 2001/01/13 07:47:48 guy Exp $
* $Id: packet-gre.c,v 1.39 2001/01/22 00:20:29 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -92,10 +92,6 @@ dissect_gre(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint8 sre_length;
tvbuff_t *next_tvb;
CHECK_DISPLAY_AS_DATA(proto_gre, tvb, pinfo, tree);
pinfo->current_proto = "GRE";
flags_and_ver = tvb_get_ntohs(tvb, offset);
type = tvb_get_ntohs(tvb, offset + sizeof(flags_and_ver));

View File

@ -2,7 +2,7 @@
* Routines for NetWare's IPX
* Gilbert Ramirez <gram@xiexie.org>
*
* $Id: packet-ipx.c,v 1.76 2001/01/13 07:47:48 guy Exp $
* $Id: packet-ipx.c,v 1.77 2001/01/22 00:20:29 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -291,9 +291,10 @@ dissect_ipx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint16 ipx_dsocket, ipx_ssocket;
CHECK_DISPLAY_AS_DATA(proto_ipx, tvb, pinfo, tree);
pinfo->current_proto = "IPX";
if (check_col(pinfo->fd, COL_PROTOCOL))
col_set_str(pinfo->fd, COL_PROTOCOL, "IPX");
if (check_col(pinfo->fd, COL_INFO))
col_clear(pinfo->fd, COL_INFO);
/* Calculate here for use in pinfo and in tree */
ipx_dsocket = tvb_get_ntohs(tvb, 16);
@ -319,8 +320,6 @@ dissect_ipx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
SET_ADDRESS(&pi.net_dst, AT_IPX, 10, dst_net_node);
SET_ADDRESS(&pi.dst, AT_IPX, 10, dst_net_node);
if (check_col(pinfo->fd, COL_PROTOCOL))
col_set_str(pinfo->fd, COL_PROTOCOL, "IPX");
if (check_col(pinfo->fd, COL_INFO))
col_add_fstr(pinfo->fd, COL_INFO, "%s (0x%04X)",
socket_text(ipx_dsocket), ipx_dsocket);
@ -441,9 +440,6 @@ dissect_spx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint8 conn_ctrl;
guint8 datastream_type;
CHECK_DISPLAY_AS_DATA(proto_spx, tvb, pinfo, tree);
pinfo->current_proto = "SPX";
if (check_col(pinfo->fd, COL_PROTOCOL))
col_set_str(pinfo->fd, COL_PROTOCOL, "SPX");
if (check_col(pinfo->fd, COL_INFO))
@ -486,12 +482,10 @@ dissect_ipxmsg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_item *ti;
guint8 conn_number, sig_char;
CHECK_DISPLAY_AS_DATA(proto_ipxmsg, tvb, pinfo, tree);
pinfo->current_proto = "IPX MSG";
if (check_col(pinfo->fd, COL_PROTOCOL))
col_set_str(pinfo->fd, COL_PROTOCOL, "IPX MSG");
col_set_str(pinfo->fd, COL_PROTOCOL, "IPX MSG");
if (check_col(pinfo->fd, COL_INFO))
col_clear(pinfo->fd, COL_INFO);
conn_number = tvb_get_guint8(tvb, 0);
sig_char = tvb_get_guint8(tvb, 1);
@ -527,11 +521,10 @@ dissect_ipxrip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
char *rip_type[3] = { "Request", "Response", "Unknown" };
CHECK_DISPLAY_AS_DATA(proto_ipxrip, tvb, pinfo, tree);
pinfo->current_proto = "IPX RIP";
if (check_col(pinfo->fd, COL_PROTOCOL))
col_set_str(pinfo->fd, COL_PROTOCOL, "IPX RIP");
col_set_str(pinfo->fd, COL_PROTOCOL, "IPX RIP");
if (check_col(pinfo->fd, COL_INFO))
col_clear(pinfo->fd, COL_INFO);
operation = tvb_get_ntohs(tvb, 0) - 1;
@ -675,11 +668,10 @@ dissect_ipxsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
char *sap_type[4] = { "General Query", "General Response",
"Nearest Query", "Nearest Response" };
CHECK_DISPLAY_AS_DATA(proto_sap, tvb, pinfo, tree);
pinfo->current_proto = "IPX SAP";
if (check_col(pinfo->fd, COL_PROTOCOL))
col_set_str(pinfo->fd, COL_PROTOCOL, "IPX SAP");
if (check_col(pinfo->fd, COL_INFO))
col_clear(pinfo->fd, COL_INFO);
query.query_type = tvb_get_ntohs(tvb, 0);
query.server_type = tvb_get_ntohs(tvb, 2);
@ -926,7 +918,7 @@ proto_reg_handoff_ipx(void)
dissector_add("ipx.socket", IPX_SOCKET_SAP, dissect_ipxsap,
proto_sap);
dissector_add("ipx.socket", IPX_SOCKET_IPXRIP, dissect_ipxrip,
proto_sap);
proto_ipxrip);
dissector_add("ipx.socket", IPX_SOCKET_IPX_MESSAGE, dissect_ipxmsg,
proto_ipxmsg);
}

View File

@ -2,7 +2,7 @@
* Routines for lapb frame disassembly
* Olivier Abad <oabad@cybercable.fr>
*
* $Id: packet-lapb.c,v 1.27 2001/01/09 06:31:38 guy Exp $
* $Id: packet-lapb.c,v 1.28 2001/01/22 00:20:29 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -56,12 +56,10 @@ dissect_lapb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint8 byte0;
tvbuff_t *next_tvb;
CHECK_DISPLAY_AS_DATA(proto_lapb, tvb, pinfo, tree);
pinfo->current_proto = "LAPB";
if (check_col(pinfo->fd, COL_PROTOCOL))
col_set_str(pinfo->fd, COL_PROTOCOL, "LAPB");
if (check_col(pinfo->fd, COL_INFO))
col_clear(pinfo->fd, COL_INFO);
if (pinfo->pseudo_header->x25.flags & FROM_DCE) {
if(check_col(pinfo->fd, COL_RES_DL_DST))
@ -120,11 +118,11 @@ proto_register_lapb(void)
static hf_register_info hf[] = {
{ &hf_lapb_address,
{ "Address Field", "lapb.address", FT_UINT8, BASE_HEX, NULL, 0x0,
"" }},
"Address" }},
{ &hf_lapb_control,
{ "Control Field", "lapb.control", FT_UINT8, BASE_HEX, NULL, 0x0,
"" }},
"Control field" }},
};
static gint *ett[] = {
&ett_lapb,

View File

@ -2,7 +2,7 @@
* Routines for LAPD frame disassembly
* Gilbert Ramirez <gram@xiexie.org>
*
* $Id: packet-lapd.c,v 1.19 2001/01/09 06:31:38 guy Exp $
* $Id: packet-lapd.c,v 1.20 2001/01/22 00:20:29 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -93,12 +93,10 @@ dissect_lapd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
gboolean is_response;
tvbuff_t *next_tvb;
CHECK_DISPLAY_AS_DATA(proto_lapd, tvb, pinfo, tree);
pinfo->current_proto = "LAPD";
if (check_col(pinfo->fd, COL_PROTOCOL))
col_set_str(pinfo->fd, COL_PROTOCOL, "LAPD");
if (check_col(pinfo->fd, COL_INFO))
col_clear(pinfo->fd, COL_INFO);
address = tvb_get_ntohs(tvb, 0);
cr = address & LAPD_CR;
@ -120,7 +118,6 @@ dissect_lapd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_set_str(pinfo->fd, COL_RES_DL_SRC, "Network");
}
if (tree) {
ti = proto_tree_add_item(tree, proto_lapd, tvb, 0, 3, FALSE);
lapd_tree = proto_item_add_subtree(ti, ett_lapd);
@ -165,7 +162,7 @@ proto_register_lapd(void)
static hf_register_info hf[] = {
{ &hf_lapd_address,
{ "Address Field", "lapd.address", FT_UINT16, BASE_HEX, NULL, 0x0,
"" }},
"Address" }},
{ &hf_lapd_sapi,
{ "SAPI", "lapd.sapi", FT_UINT16, BASE_DEC, VALS(lapd_sapi_vals), LAPD_SAPI,
@ -189,7 +186,7 @@ proto_register_lapd(void)
{ &hf_lapd_control,
{ "Control Field", "lapd.control", FT_UINT16, BASE_HEX, NULL, 0x0,
"" }},
"Control field" }},
};
static gint *ett[] = {
&ett_lapd,

View File

@ -5,7 +5,7 @@
*
* derived from the packet-nbns.c
*
* $Id: packet-netbios.c,v 1.30 2001/01/15 04:39:28 guy Exp $
* $Id: packet-netbios.c,v 1.31 2001/01/22 00:20:29 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -970,11 +970,7 @@ dissect_netbios(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
int offset = 0;
CHECK_DISPLAY_AS_DATA(proto_netbios, tvb, pinfo, tree);
/* load the display labels */
pinfo->current_proto = "NetBIOS";
if (check_col(pinfo->fd, COL_PROTOCOL))
col_set_str(pinfo->fd, COL_PROTOCOL, "NetBIOS");

View File

@ -1,7 +1,7 @@
/* packet-null.c
* Routines for null packet disassembly
*
* $Id: packet-null.c,v 1.39 2001/01/18 07:44:39 guy Exp $
* $Id: packet-null.c,v 1.40 2001/01/22 00:20:29 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -217,10 +217,6 @@ dissect_null(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_item *ti;
tvbuff_t *next_tvb;
CHECK_DISPLAY_AS_DATA(proto_null, tvb, pinfo, tree);
pinfo->current_proto = "Null";
/*
* See comment in "capture_null()" for an explanation of what we're
* doing.

View File

@ -2,7 +2,7 @@
* Routines for v120 frame disassembly
* Bert Driehuis <driehuis@playbeing.org>
*
* $Id: packet-v120.c,v 1.17 2001/01/09 06:31:44 guy Exp $
* $Id: packet-v120.c,v 1.18 2001/01/22 00:20:29 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -65,12 +65,10 @@ dissect_v120(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint16 control;
tvbuff_t *next_tvb;
CHECK_DISPLAY_AS_DATA(proto_v120, tvb, pinfo, tree);
pinfo->current_proto = "V.120";
if (check_col(pinfo->fd, COL_PROTOCOL))
col_set_str(pinfo->fd, COL_PROTOCOL, "V.120");
if (check_col(pinfo->fd, COL_INFO))
col_clear(pinfo->fd, COL_INFO);
byte0 = tvb_get_guint8(tvb, 0);