diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2016-02-03 15:37:01 +0100 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2016-02-03 17:48:40 +0000 |
commit | 1b1b93429af01b13550c985978fa3808296d7f5d (patch) | |
tree | 20c4d4a79f968bdd5782111bb7523f62d7257465 /asn1 | |
parent | 0421e7898861ba94b2eb353f1936e49565718b90 (diff) |
M3AP: fix dissection of IPAddress field
Bug: 12070
Change-Id: Ib516cc3ea7e00a6c4fe1661b9c78b0f6c6a25da6
Reviewed-on: https://code.wireshark.org/review/13689
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'asn1')
-rw-r--r-- | asn1/m3ap/m3ap.cnf | 12 | ||||
-rw-r--r-- | asn1/m3ap/packet-m3ap-template.c | 22 |
2 files changed, 30 insertions, 4 deletions
diff --git a/asn1/m3ap/m3ap.cnf b/asn1/m3ap/m3ap.cnf index 64410d3e1a..dc7d9e8f32 100644 --- a/asn1/m3ap/m3ap.cnf +++ b/asn1/m3ap/m3ap.cnf @@ -136,7 +136,17 @@ ProtocolIE-Field/value ie_field_value return offset; tvb_len = tvb_reported_length(parameter_tvb); - proto_tree_add_item(tree, hf_m3ap_IPAddress, parameter_tvb, 0, tvb_len, ENC_NA); + switch (tvb_len) { + case 4: + proto_tree_add_item(tree, hf_m3ap_IPAddress_v4, parameter_tvb, 0, tvb_len, ENC_NA); + break; + case 6: + proto_tree_add_item(tree, hf_m3ap_IPAddress_v6, parameter_tvb, 0, tvb_len, ENC_NA); + break; + default: + proto_tree_add_expert(tree, actx->pinfo, &ei_m3ap_invalid_ip_address_len, parameter_tvb, 0, tvb_len); + break; + } #.END #.FN_BODY Absolute-Time-ofMBMS-Data VAL_PTR = ¶meter_tvb diff --git a/asn1/m3ap/packet-m3ap-template.c b/asn1/m3ap/packet-m3ap-template.c index 9472a6d405..98cceefbc3 100644 --- a/asn1/m3ap/packet-m3ap-template.c +++ b/asn1/m3ap/packet-m3ap-template.c @@ -29,6 +29,7 @@ #include <epan/strutil.h> #include <epan/asn1.h> #include <epan/sctpppids.h> +#include <epan/expert.h> #include "packet-ber.h" #include "packet-per.h" @@ -53,7 +54,8 @@ static dissector_handle_t m3ap_handle=NULL; static int proto_m3ap = -1; static int hf_m3ap_Absolute_Time_ofMBMS_Data_value = -1; -static int hf_m3ap_IPAddress = -1; +static int hf_m3ap_IPAddress_v4 = -1; +static int hf_m3ap_IPAddress_v6 = -1; #include "packet-m3ap-hf.c" @@ -62,6 +64,8 @@ static int ett_m3ap = -1; #include "packet-m3ap-ett.c" +static expert_field ei_m3ap_invalid_ip_address_len = EI_INIT; + enum{ INITIATING_MESSAGE, SUCCESSFUL_OUTCOME, @@ -144,8 +148,13 @@ void proto_register_m3ap(void) { FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL } }, - { &hf_m3ap_IPAddress, - { "IPAddress", "m3ap.IPAddress", + { &hf_m3ap_IPAddress_v4, + { "IPAddress", "m3ap.IPAddress_v4", + FT_IPv4, BASE_NONE, NULL, 0, + NULL, HFILL } + }, + { &hf_m3ap_IPAddress_v6, + { "IPAddress", "m3ap.IPAddress_v6", FT_IPv6, BASE_NONE, NULL, 0, NULL, HFILL } }, @@ -159,12 +168,19 @@ void proto_register_m3ap(void) { #include "packet-m3ap-ettarr.c" }; + expert_module_t* expert_m3ap; + + static ei_register_info ei[] = { + { &ei_m3ap_invalid_ip_address_len, { "m3ap.invalid_ip_address_len", PI_MALFORMED, PI_ERROR, "Invalid IP address length", EXPFILL }} + }; /* Register protocol */ proto_m3ap = proto_register_protocol(PNAME, PSNAME, PFNAME); /* Register fields and subtrees */ proto_register_field_array(proto_m3ap, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_m3ap = expert_register_protocol(proto_m3ap); + expert_register_field_array(expert_m3ap, ei, array_length(ei)); /* Register dissector tables */ m3ap_ies_dissector_table = register_dissector_table("m3ap.ies", "M3AP-PROTOCOL-IES", FT_UINT32, BASE_DEC, DISSECTOR_TABLE_ALLOW_DUPLICATE); |