aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2019-08-20 13:49:59 +0200
committerAnders Broman <a.broman58@gmail.com>2019-08-20 13:12:10 +0000
commit8b8ce52abcf98f44bea025809c75f22224825ecb (patch)
treeb45b265896f8a35721eef15bffc5767f2db08868
parent6cf81c5633c8d04323f6cb9735c5710493ee6eee (diff)
SCTP: Make association amalysis a prference defaulting to FALSE.
Association analysis causes long loops if there is a lot off associations or IMIT ABORTS. On a 679K packets trace loading with amalysis takes 3.31.660 without 0.3.275. The culprit is the for loop in find_assoc_index(). Change-Id: I07ae0e826c08aded3eb0e7dc3474dcf5cdd556f9 Reviewed-on: https://code.wireshark.org/review/34333 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--epan/dissectors/packet-sctp.c75
1 files changed, 43 insertions, 32 deletions
diff --git a/epan/dissectors/packet-sctp.c b/epan/dissectors/packet-sctp.c
index 5826ac0b6c..baa07f043e 100644
--- a/epan/dissectors/packet-sctp.c
+++ b/epan/dissectors/packet-sctp.c
@@ -457,11 +457,12 @@ static const value_string sctp_payload_proto_id_values[] = {
#define ASSOC_NOT_FOUND 5
/* Default values for preferences */
-static gboolean show_port_numbers = TRUE;
-static gint sctp_checksum = SCTP_CHECKSUM_NONE;
-static gboolean enable_tsn_analysis = TRUE;
-static gboolean enable_ulp_dissection = TRUE;
-static gboolean use_reassembly = TRUE;
+static gboolean show_port_numbers = TRUE;
+static gint sctp_checksum = SCTP_CHECKSUM_NONE;
+static gboolean enable_tsn_analysis = TRUE;
+static gboolean enable_association_indexing = FALSE;
+static gboolean enable_ulp_dissection = TRUE;
+static gboolean use_reassembly = TRUE;
/* FIXME
static gboolean show_chunk_types = TRUE;
*/
@@ -4582,38 +4583,44 @@ dissect_sctp_chunks(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_i
else
sctp_info.incomplete = TRUE;
}
-
- tmpinfo.assoc_index = -1;
- tmpinfo.sport = sctp_info.sport;
- tmpinfo.dport = sctp_info.dport;
- tmpinfo.vtag_reflected = FALSE;
- if (tvb_get_guint8(chunk_tvb, CHUNK_TYPE_OFFSET) == SCTP_ABORT_CHUNK_ID) {
- if ((tvb_get_guint8(chunk_tvb, CHUNK_FLAGS_OFFSET) & SCTP_ABORT_CHUNK_T_BIT) != 0) {
- tmpinfo.vtag_reflected = TRUE;
+ if (enable_association_indexing) {
+ tmpinfo.assoc_index = -1;
+ tmpinfo.sport = sctp_info.sport;
+ tmpinfo.dport = sctp_info.dport;
+ tmpinfo.vtag_reflected = FALSE;
+ if (tvb_get_guint8(chunk_tvb, CHUNK_TYPE_OFFSET) == SCTP_ABORT_CHUNK_ID) {
+ if ((tvb_get_guint8(chunk_tvb, CHUNK_FLAGS_OFFSET) & SCTP_ABORT_CHUNK_T_BIT) != 0) {
+ tmpinfo.vtag_reflected = TRUE;
+ }
}
- }
- if (tvb_get_guint8(chunk_tvb, CHUNK_TYPE_OFFSET) == SCTP_SHUTDOWN_COMPLETE_CHUNK_ID) {
- if ((tvb_get_guint8(chunk_tvb, CHUNK_FLAGS_OFFSET) & SCTP_SHUTDOWN_COMPLETE_CHUNK_T_BIT) != 0){
- tmpinfo.vtag_reflected = TRUE;
+ if (tvb_get_guint8(chunk_tvb, CHUNK_TYPE_OFFSET) == SCTP_SHUTDOWN_COMPLETE_CHUNK_ID) {
+ if ((tvb_get_guint8(chunk_tvb, CHUNK_FLAGS_OFFSET) & SCTP_SHUTDOWN_COMPLETE_CHUNK_T_BIT) != 0) {
+ tmpinfo.vtag_reflected = TRUE;
+ }
}
- }
- if (tmpinfo.vtag_reflected) {
- tmpinfo.verification_tag2 = sctp_info.verification_tag;
- tmpinfo.verification_tag1 = 0;
- } else {
- tmpinfo.verification_tag1 = sctp_info.verification_tag;
- tmpinfo.verification_tag2 = 0;
- }
- if (tvb_get_guint8(chunk_tvb, CHUNK_TYPE_OFFSET) == SCTP_INIT_CHUNK_ID) {
- tmpinfo.initiate_tag = tvb_get_ntohl(sctp_info.tvb[0], 4);
+ if (tmpinfo.vtag_reflected) {
+ tmpinfo.verification_tag2 = sctp_info.verification_tag;
+ tmpinfo.verification_tag1 = 0;
+ }
+ else {
+ tmpinfo.verification_tag1 = sctp_info.verification_tag;
+ tmpinfo.verification_tag2 = 0;
+ }
+ if (tvb_get_guint8(chunk_tvb, CHUNK_TYPE_OFFSET) == SCTP_INIT_CHUNK_ID) {
+ tmpinfo.initiate_tag = tvb_get_ntohl(sctp_info.tvb[0], 4);
+ }
+ else {
+ tmpinfo.initiate_tag = 0;
+ }
+
+ id_dir = find_assoc_index(&tmpinfo, PINFO_FD_VISITED(pinfo));
+ sctp_info.assoc_index = id_dir.assoc_index;
+ sctp_info.direction = id_dir.direction;
} else {
- tmpinfo.initiate_tag = 0;
+ sctp_info.assoc_index = -1;
+ sctp_info.direction = ASSOC_NOT_FOUND;
}
- id_dir = find_assoc_index(&tmpinfo, PINFO_FD_VISITED(pinfo));
- sctp_info.assoc_index = id_dir.assoc_index;
- sctp_info.direction = id_dir.direction;
-
/* call dissect_sctp_chunk for the actual work */
if (dissect_sctp_chunk(chunk_tvb, pinfo, tree, sctp_tree, ha, !encapsulated) && (tree)) {
proto_item_set_len(sctp_item, offset - last_offset + DATA_CHUNK_HEADER_LENGTH);
@@ -5125,6 +5132,10 @@ proto_register_sctp(void)
"Enable TSN analysis",
"Match TSNs and their SACKs",
&enable_tsn_analysis);
+ prefs_register_bool_preference(sctp_module, "association_index",
+ "Enable Association indexing(Can be CPU intense)",
+ "Match verification tags(CPU intense)",
+ &enable_association_indexing);
prefs_register_bool_preference(sctp_module, "ulp_dissection",
"Dissect upper layer protocols",
"Dissect upper layer protocols",