aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss@ulticom.com>2012-06-01 21:18:59 +0000
committerJeff Morriss <jeff.morriss@ulticom.com>2012-06-01 21:18:59 +0000
commitd4fdd6ad524de33ce1bc5b356982cddbf4e2e828 (patch)
treedc516f0e5ad0d279e5e8e80a7971e2f229956733
parentc408151a80bbe3e6d46039cd20e2437151788600 (diff)
Only propose decoding PPID 0 if that PPID is in the currently-selected frame.
(I used PPID 0xffffffff as an end-of-list marker so that PPID can no longer be used in this dialog; if someone starts using that PPID then we'll have to put a count of PPIDs in pinfo.) svn path=/trunk/; revision=42991
-rw-r--r--epan/dissectors/packet-sctp.c26
-rw-r--r--epan/packet_info.h6
-rw-r--r--ui/gtk/decode_as_dlg.c41
3 files changed, 38 insertions, 35 deletions
diff --git a/epan/dissectors/packet-sctp.c b/epan/dissectors/packet-sctp.c
index 537b717457..e03bf4138f 100644
--- a/epan/dissectors/packet-sctp.c
+++ b/epan/dissectors/packet-sctp.c
@@ -2414,7 +2414,7 @@ fragment_reassembly(tvbuff_t *tvb, sctp_fragment* fragment,
frag_i->frame_num, offset, offset + frag_i->len - 1, frag_i->len);
offset += frag_i->len;
- mark_frame_as_depended_upon(pinfo, frag_i->frame_num);
+ mark_frame_as_depended_upon(pinfo, frag_i->frame_num);
}
for (frag_i = msg->fragments;
@@ -2426,7 +2426,7 @@ fragment_reassembly(tvbuff_t *tvb, sctp_fragment* fragment,
frag_i->frame_num, offset, offset + frag_i->len - 1, frag_i->len);
offset += frag_i->len;
- mark_frame_as_depended_upon(pinfo, frag_i->frame_num);
+ mark_frame_as_depended_upon(pinfo, frag_i->frame_num);
}
} else {
for (frag_i = find_fragment(message->begin, stream_id, stream_seq_num);
@@ -2438,7 +2438,7 @@ fragment_reassembly(tvbuff_t *tvb, sctp_fragment* fragment,
frag_i->frame_num, offset, offset + frag_i->len - 1, frag_i->len);
offset += frag_i->len;
- mark_frame_as_depended_upon(pinfo, frag_i->frame_num);
+ mark_frame_as_depended_upon(pinfo, frag_i->frame_num);
}
}
@@ -2760,14 +2760,12 @@ dissect_data_chunk(tvbuff_t *chunk_tvb,
payload_proto_id = tvb_get_ntohl(chunk_tvb, DATA_CHUNK_PAYLOAD_PROTOCOL_ID_OFFSET);
- /* insert the PPID in the pinfo structure if it is non-zero, not already there and there is still room */
- if (payload_proto_id) {
- for(number_of_ppid = 0; number_of_ppid < MAX_NUMBER_OF_PPIDS; number_of_ppid++)
- if ((pinfo->ppids[number_of_ppid] == 0) || (pinfo->ppids[number_of_ppid] == payload_proto_id))
- break;
- if ((number_of_ppid < MAX_NUMBER_OF_PPIDS) && (pinfo->ppids[number_of_ppid] == 0))
- pinfo->ppids[number_of_ppid] = payload_proto_id;
- }
+ /* insert the PPID in the pinfo structure if it is not already there and there is still room */
+ for(number_of_ppid = 0; number_of_ppid < MAX_NUMBER_OF_PPIDS; number_of_ppid++)
+ if ((pinfo->ppids[number_of_ppid] == LAST_PPID) || (pinfo->ppids[number_of_ppid] == payload_proto_id))
+ break;
+ if ((number_of_ppid < MAX_NUMBER_OF_PPIDS) && (pinfo->ppids[number_of_ppid] == LAST_PPID))
+ pinfo->ppids[number_of_ppid] = payload_proto_id;
e_bit = tvb_get_guint8(chunk_tvb, CHUNK_FLAGS_OFFSET) & SCTP_DATA_CHUNK_E_BIT;
b_bit = tvb_get_guint8(chunk_tvb, CHUNK_FLAGS_OFFSET) & SCTP_DATA_CHUNK_B_BIT;
@@ -4019,6 +4017,7 @@ static void
dissect_sctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint16 source_port, destination_port;
+ guint number_of_ppid;
/* Extract the common header */
source_port = tvb_get_ntohs(tvb, SOURCE_PORT_OFFSET);
@@ -4035,7 +4034,10 @@ dissect_sctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Clear entries in Info column on summary display */
col_set_str(pinfo->cinfo, COL_INFO, "");
- memset(&pinfo->ppids, 0, sizeof(pinfo->ppids));
+
+ for(number_of_ppid = 0; number_of_ppid < MAX_NUMBER_OF_PPIDS; number_of_ppid++) {
+ pinfo->ppids[number_of_ppid] = LAST_PPID;
+ }
/* The tvb array in struct _sctp_info is huge: currently 2k pointers.
* We know (by the value of 'number_of_tvbs') which of these entries have
diff --git a/epan/packet_info.h b/epan/packet_info.h
index 49f444e76f..5a52555788 100644
--- a/epan/packet_info.h
+++ b/epan/packet_info.h
@@ -174,9 +174,11 @@ typedef struct _packet_info {
gboolean gssapi_data_encrypted;
guint32 ppid; /* SCTP PPI of current DATA chunk */
+/* This is a valid PPID, but we use it to mark the end of the list */
+#define LAST_PPID 0xffffffff
guint32 ppids[MAX_NUMBER_OF_PPIDS]; /* The first NUMBER_OF_PPIDS PPIDS which are present
- * in the SCTP packet
- */
+ * in the SCTP packet
+ */
void *private_data; /* pointer to data passed from one dissector to another */
GHashTable *private_table; /* a hash table passed from one dissector to another */
/* TODO: Use emem_strbuf_t instead */
diff --git a/ui/gtk/decode_as_dlg.c b/ui/gtk/decode_as_dlg.c
index 6af95d0c9e..9bba61eba0 100644
--- a/ui/gtk/decode_as_dlg.c
+++ b/ui/gtk/decode_as_dlg.c
@@ -1305,19 +1305,18 @@ decode_add_ppid_combo_box (GtkWidget *page)
combo_box = ws_combo_box_new_text_and_pointer();
- g_snprintf(tmp, sizeof(tmp), "PPID (%u)", 0);
- ws_combo_box_append_text_and_pointer(GTK_COMBO_BOX(combo_box),
- tmp, GINT_TO_POINTER(E_DECODE_PPID));
- ws_combo_box_set_active(GTK_COMBO_BOX(combo_box), 0); /* default */
-
for(number_of_ppid = 0; number_of_ppid < MAX_NUMBER_OF_PPIDS; number_of_ppid++) {
- if (cfile.edt->pi.ppids[number_of_ppid] != 0) {
- g_snprintf(tmp, sizeof(tmp), "PPID (%u)", cfile.edt->pi.ppids[number_of_ppid]);
- ws_combo_box_append_text_and_pointer(GTK_COMBO_BOX(combo_box),
- tmp, GINT_TO_POINTER(E_DECODE_PPID + 1 + number_of_ppid));
- } else
- break;
+ if (cfile.edt->pi.ppids[number_of_ppid] != LAST_PPID) {
+ g_snprintf(tmp, sizeof(tmp), "PPID (%u)", cfile.edt->pi.ppids[number_of_ppid]);
+ ws_combo_box_append_text_and_pointer(GTK_COMBO_BOX(combo_box),
+ tmp, GINT_TO_POINTER(E_DECODE_PPID + 1 + number_of_ppid));
+ } else
+ break;
}
+
+ if (number_of_ppid)
+ ws_combo_box_set_active(GTK_COMBO_BOX(combo_box), 0); /* default */
+
g_object_set_data(G_OBJECT(page), E_COMBO_BOX_SRCDST, combo_box);
return(combo_box);
}
@@ -1703,18 +1702,18 @@ decode_sctp_update_ppid_combo_box(GtkWidget *w _U_, GtkWidget *page)
sctp_combo_box = g_object_get_data(G_OBJECT(page), E_COMBO_BOX_SRCDST);
ws_combo_box_clear_text_and_pointer(GTK_COMBO_BOX(sctp_combo_box));
- g_snprintf(tmp, sizeof(tmp), "PPID (%u)", 0);
- ws_combo_box_append_text_and_pointer(GTK_COMBO_BOX(sctp_combo_box), tmp, GINT_TO_POINTER(E_DECODE_PPID));
- ws_combo_box_set_active(GTK_COMBO_BOX(sctp_combo_box), 0); /* default */
-
for(number_of_ppid = 0; number_of_ppid < MAX_NUMBER_OF_PPIDS; number_of_ppid++) {
- if (cfile.edt->pi.ppids[number_of_ppid] != 0) {
- g_snprintf(tmp, sizeof(tmp), "PPID (%u)", cfile.edt->pi.ppids[number_of_ppid]);
- ws_combo_box_append_text_and_pointer(GTK_COMBO_BOX(sctp_combo_box),
- tmp, GINT_TO_POINTER(E_DECODE_PPID + 1 + number_of_ppid));
- }
+ if (cfile.edt->pi.ppids[number_of_ppid] != LAST_PPID) {
+ g_snprintf(tmp, sizeof(tmp), "PPID (%u)", cfile.edt->pi.ppids[number_of_ppid]);
+ ws_combo_box_append_text_and_pointer(GTK_COMBO_BOX(sctp_combo_box),
+ tmp, GINT_TO_POINTER(E_DECODE_PPID + 1 + number_of_ppid));
+ } else
+ break;
}
+ if (number_of_ppid)
+ ws_combo_box_set_active(GTK_COMBO_BOX(sctp_combo_box), 0); /* default */
+
g_object_set_data(G_OBJECT(page), E_PAGE_TABLE, "sctp.ppi");
sctp_store = g_object_get_data(G_OBJECT(G_OBJECT(decode_w)), "sctp_data");
@@ -1977,7 +1976,7 @@ decode_as_cb (GtkWidget * w _U_, gpointer user_data _U_)
GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
#endif
gtk_box_pack_start(GTK_BOX(button_vb), button, FALSE, FALSE, 0);
- gtk_widget_set_tooltip_text(button, "Open a dialog showing the current settings.\n"
+ gtk_widget_set_tooltip_text(button, "Open a dialog showing the current settings.\n"
"Note you need to select and press apply first to be able to save the current setting");
button = gtk_button_new_from_stock(GTK_STOCK_CLEAR);