Improve the handling of INIT/ABORT mesage pairs.
svn path=/trunk/; revision=20608
This commit is contained in:
parent
063621f11b
commit
ed692e1c8a
|
@ -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)
|
||||
framelist = g_list_first(assoc->frame_numbers);
|
||||
while(framelist)
|
||||
{
|
||||
srclist = g_list_first(assoc->addr1);
|
||||
while(srclist)
|
||||
fn = (guint32 *)framelist->data;
|
||||
if (*fn == fdata->num)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue