summaryrefslogtreecommitdiff
path: root/epan
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-08-18 12:29:45 -0700
committerGuy Harris <guy@alum.mit.edu>2014-08-18 19:30:12 +0000
commit9d6d19254cd7e264fcc886ec24b505ebd6156109 (patch)
tree3fbd85a83a48dfff57a3cb9979313fa7ca4562e5 /epan
parenta3cecb290938f56787c0e08b30fc34749bb4baec (diff)
downloadwireshark-9d6d19254cd7e264fcc886ec24b505ebd6156109.tar.gz
Use expert info to report unknown TLV types.
Unless we plan to fill in all 256 entries in the TLV type table, and unless that's because all 256 types are valid, we should report unknown types with an expert info, not a dissector assertion. Change-Id: Ia6fca37ad6a5969caad3229abaf08a25e20ba992 Reviewed-on: https://code.wireshark.org/review/3707 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-gsm_abis_oml.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/epan/dissectors/packet-gsm_abis_oml.c b/epan/dissectors/packet-gsm_abis_oml.c
index 4b930bda80..3cfbc28698 100644
--- a/epan/dissectors/packet-gsm_abis_oml.c
+++ b/epan/dissectors/packet-gsm_abis_oml.c
@@ -28,6 +28,7 @@
#include <glib.h>
#include <epan/packet.h>
+#include <epan/expert.h>
#include <epan/emem.h>
#include <epan/lapd_sapi.h>
#include <epan/prefs.h>
@@ -730,6 +731,8 @@ static int ett_oml = -1;
static int ett_oml_fom = -1;
static int ett_oml_fom_att = -1;
+static expert_field ei_unknown_type = EI_INIT;
+
enum {
OML_DIALECT_ETSI,
OML_DIALECT_SIEMENS,
@@ -1531,6 +1534,10 @@ dissect_oml_attrs(tvbuff_t *tvb, int base_offs, packet_info *pinfo,
tvbuff_t *sub_tvb;
tag = tvb_get_guint8(tvb, offset);
+ ti = proto_tree_add_item(tree, hf_oml_fom_attr_tag, tvb,
+ offset, 1, ENC_BIG_ENDIAN);
+ att_tree = proto_item_add_subtree(ti, ett_oml_fom_att);
+
tdef = find_tlv_tag(tag);
switch (tdef->type) {
@@ -1567,13 +1574,10 @@ dissect_oml_attrs(tvbuff_t *tvb, int base_offs, packet_info *pinfo,
break;
case TLV_TYPE_UNKNOWN: /* fall through */
default:
- DISSECTOR_ASSERT_NOT_REACHED();
- break;
+ expert_add_info(pinfo, ti, &ei_unknown_type);
+ return tvb_captured_length(tvb);
}
- ti = proto_tree_add_item(tree, hf_oml_fom_attr_tag, tvb,
- offset, 1, ENC_BIG_ENDIAN);
- att_tree = proto_item_add_subtree(ti, ett_oml_fom_att);
proto_tree_add_uint(att_tree, hf_oml_fom_attr_len, tvb,
offset+1, len_len, len);
offset += hlen;
@@ -2192,8 +2196,14 @@ proto_register_abis_oml(void)
&ett_oml_fom_att,
};
+ static ei_register_info ei[] = {
+ { &ei_unknown_type, { "gsm_abis_oml.expert.unknown_type", PI_PROTOCOL, PI_NOTE, "Unknown TLV type", EXPFILL }},
+ };
+
module_t *oml_module;
+ expert_module_t *expert_module;
+
#define NM_ATT_TLVDEF_BASE(_attr, _type, _fixed_len) \
nm_att_tlvdef_base.def[_attr].type = _type; \
nm_att_tlvdef_base.def[_attr].fixed_len = _fixed_len; \
@@ -2365,6 +2375,9 @@ proto_register_abis_oml(void)
proto_register_subtree_array(ett, array_length(ett));
+ expert_module = expert_register_protocol(proto_abis_oml);
+ expert_register_field_array(expert_module, ei, array_length(ei));
+
new_register_dissector("gsm_abis_oml", dissect_abis_oml, proto_abis_oml);
oml_module = prefs_register_protocol(proto_abis_oml, NULL);