diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2017-05-29 21:49:26 +0200 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2017-06-02 12:13:48 +0000 |
commit | f434820705b7875e5eaab1bba77c0264b1eb1bd6 (patch) | |
tree | adef7c3fba3072ceadeadacff3a8a5efed44a9be /epan/dissectors/asn1/tcap | |
parent | 6f255da358f9213f89c7c4001229e498f19e820e (diff) |
TCAP: fix SRT analysis
When reviewing the code, the following issues were identified:
- otid/dtid on 3 bytes were not stored
- when receiving the first continue from dest, the TC_END hash entry was
created with the source tid / address instead of destination ones
- when receiving the first continue from src, the logic could prevent
the creation of the hash entry
Bug: 13739
Change-Id: If4ee70f0fa69f5ff74fdf75f3a741102baa0121a
Reviewed-on: https://code.wireshark.org/review/21780
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/asn1/tcap')
-rw-r--r-- | epan/dissectors/asn1/tcap/packet-tcap-template.c | 17 | ||||
-rw-r--r-- | epan/dissectors/asn1/tcap/tcap.cnf | 6 |
2 files changed, 18 insertions, 5 deletions
diff --git a/epan/dissectors/asn1/tcap/packet-tcap-template.c b/epan/dissectors/asn1/tcap/packet-tcap-template.c index 24e3f58b11..576f78da9d 100644 --- a/epan/dissectors/asn1/tcap/packet-tcap-template.c +++ b/epan/dissectors/asn1/tcap/packet-tcap-template.c @@ -1036,6 +1036,7 @@ tcaphash_cont_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *pi; proto_item *stat_item=NULL; proto_tree *stat_tree=NULL; + gboolean use_dst = TRUE; #ifdef DEBUG_TCAPSRT dbg(51,"src %s srcTid %lx dst %s dstTid %lx ", address_to_str(wmem_packet_scope(), &pinfo->src), p_tcapsrt_info->src_tid, address_to_str(wmem_packet_scope(), &pinfo->dst), p_tcapsrt_info->dst_tid); @@ -1091,11 +1092,13 @@ tcaphash_cont_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, #endif p_tcaphash_begincall = find_tcaphash_begin(&tcaphash_begin_key, pinfo, FALSE); if(!p_tcaphash_begincall){ + try_src: /* can this actually happen? */ #ifdef DEBUG_TCAPSRT dbg(12,"BNotFound trying stid,src"); #endif /* Do we have a continue from the same source? (stid,src) */ + use_dst = FALSE; tcaphash_begin_key.tid = p_tcapsrt_info->src_tid; if (pinfo->src.type == ss7pc_address_type && pinfo->dst.type == ss7pc_address_type) { @@ -1128,21 +1131,21 @@ tcaphash_cont_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, create_tcaphash_cont(&tcaphash_cont_key, p_tcaphash_begincall->context); - /* Create END for (stid,src) */ - tcaphash_end_key.tid = p_tcapsrt_info->src_tid; + /* Create END for (dtid,dst) or (stid,src) */ + tcaphash_end_key.tid = use_dst ? p_tcapsrt_info->dst_tid : p_tcapsrt_info->src_tid; if (pinfo->src.type == ss7pc_address_type && pinfo->dst.type == ss7pc_address_type) { /* We have MTP3 PCs (so we can safely do this cast) */ - tcaphash_end_key.pc_hash = mtp3_pc_hash((const mtp3_addr_pc_t *)pinfo->src.data); + tcaphash_end_key.pc_hash = mtp3_pc_hash((const mtp3_addr_pc_t *)(use_dst ? pinfo->dst.data : pinfo->src.data)); } else { /* Don't have MTP3 PCs (have SCCP GT ?) */ - tcaphash_end_key.pc_hash = g_str_hash(address_to_str(wmem_packet_scope(), &pinfo->src)); + tcaphash_end_key.pc_hash = g_str_hash(address_to_str(wmem_packet_scope(), use_dst ? &pinfo->dst : &pinfo->src)); } tcaphash_end_key.hashKey=tcaphash_end_calchash(&tcaphash_end_key); #ifdef DEBUG_TCAPSRT dbg(10,"New Ekey %lx ",tcaphash_end_key.hashKey); - dbg(51,"addr %s ", address_to_str(wmem_packet_scope(), &pinfo->src)); + dbg(51,"addr %s ", address_to_str(wmem_packet_scope(), use_dst ? &pinfo->dst : &pinfo->src)); dbg(51,"Tid %lx ",tcaphash_end_key.tid); dbg(11,"Frame reqlink #%u ", pinfo->num); #endif @@ -1153,6 +1156,10 @@ tcaphash_cont_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, #ifdef DEBUG_TCAPSRT dbg(12,"BnotFound "); #endif + if (use_dst) { + /* make another try with src tid / address */ + goto try_src; + } } /* begin found */ } /* cont found */ /* display tcap session, if available */ diff --git a/epan/dissectors/asn1/tcap/tcap.cnf b/epan/dissectors/asn1/tcap/tcap.cnf index 217048ab82..8898561d4a 100644 --- a/epan/dissectors/asn1/tcap/tcap.cnf +++ b/epan/dissectors/asn1/tcap/tcap.cnf @@ -156,6 +156,9 @@ ABRT-apdu/_untag/user-information abrt_user_information case 2: gp_tcapsrt_info->src_tid=tvb_get_ntohs(parameter_tvb, 0); break; + case 3: + gp_tcapsrt_info->src_tid=tvb_get_ntoh24(parameter_tvb, 0); + break; case 4: gp_tcapsrt_info->src_tid=tvb_get_ntohl(parameter_tvb, 0); break; @@ -201,6 +204,9 @@ ABRT-apdu/_untag/user-information abrt_user_information case 2: gp_tcapsrt_info->dst_tid=tvb_get_ntohs(parameter_tvb, 0); break; + case 3: + gp_tcapsrt_info->dst_tid=tvb_get_ntoh24(parameter_tvb, 0); + break; case 4: gp_tcapsrt_info->dst_tid=tvb_get_ntohl(parameter_tvb, 0); break; |