aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/dissectors/packet-diameter.c28
-rw-r--r--epan/dissectors/packet-iuup.c53
-rw-r--r--epan/dissectors/packet-iwarp-mpa.c10
-rw-r--r--epan/dissectors/packet-tnef.c25
4 files changed, 67 insertions, 49 deletions
diff --git a/epan/dissectors/packet-diameter.c b/epan/dissectors/packet-diameter.c
index fe02def1dd..4767bea46e 100644
--- a/epan/dissectors/packet-diameter.c
+++ b/epan/dissectors/packet-diameter.c
@@ -279,6 +279,9 @@ static gint ett_diameter_avpinfo = -1;
static gint ett_unknown = -1;
static gint ett_err = -1;
+
+static expert_field ei_diameter_reserved_bit_set = EI_INIT;
+
/* Tap for Diameter */
static int diameter_tap = -1;
@@ -514,15 +517,15 @@ dissect_diameter_avp(diam_ctx_t *c, tvbuff_t *tvb, int offset)
proto_tree_add_item(flags_tree,hf_diameter_avp_flags_mandatory,tvb,offset,1,ENC_BIG_ENDIAN);
proto_tree_add_item(flags_tree,hf_diameter_avp_flags_protected,tvb,offset,1,ENC_BIG_ENDIAN);
pi = proto_tree_add_item(flags_tree,hf_diameter_avp_flags_reserved3,tvb,offset,1,ENC_BIG_ENDIAN);
- if(flags_bits & 0x10) proto_item_set_expert_flags(pi, PI_MALFORMED, PI_WARN);
+ if(flags_bits & 0x10) expert_add_info(c->pinfo, pi, &ei_diameter_reserved_bit_set);
pi = proto_tree_add_item(flags_tree,hf_diameter_avp_flags_reserved4,tvb,offset,1,ENC_BIG_ENDIAN);
- if(flags_bits & 0x08) proto_item_set_expert_flags(pi, PI_MALFORMED, PI_WARN);
+ if(flags_bits & 0x08) expert_add_info(c->pinfo, pi, &ei_diameter_reserved_bit_set);
pi = proto_tree_add_item(flags_tree,hf_diameter_avp_flags_reserved5,tvb,offset,1,ENC_BIG_ENDIAN);
- if(flags_bits & 0x04) proto_item_set_expert_flags(pi, PI_MALFORMED, PI_WARN);
+ if(flags_bits & 0x04) expert_add_info(c->pinfo, pi, &ei_diameter_reserved_bit_set);
proto_tree_add_item(flags_tree,hf_diameter_avp_flags_reserved6,tvb,offset,1,ENC_BIG_ENDIAN);
- if(flags_bits & 0x02) proto_item_set_expert_flags(pi, PI_MALFORMED, PI_WARN);
+ if(flags_bits & 0x02) expert_add_info(c->pinfo, pi, &ei_diameter_reserved_bit_set);
proto_tree_add_item(flags_tree,hf_diameter_avp_flags_reserved7,tvb,offset,1,ENC_BIG_ENDIAN);
- if(flags_bits & 0x01) proto_item_set_expert_flags(pi, PI_MALFORMED, PI_WARN);
+ if(flags_bits & 0x01) expert_add_info(c->pinfo, pi, &ei_diameter_reserved_bit_set);
}
offset += 1;
@@ -943,13 +946,13 @@ dissect_diameter_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_item(pt,hf_diameter_flags_error,tvb,4,1,ENC_BIG_ENDIAN);
proto_tree_add_item(pt,hf_diameter_flags_T,tvb,4,1,ENC_BIG_ENDIAN);
proto_tree_add_item(pt,hf_diameter_flags_reserved4,tvb,4,1,ENC_BIG_ENDIAN);
- if(flags_bits & 0x08) proto_item_set_expert_flags(pi, PI_MALFORMED, PI_WARN);
+ if(flags_bits & 0x08) expert_add_info(c->pinfo, pi, &ei_diameter_reserved_bit_set);
pi = proto_tree_add_item(pt,hf_diameter_flags_reserved5,tvb,4,1,ENC_BIG_ENDIAN);
- if(flags_bits & 0x04) proto_item_set_expert_flags(pi, PI_MALFORMED, PI_WARN);
+ if(flags_bits & 0x04) expert_add_info(c->pinfo, pi, &ei_diameter_reserved_bit_set);
pi = proto_tree_add_item(pt,hf_diameter_flags_reserved6,tvb,4,1,ENC_BIG_ENDIAN);
- if(flags_bits & 0x02) proto_item_set_expert_flags(pi, PI_MALFORMED, PI_WARN);
+ if(flags_bits & 0x02) expert_add_info(c->pinfo, pi, &ei_diameter_reserved_bit_set);
pi = proto_tree_add_item(pt,hf_diameter_flags_reserved7,tvb,4,1,ENC_BIG_ENDIAN);
- if(flags_bits & 0x01) proto_item_set_expert_flags(pi, PI_MALFORMED, PI_WARN);
+ if(flags_bits & 0x01) expert_add_info(c->pinfo, pi, &ei_diameter_reserved_bit_set);
}
cmd_item = proto_tree_add_item(diam_tree,hf_diameter_code,tvb,5,3,ENC_BIG_ENDIAN);
@@ -1731,6 +1734,7 @@ static void
real_proto_register_diameter(void)
{
module_t *diameter_module;
+ expert_module_t* expert_diameter;
guint i, ett_length;
hf_register_info hf_base[] = {
@@ -1858,6 +1862,10 @@ real_proto_register_diameter(void)
&(unknown_avp.ett)
};
+ static ei_register_info ei[] = {
+ { &ei_diameter_reserved_bit_set, { "diameter.reserved_bit_set", PI_MALFORMED, PI_WARN, "Reserved bit set", EXPFILL }},
+ };
+
wmem_array_append(build_dict.hf, hf_base, array_length(hf_base));
ett_length = array_length(ett_base);
for (i = 0; i < ett_length; i++) {
@@ -1868,6 +1876,8 @@ real_proto_register_diameter(void)
proto_register_field_array(proto_diameter, (hf_register_info *)wmem_array_get_raw(build_dict.hf), wmem_array_get_count(build_dict.hf));
proto_register_subtree_array((gint **)build_dict.ett->pdata, build_dict.ett->len);
+ expert_diameter = expert_register_protocol(proto_diameter);
+ expert_register_field_array(expert_diameter, ei, array_length(ei));
g_ptr_array_free(build_dict.ett,TRUE);
diff --git a/epan/dissectors/packet-iuup.c b/epan/dissectors/packet-iuup.c
index 88081ea25f..650cf22c2c 100644
--- a/epan/dissectors/packet-iuup.c
+++ b/epan/dissectors/packet-iuup.c
@@ -149,6 +149,12 @@ static gint ett_payload_subflows = -1;
static expert_field ei_iuup_hdr_crc_bad = EI_INIT;
static expert_field ei_iuup_payload_crc_bad = EI_INIT;
+static expert_field ei_iuup_payload_undecoded = EI_INIT;
+static expert_field ei_iuup_error_response = EI_INIT;
+static expert_field ei_iuup_ack_nack = EI_INIT;
+static expert_field ei_iuup_time_align = EI_INIT;
+static expert_field ei_iuup_procedure_indicator = EI_INIT;
+static expert_field ei_iuup_pdu_type = EI_INIT;
static GHashTable* circuits = NULL;
@@ -346,7 +352,7 @@ iuup_proto_tree_add_bits(proto_tree* tree, int hf, tvbuff_t* tvb, int offset, in
return pi;
}
-static void dissect_iuup_payload(tvbuff_t* tvb, packet_info* pinfo _U_, proto_tree* tree, guint rfci_id _U_, int offset) {
+static void dissect_iuup_payload(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, guint rfci_id _U_, int offset) {
iuup_circuit_t* iuup_circuit;
iuup_rfci_t *rfci;
int last_offset = tvb_length(tvb) - 1;
@@ -359,7 +365,7 @@ static void dissect_iuup_payload(tvbuff_t* tvb, packet_info* pinfo _U_, proto_tr
return;
} else if ( ! pinfo->circuit_id
|| ! ( iuup_circuit = (iuup_circuit_t *)g_hash_table_lookup(circuits,GUINT_TO_POINTER(pinfo->circuit_id)) ) ) {
- proto_item_set_expert_flags(pi, PI_UNDECODED, PI_WARN);
+ expert_add_info(pinfo, pi, &ei_iuup_payload_undecoded);
return;
}
@@ -368,7 +374,7 @@ static void dissect_iuup_payload(tvbuff_t* tvb, packet_info* pinfo _U_, proto_tr
break;
if (!rfci) {
- proto_item_set_expert_flags(pi, PI_UNDECODED, PI_WARN);
+ expert_add_info(pinfo, pi, &ei_iuup_payload_undecoded);
return;
}
@@ -640,15 +646,14 @@ static void dissect_iuup(tvbuff_t* tvb_in, packet_info* pinfo, proto_tree* tree)
case PDUTYPE_DATA_WITH_CRC:
col_append_fstr(pinfo->cinfo, COL_INFO,"FN: %x RFCI: %u", (guint)(first_octet & 0x0f) ,(guint)(second_octet & 0x3f));
- if (!tree) return;
proto_tree_add_item(iuup_tree,hf_iuup_frame_number,tvb,0,1,ENC_BIG_ENDIAN);
pi = proto_tree_add_item(iuup_tree,hf_iuup_fqc,tvb,1,1,ENC_BIG_ENDIAN);
if (first_octet & FQC_MASK) {
- proto_item_set_expert_flags(pi, PI_RESPONSE_CODE, PI_WARN);
- proto_item_set_expert_flags(iuup_item, PI_RESPONSE_CODE, PI_WARN);
+ expert_add_info(pinfo, pi, &ei_iuup_error_response);
}
+ if (!tree) return;
proto_tree_add_item(iuup_tree,hf_iuup_rfci,tvb,1,1,ENC_BIG_ENDIAN);
add_hdr_crc(tvb, pinfo, iuup_tree, crccheck);
add_payload_crc(tvb, pinfo, iuup_tree);
@@ -657,16 +662,15 @@ static void dissect_iuup(tvbuff_t* tvb_in, packet_info* pinfo, proto_tree* tree)
case PDUTYPE_DATA_NO_CRC:
col_append_fstr(pinfo->cinfo, COL_INFO," RFCI %u", (guint)(second_octet & 0x3f));
- if (!tree)
- return;
proto_tree_add_item(iuup_tree,hf_iuup_frame_number,tvb,0,1,ENC_BIG_ENDIAN);
pi = proto_tree_add_item(iuup_tree,hf_iuup_fqc,tvb,1,1,ENC_BIG_ENDIAN);
if (first_octet & FQC_MASK) {
- proto_item_set_expert_flags(pi, PI_RESPONSE_CODE, PI_WARN);
- proto_item_set_expert_flags(iuup_item, PI_RESPONSE_CODE, PI_WARN);
+ expert_add_info(pinfo, pi, &ei_iuup_error_response);
}
+ if (!tree)
+ return;
proto_tree_add_item(iuup_tree,hf_iuup_rfci,tvb,1,1,ENC_BIG_ENDIAN);
add_hdr_crc(tvb, pinfo, iuup_tree, crccheck);
dissect_iuup_payload(tvb,pinfo,iuup_tree,second_octet & 0x3f,3);
@@ -704,19 +708,16 @@ static void dissect_iuup(tvbuff_t* tvb_in, packet_info* pinfo, proto_tree* tree)
case PROC_ERROR:
break;
default:
- if (!tree) return;
- proto_item_set_expert_flags(proc_item, PI_MALFORMED, PI_ERROR);
+ expert_add_info(pinfo, proc_item, &ei_iuup_procedure_indicator);
return;
}
break;
case ACKNACK_NACK:
- if (!tree) return;
pi = proto_tree_add_item(iuup_tree,hf_iuup_error_cause_val,tvb,4,1,ENC_BIG_ENDIAN);
- proto_item_set_expert_flags(pi, PI_RESPONSE_CODE, PI_ERROR);
+ expert_add_info(pinfo, pi, &ei_iuup_error_response);
return;
case ACKNACK_RESERVED:
- if (!tree) return;
- proto_item_set_expert_flags(ack_item, PI_MALFORMED, PI_ERROR);
+ expert_add_info(pinfo, ack_item, &ei_iuup_ack_nack);
return;
case ACKNACK_PROC:
break;
@@ -737,8 +738,6 @@ static void dissect_iuup(tvbuff_t* tvb_in, packet_info* pinfo, proto_tree* tree)
proto_tree* time_tree;
guint ta;
- if (!tree) return;
-
ta = tvb_get_guint8(tvb,4);
pi = proto_tree_add_item(iuup_tree,hf_iuup_time_align,tvb,4,1,ENC_BIG_ENDIAN);
@@ -755,7 +754,7 @@ static void dissect_iuup(tvbuff_t* tvb_in, packet_info* pinfo, proto_tree* tree)
pi = proto_tree_add_float(time_tree,hf_iuup_delta,tvb,4,1,((gfloat)((gint)(-(((gint)ta)-128))) * 500)/(gfloat)1000000.0);
PROTO_ITEM_SET_GENERATED(pi);
} else {
- proto_item_set_expert_flags(pi, PI_MALFORMED, PI_ERROR);
+ expert_add_info(pinfo, pi, &ei_iuup_time_align);
}
proto_tree_add_item(iuup_tree,hf_iuup_spare_bytes,tvb,5,-1,ENC_NA);
@@ -764,21 +763,17 @@ static void dissect_iuup(tvbuff_t* tvb_in, packet_info* pinfo, proto_tree* tree)
case PROC_ERROR:
col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(tvb,4) & 0x3f,iuup_error_causes,"Unknown (%u)"));
- if (!tree)
- return;
proto_tree_add_item(iuup_tree,hf_iuup_error_distance,tvb,4,1,ENC_BIG_ENDIAN);
pi = proto_tree_add_item(iuup_tree,hf_iuup_errorevt_cause_val,tvb,4,1,ENC_BIG_ENDIAN);
- proto_item_set_expert_flags(pi, PI_RESPONSE_CODE, PI_ERROR);
+ expert_add_info(pinfo, pi, &ei_iuup_error_response);
proto_tree_add_item(iuup_tree,hf_iuup_spare_bytes,tvb,5,-1,ENC_NA);
return;
default: /* bad */
- if (!tree) return;
- proto_item_set_expert_flags(proc_item, PI_MALFORMED, PI_ERROR);
+ expert_add_info(pinfo, proc_item, &ei_iuup_procedure_indicator);
return;
}
default:
- if (!tree) return;
- proto_item_set_expert_flags(pdutype_item, PI_MALFORMED, PI_ERROR);
+ expert_add_info(pinfo, pdutype_item, &ei_iuup_pdu_type);
return;
}
}
@@ -976,6 +971,12 @@ void proto_register_iuup(void) {
static ei_register_info ei[] = {
{ &ei_iuup_hdr_crc_bad, { "iuup.hdr.crc.bad", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }},
{ &ei_iuup_payload_crc_bad, { "iuup.payload.crc.bad", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }},
+ { &ei_iuup_payload_undecoded, { "iuup.payload.undecoded", PI_UNDECODED, PI_WARN, "Undecoded payload", EXPFILL }},
+ { &ei_iuup_error_response, { "iuup.error_response", PI_RESPONSE_CODE, PI_ERROR, "Error response", EXPFILL }},
+ { &ei_iuup_ack_nack, { "iuup.ack.malformed", PI_MALFORMED, PI_ERROR, "Malformed Ack/Nack", EXPFILL }},
+ { &ei_iuup_time_align, { "iuup.time_align.malformed", PI_MALFORMED, PI_ERROR, "Malformed Time Align", EXPFILL }},
+ { &ei_iuup_procedure_indicator, { "iuup.procedure.malformed", PI_MALFORMED, PI_ERROR, "Malformed Procedure", EXPFILL }},
+ { &ei_iuup_pdu_type, { "iuup.pdu_type.malformed", PI_MALFORMED, PI_ERROR, "Malformed PDU Type", EXPFILL }},
};
module_t *iuup_module;
diff --git a/epan/dissectors/packet-iwarp-mpa.c b/epan/dissectors/packet-iwarp-mpa.c
index 87761d665e..7e70638a41 100644
--- a/epan/dissectors/packet-iwarp-mpa.c
+++ b/epan/dissectors/packet-iwarp-mpa.c
@@ -113,6 +113,7 @@ static gint ett_mpa_marker = -1;
static expert_field ei_mpa_res_field_not_set0 = EI_INIT;
static expert_field ei_mpa_rev_field_not_set1 = EI_INIT;
static expert_field ei_mpa_reject_bit_responder = EI_INIT;
+static expert_field ei_mpa_bad_length = EI_INIT;
/* handles of our subdissectors */
static dissector_handle_t ddp_rdmap_handle = NULL;
@@ -517,10 +518,8 @@ dissect_mpa_req_rep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* check whether the Private Data Length conforms to RFC 5044 */
pd_length = tvb_get_ntohs(tvb, offset);
if (pd_length > MPA_MAX_PD_LENGTH) {
- bad_pd_length_pi = proto_tree_add_text(tree, tvb, offset, 2,
+ proto_tree_add_expert_format(tree, pinfo, &ei_mpa_bad_length, tvb, offset, 2,
"[PD length field indicates more 512 bytes of Private Data]");
- proto_item_set_expert_flags(bad_pd_length_pi,
- PI_MALFORMED, PI_ERROR);
return FALSE;
}
@@ -723,11 +722,9 @@ dissect_mpa_fpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
*/
exp_ulpdu_length = expected_ulpdu_length(state, tcpinfo, endpoint);
if (!exp_ulpdu_length || exp_ulpdu_length != ulpdu_length) {
- bad_ulpdu_length_pi = proto_tree_add_text(tree, tvb, offset,
+ proto_tree_add_expert_format(tree, pinfo, &ei_mpa_bad_length, tvb, offset,
MPA_ULPDU_LENGTH_LEN,
"[ULPDU length field does not contain the expected length]");
- proto_item_set_expert_flags(bad_ulpdu_length_pi,
- PI_MALFORMED, PI_ERROR);
return 0;
}
@@ -963,6 +960,7 @@ void proto_register_mpa(void)
{ &ei_mpa_res_field_not_set0, { "iwarp_mpa.res.not_set0", PI_REQUEST_CODE, PI_WARN, "Res field is NOT set to zero as required by RFC 5044", EXPFILL }},
{ &ei_mpa_rev_field_not_set1, { "iwarp_mpa.rev.not_set1", PI_REQUEST_CODE, PI_WARN, "Rev field is NOT set to one as required by RFC 5044", EXPFILL }},
{ &ei_mpa_reject_bit_responder, { "iwarp_mpa.reject_bit_responder", PI_RESPONSE_CODE, PI_NOTE, "Reject bit set by Responder", EXPFILL }},
+ { &ei_mpa_bad_length, { "iwarp_mpa.bad_length", PI_MALFORMED, PI_ERROR, "Bad length", EXPFILL }},
};
expert_module_t* expert_iwarp_mpa;
diff --git a/epan/dissectors/packet-tnef.c b/epan/dissectors/packet-tnef.c
index 9318d0fc5b..7b367f6bda 100644
--- a/epan/dissectors/packet-tnef.c
+++ b/epan/dissectors/packet-tnef.c
@@ -31,6 +31,7 @@
#include <epan/packet.h>
#include <epan/addr_resolv.h>
#include <epan/strutil.h>
+#include <epan/expert.h>
#include <wiretap/tnef.h>
@@ -164,6 +165,9 @@ static int ett_tnef_counted_items = -1;
static int ett_tnef_attribute_date = -1;
static int ett_tnef_attribute_address = -1;
+static expert_field ei_tnef_expect_single_item = EI_INIT;
+static expert_field ei_tnef_incorrect_signature = EI_INIT;
+
static const value_string tnef_Lvl_vals[] = {
{ 1, "LVL-MESSAGE" },
{ 2, "LVL-ATTACHMENT" },
@@ -239,7 +243,7 @@ static const value_string tnef_Attribute_vals[] = {
{ 0, NULL }
};
-static gint dissect_counted_values(tvbuff_t *tvb, gint offset, int hf_id, packet_info *pinfo _U_, proto_tree *tree, gboolean single, gboolean unicode, guint encoding)
+static gint dissect_counted_values(tvbuff_t *tvb, gint offset, int hf_id, packet_info *pinfo, proto_tree *tree, gboolean single, gboolean unicode, guint encoding)
{
proto_item *item;
guint32 length, count, i;
@@ -249,10 +253,8 @@ static gint dissect_counted_values(tvbuff_t *tvb, gint offset, int hf_id, packe
if(count > 1) {
if(single) {
- item = proto_tree_add_text(tree, tvb, offset, 4,
+ item = proto_tree_add_expert_format(tree, pinfo, &ei_tnef_expect_single_item, tvb, offset, 4,
"Expecting a single item but found %d", count);
- proto_item_set_expert_flags(item, PI_MALFORMED, PI_ERROR);
-
tree = proto_item_add_subtree(item, ett_tnef_counted_items);
}
}
@@ -522,10 +524,8 @@ static void dissect_tnef(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* check the signature */
if(signature != TNEF_SIGNATURE) {
- proto_item_append_text(item, " [Incorrect, should be 0x%x. No further dissection possible. Check any Content-Transfer-Encoding has been removed.]", TNEF_SIGNATURE);
-
- proto_item_set_expert_flags(item, PI_MALFORMED, PI_WARN);
-
+ expert_add_info_format_text(pinfo, item, &ei_tnef_incorrect_signature,
+ " [Incorrect, should be 0x%x. No further dissection possible. Check any Content-Transfer-Encoding has been removed.]", TNEF_SIGNATURE);
return;
} else {
@@ -814,10 +814,19 @@ proto_register_tnef(void)
&ett_tnef_attribute_address,
};
+ static ei_register_info ei[] = {
+ { &ei_tnef_expect_single_item, { "tnef.expect_single_item", PI_MALFORMED, PI_ERROR, "Expected single item", EXPFILL }},
+ { &ei_tnef_incorrect_signature, { "tnef.signature.incorrect", PI_MALFORMED, PI_WARN, "Incorrect signature", EXPFILL }},
+ };
+
+ expert_module_t* expert_tnef;
+
proto_tnef = proto_register_protocol(PNAME, PSNAME, PFNAME);
proto_register_field_array(proto_tnef, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+ expert_tnef = expert_register_protocol(proto_tnef);
+ expert_register_field_array(expert_tnef, ei, array_length(ei));
/* Allow dissector to find be found by name. */
register_dissector(PFNAME, dissect_tnef, proto_tnef);