Have X.25 dissector pass boolean q_bit_set value through dissector data rather than pinfo->private_data.

Other "related" dissectors weren't manipulating pinfo->private_data, so it doesn't make sense for them to bother saving/restore it (now that q_bit_set isn't being used)

svn path=/trunk/; revision=52894
This commit is contained in:
Michael Mann 2013-10-27 16:03:11 +00:00
parent 394f67c1b7
commit 471f21181b
9 changed files with 30 additions and 74 deletions

View File

@ -206,7 +206,6 @@ dissect_ax25_kiss( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree )
int kiss_param_len;
const char *frame_type_text;
char *info_buffer;
void *saved_private_data;
tvbuff_t *next_tvb = NULL;
info_buffer = (char *)wmem_alloc( wmem_packet_scope(), STRLEN );
@ -261,7 +260,7 @@ dissect_ax25_kiss( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree )
proto_tree_add_uint( kiss_tree, hf_ax25_kiss_cmd, tvb, offset, KISS_HEADER_SIZE,
kiss_cmd );
proto_tree_add_uint( kiss_tree, hf_ax25_kiss_port, tvb, offset, KISS_HEADER_SIZE,
kiss_cmd );
kiss_port );
offset += KISS_HEADER_SIZE;
switch ( kiss_type )
@ -306,10 +305,8 @@ dissect_ax25_kiss( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree )
if ( kiss_type == KISS_DATA_FRAME )
{
saved_private_data = pinfo->private_data;
next_tvb = tvb_new_subset_remaining( tvb, offset );
call_dissector( ax25_handle, next_tvb, pinfo, parent_tree );
pinfo->private_data = saved_private_data;
}
}

View File

@ -158,7 +158,6 @@ dissect_ax25_nol3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree )
proto_tree *ax25_nol3_tree;
char *info_buffer;
int offset;
void *saved_private_data;
tvbuff_t *next_tvb = NULL;
guint8 dti = 0;
gboolean dissected;
@ -200,9 +199,7 @@ dissect_ax25_nol3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree )
"AX.25 No Layer 3 - (%s)", info_buffer );
ax25_nol3_tree = proto_item_add_subtree( ti, ett_ax25_nol3 );
saved_private_data = pinfo->private_data;
next_tvb = tvb_new_subset_remaining(tvb, offset);
dissected = FALSE;
if ( gPREF_APRS )
{
@ -223,7 +220,6 @@ dissect_ax25_nol3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree )
if ( ! dissected )
call_dissector( default_handle , next_tvb, pinfo, ax25_nol3_tree );
pinfo->private_data = saved_private_data;
}
}

View File

@ -148,7 +148,6 @@ dissect_ax25( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree )
guint8 pid = AX25_P_NO_L3;
guint8 src_ssid;
guint8 dst_ssid;
void *saved_private_data;
tvbuff_t *next_tvb = NULL;
@ -254,16 +253,12 @@ dissect_ax25( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree )
proto_item_set_end(ti, tvb, offset);
saved_private_data = pinfo->private_data;
next_tvb = tvb_new_subset_remaining(tvb, offset);
if (!dissector_try_uint(ax25_dissector_table, pid, next_tvb, pinfo, parent_tree))
{
call_dissector(data_handle, next_tvb, pinfo, parent_tree);
}
pinfo->private_data = saved_private_data;
}
else
proto_item_set_end(ti, tvb, offset);

View File

@ -66,7 +66,6 @@ dissect_bpq( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree )
proto_tree *bpq_tree;
int offset;
guint16 bpq_len;
void *saved_private_data;
tvbuff_t *next_tvb;
@ -100,11 +99,9 @@ dissect_bpq( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree )
offset += BPQ_HEADER_SIZE;
saved_private_data = pinfo->private_data;
/* XXX - use the length */
next_tvb = tvb_new_subset_remaining( tvb, offset );
call_dissector( ax25_handle, next_tvb, pinfo, parent_tree );
pinfo->private_data = saved_private_data;
}
void

View File

@ -60,7 +60,6 @@ static gint ett_flexnet_ctl = -1;
static void
dissect_flexnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
{
void *saved_private_data;
tvbuff_t *next_tvb;
col_set_str( pinfo->cinfo, COL_PROTOCOL, "Flexnet");
@ -92,12 +91,8 @@ dissect_flexnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
/* Call sub-dissectors here */
saved_private_data = pinfo->private_data;
next_tvb = tvb_new_subset_remaining(tvb, FLEXNET_HDRLEN);
call_dissector( default_handle , next_tvb, pinfo, parent_tree );
pinfo->private_data = saved_private_data;
}
void

View File

@ -208,7 +208,6 @@ dissect_netrom_proto(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint8 op_code;
guint8 cct_index;
guint8 cct_id;
void *saved_private_data;
tvbuff_t *next_tvb = NULL;
col_set_str( pinfo->cinfo, COL_PROTOCOL, "NET/ROM" );
@ -448,7 +447,6 @@ dissect_netrom_proto(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Call sub-dissectors here */
saved_private_data = pinfo->private_data;
next_tvb = tvb_new_subset_remaining(tvb, offset);
switch ( op_code )
@ -465,14 +463,11 @@ dissect_netrom_proto(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
call_dissector( default_handle , next_tvb, pinfo, tree );
break;
}
pinfo->private_data = saved_private_data;
}
static void
dissect_netrom_routing(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
void *saved_private_data;
tvbuff_t *next_tvb;
col_set_str( pinfo->cinfo, COL_PROTOCOL, "NET/ROM");
@ -492,13 +487,9 @@ dissect_netrom_routing(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_item( netrom_tree, hf_netrom_mnemonic, tvb, 1, 6, ENC_ASCII|ENC_NA );
}
saved_private_data = pinfo->private_data;
next_tvb = tvb_new_subset_remaining(tvb, 7);
call_dissector( default_handle , next_tvb, pinfo, tree );
pinfo->private_data = saved_private_data;
}
/* Code to actually dissect the packets */

View File

@ -71,12 +71,12 @@ static const value_string qllc_control_vals[] = {
};
static void
dissect_qllc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
static int
dissect_qllc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
proto_tree *qllc_tree = NULL;
proto_item *qllc_ti = NULL;
gboolean *q_bit_set = (gboolean *)pinfo->private_data;
proto_tree *qllc_tree;
proto_item *qllc_ti;
gboolean *q_bit_set = (gboolean *)data;
guint8 addr, ctrl;
gboolean command = FALSE;
@ -84,25 +84,21 @@ dissect_qllc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* If the Q bit isn't set, this is just SNA data.
*/
if (!(*q_bit_set)) {
call_dissector(sna_handle, tvb, pinfo, tree);
return;
call_dissector(sna_handle, tvb, pinfo, tree);
return tvb_length(tvb);
}
/* Summary information */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "QLLC");
col_clear(pinfo->cinfo, COL_INFO);
if (tree) {
qllc_ti = proto_tree_add_item(tree, proto_qllc, tvb, 0, -1, ENC_NA);
qllc_tree = proto_item_add_subtree(qllc_ti, ett_qllc);
}
qllc_ti = proto_tree_add_item(tree, proto_qllc, tvb, 0, -1, ENC_NA);
qllc_tree = proto_item_add_subtree(qllc_ti, ett_qllc);
/* Get the address; we need it to determine if this is a
* COMMAND or a RESPONSE */
addr = tvb_get_guint8(tvb, 0);
if (tree) {
proto_tree_add_item(qllc_tree, hf_qllc_address, tvb, 0, 1, ENC_BIG_ENDIAN);
}
/* The address field equals X'FF' in commands (except QRR)
* and anything in responses. */
@ -116,14 +112,14 @@ dissect_qllc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* a COMMAND or RESPONSE. */
if (ctrl == QRD_QDISC_VALUE) {
if (command) {
col_set_str(pinfo->cinfo, COL_INFO, QDISC_TEXT);
col_set_str(pinfo->cinfo, COL_INFO, QDISC_TEXT);
if (tree) {
proto_tree_add_text(qllc_tree, tvb,
1, 1, "Control Field: %s (0x%02x)", QDISC_TEXT, ctrl);
}
}
else {
col_set_str(pinfo->cinfo, COL_INFO, QRD_TEXT);
col_set_str(pinfo->cinfo, COL_INFO, QRD_TEXT);
if (tree) {
proto_tree_add_text(qllc_tree, tvb,
1, 1, "Control Field: %s (0x%02x)", QRD_TEXT, ctrl);
@ -154,6 +150,8 @@ dissect_qllc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (ctrl == QXID || ctrl == QTEST || ctrl == QFRMR) {
/* yes */
}
return tvb_length(tvb);
}
void
@ -173,11 +171,10 @@ proto_register_qllc(void)
&ett_qllc,
};
proto_qllc = proto_register_protocol("Qualified Logical Link Control",
"QLLC", "qllc");
proto_qllc = proto_register_protocol("Qualified Logical Link Control", "QLLC", "qllc");
proto_register_field_array(proto_qllc, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
register_dissector("qllc", dissect_qllc, proto_qllc);
new_register_dissector("qllc", dissect_qllc, proto_qllc);
}
void

View File

@ -1284,7 +1284,7 @@ dissect_x25_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint x25_pkt_len;
int modulo;
guint16 vc;
dissector_handle_t dissect = NULL;
dissector_handle_t dissect;
gboolean toa; /* TOA/NPI address format */
guint16 bytes0_1;
guint8 pkt_type;
@ -1294,7 +1294,6 @@ dissect_x25_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
gboolean m_bit_set;
gint payload_len;
guint32 frag_key;
void *saved_private_data;
fragment_head *fd_head;
@ -1583,7 +1582,7 @@ dissect_x25_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
*/
dissect = dissector_get_uint_handle(x25_subdissector_table, spi);
if (dissect != NULL)
x25_hash_add_proto_start(vc, pinfo->fd->num, dissect);
x25_hash_add_proto_start(vc, pinfo->fd->num, dissect);
}
/*
@ -2020,14 +2019,10 @@ dissect_x25_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (!next_tvb)
next_tvb = tvb_new_subset_remaining(tvb, localoffset);
saved_private_data = pinfo->private_data;
pinfo->private_data = &q_bit_set;
/* See if there's already a dissector for this circuit. */
if (try_circuit_dissector(CT_X25, vc, pinfo->fd->num, next_tvb, pinfo,
tree, NULL)) {
pinfo->private_data = saved_private_data;
return; /* found it and dissected it */
tree, &q_bit_set)) {
return; /* found it and dissected it */
}
/* Did the user suggest QLLC/SNA? */
@ -2035,8 +2030,7 @@ dissect_x25_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* Yes - dissect it as QLLC/SNA. */
if (!pinfo->fd->flags.visited)
x25_hash_add_proto_start(vc, pinfo->fd->num, qllc_handle);
call_dissector(qllc_handle, next_tvb, pinfo, tree);
pinfo->private_data = saved_private_data;
call_dissector_with_data(qllc_handle, next_tvb, pinfo, tree, &q_bit_set);
return;
}
@ -2050,7 +2044,6 @@ dissect_x25_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (!pinfo->fd->flags.visited)
x25_hash_add_proto_start(vc, pinfo->fd->num, ositp_handle);
call_dissector(ositp_handle, next_tvb, pinfo, tree);
pinfo->private_data = saved_private_data;
return;
}
}
@ -2064,14 +2057,12 @@ dissect_x25_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (!pinfo->fd->flags.visited)
x25_hash_add_proto_start(vc, pinfo->fd->num, ip_handle);
call_dissector(ip_handle, next_tvb, pinfo, tree);
pinfo->private_data = saved_private_data;
return;
case NLPID_ISO8473_CLNP:
if (!pinfo->fd->flags.visited)
x25_hash_add_proto_start(vc, pinfo->fd->num, clnp_handle);
call_dissector(clnp_handle, next_tvb, pinfo, tree);
pinfo->private_data = saved_private_data;
return;
}
}
@ -2079,13 +2070,11 @@ dissect_x25_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* Try the heuristic dissectors. */
if (dissector_try_heuristic(x25_heur_subdissector_list, next_tvb, pinfo,
tree, NULL)) {
pinfo->private_data = saved_private_data;
return;
}
/* All else failed; dissect it as raw data */
call_dissector(data_handle, next_tvb, pinfo, tree);
pinfo->private_data = saved_private_data;
}
/*

View File

@ -73,13 +73,13 @@ static const value_string error_type_vals[] = {
{ 0, NULL },
};
static void
dissect_x29(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
static int
dissect_x29(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
int offset = 0;
proto_tree *x29_tree = NULL;
proto_tree *x29_tree;
proto_item *ti;
gboolean *q_bit_set = (gboolean *)pinfo->private_data;
gboolean *q_bit_set = (gboolean *)data;
guint8 msg_code;
guint8 error_type;
guint8 type_ref;
@ -89,11 +89,8 @@ dissect_x29(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_set_str(pinfo->cinfo, COL_PROTOCOL, "X.29");
col_clear(pinfo->cinfo, COL_INFO);
if (tree) {
ti = proto_tree_add_item(tree, proto_x29, tvb, offset, -1,
ENC_NA);
x29_tree = proto_item_add_subtree(ti, ett_x29);
}
ti = proto_tree_add_item(tree, proto_x29, tvb, offset, -1, ENC_NA);
x29_tree = proto_item_add_subtree(ti, ett_x29);
if (*q_bit_set) {
/*
@ -234,6 +231,8 @@ dissect_x29(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
}
return tvb_length(tvb);
}
void
@ -267,6 +266,6 @@ proto_reg_handoff_x29(void)
{
dissector_handle_t x29_handle;
x29_handle = create_dissector_handle(dissect_x29, proto_x29);
x29_handle = new_create_dissector_handle(dissect_x29, proto_x29);
dissector_add_uint("x.25.spi", NLPID_SPI_X_29, x29_handle);
}