diff options
author | Michael Tüxen <tuexen@fh-muenster.de> | 2007-01-29 20:44:59 +0000 |
---|---|---|
committer | Michael Tüxen <tuexen@fh-muenster.de> | 2007-01-29 20:44:59 +0000 |
commit | ed692e1c8a5238ef26ef80b686d4fe0a2a4e8f09 (patch) | |
tree | 71bb4109057efded18a8f71b3909006b80ab3c38 /gtk | |
parent | 063621f11ba5c3c05514be94bd03865096b911b5 (diff) |
Improve the handling of INIT/ABORT mesage pairs.
svn path=/trunk/; revision=20608
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/sctp_assoc_analyse.c | 107 | ||||
-rw-r--r-- | gtk/sctp_stat.c | 16 | ||||
-rw-r--r-- | gtk/sctp_stat.h | 2 | ||||
-rw-r--r-- | gtk/sctp_stat_dlg.c | 16 |
4 files changed, 56 insertions, 85 deletions
diff --git a/gtk/sctp_assoc_analyse.c b/gtk/sctp_assoc_analyse.c index 74daff142e..06e0195265 100644 --- a/gtk/sctp_assoc_analyse.c +++ b/gtk/sctp_assoc_analyse.c @@ -372,12 +372,14 @@ sctp_set_filter (GtkButton *button _U_, struct sctp_analyse* u_data) selected_stream->port1, selected_stream->port2, selected_stream->verification_tag1, - selected_stream->verification_tag2, + /*selected_stream->verification_tag2,*/ + selected_stream->initiate_tag, selected_stream->verification_tag2, selected_stream->port2, selected_stream->port1, selected_stream->verification_tag2, - selected_stream->verification_tag1, + /*selected_stream->verification_tag1,*/ + selected_stream->initiate_tag, selected_stream->verification_tag1); filter_string = f_string; } @@ -840,18 +842,18 @@ static void sctp_analyse_cb(struct sctp_analyse* u_data, gboolean ext) guint16 srcport; guint8* ip_dst; guint16 dstport; - GList *list, *srclist, *dstlist; + GList *list, *framelist; dfilter_t *sfcode; capture_file *cf; epan_dissect_t *edt; gint err; gchar *err_info; - gboolean frame_matched; + gboolean frame_matched, frame_found = FALSE;; frame_data *fdata; gchar filter_text[256]; sctp_assoc_info_t* assoc = NULL; - address *src, *dst; int i; + guint32 *fn; //frame_number strcpy(filter_text,"sctp"); if (!dfilter_compile(filter_text, &sfcode)) { @@ -899,91 +901,40 @@ static void sctp_analyse_cb(struct sctp_analyse* u_data, gboolean ext) while (list) { assoc = (sctp_assoc_info_t*)(list->data); - if (assoc->port1 == srcport && assoc->port2 == dstport) - { - srclist = g_list_first(assoc->addr1); - while(srclist) - { - src = (address *)(srclist->data); - if (*src->data == *ip_src) - { - dstlist = g_list_first(assoc->addr2); - while(dstlist) - { - dst = (address *)(dstlist->data); - if (*dst->data == *ip_dst) - { - u_data->assoc = assoc; - u_data->assoc->addr_chunk_count = assoc->addr_chunk_count; - static_assoc.addr_chunk_count = assoc->addr_chunk_count; - static_assoc.port1 = assoc->port1; - static_assoc.port2 = assoc->port2; - for (i=0; i<NUM_CHUNKS; i++) - { - static_assoc.chunk_count[i] = assoc->chunk_count[i]; - static_assoc.ep1_chunk_count[i] = assoc->ep1_chunk_count[i]; - static_assoc.ep2_chunk_count[i] = assoc->ep2_chunk_count[i]; - } - if (ext == FALSE) - create_analyse_window(u_data); - return; - } - else - dstlist = g_list_next(dstlist); - } - } - else - srclist = g_list_next(srclist); - } - if (assoc->port2 != assoc->port1) + framelist = g_list_first(assoc->frame_numbers); + while(framelist) + { + fn = (guint32 *)framelist->data; + if (*fn == fdata->num) { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Assoc not found!"); - return; + frame_found = TRUE; + break; } + framelist = g_list_next(framelist); } - if (assoc->port2 == srcport && assoc->port1 == dstport) + if (frame_found) { - srclist = g_list_first(assoc->addr2); - while(srclist) + u_data->assoc = assoc; + u_data->assoc->addr_chunk_count = assoc->addr_chunk_count; + static_assoc.addr_chunk_count = assoc->addr_chunk_count; + static_assoc.port1 = assoc->port1; + static_assoc.port2 = assoc->port2; + for (i=0; i<NUM_CHUNKS; i++) { - src = (address *)(srclist->data); - if (*src->data == *ip_src) - { - dstlist = g_list_first(assoc->addr1); - while(dstlist) - { - dst = (address *)(dstlist->data); - if (*dst->data == *ip_dst) - { - u_data->assoc = assoc; - u_data->assoc->addr_chunk_count = assoc->addr_chunk_count; - static_assoc.addr_chunk_count = assoc->addr_chunk_count; - static_assoc.port1 = assoc->port1; - static_assoc.port2 = assoc->port2; - for (i=0; i<NUM_CHUNKS; i++) - { - static_assoc.chunk_count[i] = assoc->chunk_count[i]; - static_assoc.ep1_chunk_count[i] = assoc->ep1_chunk_count[i]; - static_assoc.ep2_chunk_count[i] = assoc->ep2_chunk_count[i]; - } - if (ext == FALSE) - create_analyse_window(u_data); - return; - } - else - dstlist = g_list_next(dstlist); - } - } - else - srclist = g_list_next(srclist); + static_assoc.chunk_count[i] = assoc->chunk_count[i]; + static_assoc.ep1_chunk_count[i] = assoc->ep1_chunk_count[i]; + static_assoc.ep2_chunk_count[i] = assoc->ep2_chunk_count[i]; } - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Assoc not found!"); + if (ext == FALSE) + create_analyse_window(u_data); return; } else list = g_list_next(list); } + if (!frame_found) + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Assoc not found!"); } void sctp_set_assoc_filter(void) diff --git a/gtk/sctp_stat.c b/gtk/sctp_stat.c index b29f68e9a9..ff0d5bebaf 100644 --- a/gtk/sctp_stat.c +++ b/gtk/sctp_stat.c @@ -303,6 +303,12 @@ static gint sctp_assoc_vtag_cmp(gconstpointer aa, gconstpointer bb) if (a == NULL || b == NULL) return(ASSOC_NOT_FOUND); + if ((a->port1 == b->port1) && + (a->port2 == b->port2) && + (a->verification_tag1 == b->verification_tag1) && a->verification_tag1==0 && a->initiate_tag != 0 && + (a->initiate_tag != b->initiate_tag )) + return(ASSOC_NOT_FOUND); //two INITs that belong to different assocs + /* assoc known*/ if ((a->port1 == b->port1) && (a->port2 == b->port2) && @@ -591,6 +597,7 @@ static sctp_assoc_info_t * find_assoc(sctp_tmp_info_t * needle) while (list) { cmp=sctp_assoc_vtag_cmp(needle, (sctp_assoc_info_t*)(list->data)); + /*if (cmp==ASSOC_NOT_FOUND) { cmp=sctp_assoc_address_cmp(needle, (sctp_assoc_info_t*)(list->data)); @@ -827,6 +834,14 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v tmp_info.verification_tag2 = 0; } tmp_info.n_tvbs = 0; + if (tvb_get_guint8(sctp_info->tvb[0],0) == SCTP_INIT_CHUNK_ID) + { + tmp_info.initiate_tag = tvb_get_ntohl(sctp_info->tvb[0], 4); + } + else + { + tmp_info.initiate_tag = 0; + } info = find_assoc(&tmp_info); if (!info) @@ -852,6 +867,7 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v info->port2 = tmp_info.port2; info->verification_tag1 = tmp_info.verification_tag1; info->verification_tag2 = tmp_info.verification_tag2; + info->initiate_tag = tmp_info.initiate_tag; info->n_tvbs = tmp_info.n_tvbs; info->init = FALSE; info->initack = FALSE; diff --git a/gtk/sctp_stat.h b/gtk/sctp_stat.h index 49e1a6bf41..8ab7cf641a 100644 --- a/gtk/sctp_stat.h +++ b/gtk/sctp_stat.h @@ -100,6 +100,7 @@ typedef struct _sctp_tmp_info { guint16 port2; guint32 verification_tag1; guint32 verification_tag2; + guint32 initiate_tag; guint32 n_tvbs; } sctp_tmp_info_t; @@ -136,6 +137,7 @@ typedef struct _sctp_assoc_info { guint16 port2; guint32 verification_tag1; guint32 verification_tag2; + guint32 initiate_tag; guint32 n_tvbs; GList *addr1; GList *addr2; diff --git a/gtk/sctp_stat_dlg.c b/gtk/sctp_stat_dlg.c index 18dc0d36fa..435c86f5c1 100644 --- a/gtk/sctp_stat_dlg.c +++ b/gtk/sctp_stat_dlg.c @@ -187,14 +187,15 @@ sctp_stat_on_select_row(GtkCList *clist, gint row, gint column _U_, port1=atoi(text[0]); gtk_clist_get_text(GTK_CLIST(clist), row, 1, text); port2=atoi(text[0]); - gtk_clist_get_text(GTK_CLIST(clist), row, 2, text); - packets=atoi(text[0]); + gtk_clist_get_text(GTK_CLIST(clist), row, 4, text); - checksum=atoi(text[0]); + packets=atoi(text[0]); gtk_clist_get_text(GTK_CLIST(clist), row, 5, text); + checksum=atoi(text[0]); + gtk_clist_get_text(GTK_CLIST(clist), row, 7, text); data_chunks=atoi(text[0]); - gtk_clist_get_text(GTK_CLIST(clist), row, 6, text); + gtk_clist_get_text(GTK_CLIST(clist), row, 8, text); data_bytes=atoi(text[0]); list = g_list_first(sctp_assocs->assoc_info_list); @@ -254,12 +255,14 @@ sctp_stat_on_filter (GtkButton *button _U_, gpointer user_data _U_) selected_stream->port1, selected_stream->port2, selected_stream->verification_tag1, - selected_stream->verification_tag2, + /*selected_stream->verification_tag2,*/ + selected_stream->initiate_tag, selected_stream->verification_tag2, selected_stream->port2, selected_stream->port1, selected_stream->verification_tag2, - selected_stream->verification_tag1, + /*selected_stream->verification_tag1,*/ + selected_stream->initiate_tag, selected_stream->verification_tag1); filter_string = f_string; } @@ -474,7 +477,6 @@ gtk_sctpstat_dlg(void) gtk_clist_set_column_width (GTK_CLIST (clist), 5, 100); gtk_clist_set_column_width (GTK_CLIST (clist), 6, 100); - gtk_clist_set_column_justification(GTK_CLIST(clist), 0, GTK_JUSTIFY_CENTER); gtk_clist_set_column_justification(GTK_CLIST(clist), 1, GTK_JUSTIFY_CENTER); gtk_clist_set_column_justification(GTK_CLIST(clist), 2, GTK_JUSTIFY_CENTER); |