aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/asn1/h248
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2016-06-12 12:28:02 -0400
committerAnders Broman <a.broman58@gmail.com>2016-06-13 17:06:38 +0000
commit04b82a7dc971597be958ba902bcf51dc32189305 (patch)
tree2b096991993a4070df224ca22b440eba94f037c3 /epan/dissectors/asn1/h248
parente2e84563eeb1e7b9add817d2b0c39656fab297d5 (diff)
Convert AT_SS7PC to a "dissector address type"
The formatting of the address type is determined by a preference in packet-mtp3.c, so just make MTP3 register the address type. Use address_type_get_by_name in other dissectors (and export_pdu) to use the address type. Change-Id: Ifb32d7de27aeaa23cee8e803e25ffb3c905547b5 Reviewed-on: https://code.wireshark.org/review/15856 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/asn1/h248')
-rw-r--r--epan/dissectors/asn1/h248/packet-h248-template.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/epan/dissectors/asn1/h248/packet-h248-template.c b/epan/dissectors/asn1/h248/packet-h248-template.c
index b8d23aacb9..229fe4dc39 100644
--- a/epan/dissectors/asn1/h248/packet-h248-template.c
+++ b/epan/dissectors/asn1/h248/packet-h248-template.c
@@ -31,6 +31,7 @@
#include <epan/asn1.h>
#include <epan/prefs.h>
#include <epan/exported_pdu.h>
+#include <epan/address_types.h>
#include "packet-alcap.h"
#include "packet-ber.h"
#include "packet-tpkt.h"
@@ -104,6 +105,8 @@ static expert_field ei_h248_octet_string_expected = EI_INIT;
static dissector_table_t subdissector_table;
+static int ss7pc_address_type = -1;
+
/* Gateway Control Protocol -- Context Tracking */
const value_string gcp_cmd_type[] = {
@@ -199,14 +202,16 @@ gcp_msg_t* gcp_msg(packet_info* pinfo, int o, gboolean keep_persistent_data) {
memcpy((guint8*)&(m->hi_addr),hi_addr->data,4);
memcpy((guint8*)&(m->lo_addr),lo_addr->data,4);
break;
- case AT_SS7PC:
- m->hi_addr = mtp3_pc_hash((const mtp3_addr_pc_t *)hi_addr->data);
- m->lo_addr = mtp3_pc_hash((const mtp3_addr_pc_t *)lo_addr->data);
- break;
default:
- /* XXX: heuristic and error prone */
- m->hi_addr = g_str_hash(address_to_str(wmem_packet_scope(), hi_addr));
- m->lo_addr = g_str_hash(address_to_str(wmem_packet_scope(), lo_addr));
+ if (lo_addr->type == ss7pc_address_type) {
+ m->hi_addr = mtp3_pc_hash((const mtp3_addr_pc_t *)hi_addr->data);
+ m->lo_addr = mtp3_pc_hash((const mtp3_addr_pc_t *)lo_addr->data);
+ }
+ else {
+ /* XXX: heuristic and error prone */
+ m->hi_addr = g_str_hash(address_to_str(wmem_packet_scope(), hi_addr));
+ m->lo_addr = g_str_hash(address_to_str(wmem_packet_scope(), lo_addr));
+ }
break;
}
@@ -2437,6 +2442,7 @@ void proto_reg_handoff_h248(void) {
dissector_add_uint("tcp.port", tcp_port, h248_tpkt_handle);
}
+ ss7pc_address_type = address_type_get_by_name("AT_SS7PC");
exported_pdu_tap = find_tap_id(EXPORT_PDU_TAP_NAME_LAYER_7);
}