summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruengeler <ruengeler@wireshark.org>2015-10-05 15:55:40 +0200
committerMichael Tüxen <tuexen@wireshark.org>2015-10-05 17:38:08 +0000
commitd52322efb3ab782871312950876803334ec018b9 (patch)
treea9049aa52e49c31f8d346ae2bcfe842694c2f776
parenta24eeb931ea90b1fe63019c4e07065089e236351 (diff)
downloadwireshark-d52322efb3ab782871312950876803334ec018b9.tar.gz
SCTP I-DATA support
Change-Id: I459942b9e3287d500dda517568252d4cb56d3216 Reviewed-on: https://code.wireshark.org/review/10802 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Petri-Dish: Michael Tüxen <tuexen@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Tüxen <tuexen@wireshark.org>
-rw-r--r--epan/dissectors/packet-sctp.c232
-rw-r--r--epan/dissectors/packet-sctp.h2
-rw-r--r--ui/gtk/sctp_chunk_stat.c12
-rw-r--r--ui/gtk/sctp_chunk_stat_dlg.c26
-rw-r--r--ui/gtk/sctp_graph_dlg.c4
-rw-r--r--ui/qt/sctp_graph_arwnd_dialog.cpp4
-rw-r--r--ui/qt/sctp_graph_byte_dialog.cpp6
-rw-r--r--ui/qt/sctp_graph_dialog.cpp14
-rw-r--r--ui/tap-sctp-analysis.c44
-rw-r--r--ui/tap-sctp-analysis.h26
10 files changed, 281 insertions, 89 deletions
diff --git a/epan/dissectors/packet-sctp.c b/epan/dissectors/packet-sctp.c
index 0a500b2be9..21720a7183 100644
--- a/epan/dissectors/packet-sctp.c
+++ b/epan/dissectors/packet-sctp.c
@@ -118,6 +118,9 @@ static int hf_data_chunk_tsn = -1;
static int hf_data_chunk_stream_id = -1;
static int hf_data_chunk_stream_seq_number = -1;
static int hf_data_chunk_payload_proto_id = -1;
+static int hf_idata_chunk_reserved = -1;
+static int hf_idata_chunk_mid = -1;
+static int hf_idata_chunk_fsn = -1;
static int hf_data_chunk_e_bit = -1;
static int hf_data_chunk_b_bit = -1;
@@ -323,6 +326,7 @@ static dissector_handle_t data_handle;
#define SCTP_SHUTDOWN_COMPLETE_CHUNK_ID 14
#define SCTP_AUTH_CHUNK_ID 15
#define SCTP_NR_SACK_CHUNK_ID 16
+#define SCTP_I_DATA_CHUNK_ID 0x40
#define SCTP_ASCONF_ACK_CHUNK_ID 0x80
#define SCTP_PKTDROP_CHUNK_ID 0x81
#define SCTP_RE_CONFIG_CHUNK_ID 0x82
@@ -349,6 +353,7 @@ static const value_string chunk_type_values[] = {
{ SCTP_SHUTDOWN_COMPLETE_CHUNK_ID, "SHUTDOWN_COMPLETE" },
{ SCTP_AUTH_CHUNK_ID, "AUTH" },
{ SCTP_NR_SACK_CHUNK_ID, "NR-SACK" },
+ { SCTP_I_DATA_CHUNK_ID, "I-DATA" },
{ SCTP_ASCONF_ACK_CHUNK_ID, "ASCONF_ACK" },
{ SCTP_PKTDROP_CHUNK_ID, "PKTDROP" },
{ SCTP_RE_CONFIG_CHUNK_ID, "RE_CONFIG" },
@@ -753,7 +758,10 @@ sctp_both_prompt(packet_info *pinfo, gchar *result)
static void
sctp_ppi_prompt1(packet_info *pinfo _U_, gchar* result)
{
- guint32 ppid = GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, proto_sctp, 0));
+ guint32 ppid;
+ void *tmp = p_get_proto_data(pinfo->pool, pinfo, proto_sctp, 0);
+
+ ppid = GPOINTER_TO_UINT(tmp);
if (ppid == LAST_PPID) {
g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "PPID (none)");
@@ -765,7 +773,10 @@ sctp_ppi_prompt1(packet_info *pinfo _U_, gchar* result)
static void
sctp_ppi_prompt2(packet_info *pinfo _U_, gchar* result)
{
- guint32 ppid = GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, proto_sctp, 1));
+ guint32 ppid;
+ void *tmp = p_get_proto_data(pinfo->pool, pinfo, proto_sctp, 1);
+
+ ppid = GPOINTER_TO_UINT(tmp);
if (ppid == LAST_PPID) {
g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "PPID (none)");
@@ -933,7 +944,7 @@ static void dissect_error_cause(tvbuff_t *, packet_info *, proto_tree *);
static void dissect_error_causes(tvbuff_t *, packet_info *, proto_tree *);
-static gboolean dissect_data_chunk(tvbuff_t*, guint16, packet_info*, proto_tree*, proto_tree*, proto_item*, proto_item*, sctp_half_assoc_t*);
+static gboolean dissect_data_chunk(tvbuff_t*, guint16, packet_info*, proto_tree*, proto_tree*, proto_item*, proto_item*, sctp_half_assoc_t*, gboolean);
static void dissect_sctp_packet(tvbuff_t *, packet_info *, proto_tree *, gboolean);
@@ -2533,21 +2544,41 @@ dissect_payload(tvbuff_t *payload_tvb, packet_info *pinfo, proto_tree *tree, gui
#define DATA_CHUNK_STREAM_ID_LENGTH 2
#define DATA_CHUNK_STREAM_SEQ_NUMBER_LENGTH 2
#define DATA_CHUNK_PAYLOAD_PROTOCOL_ID_LENGTH 4
+#define I_DATA_CHUNK_RESERVED_LENGTH 2
+#define I_DATA_CHUNK_MID_LENGTH 4
+#define I_DATA_CHUNK_PAYLOAD_PROTOCOL_ID_LENGTH 4
+#define I_DATA_CHUNK_FSN_LENGTH 4
#define DATA_CHUNK_TSN_OFFSET (CHUNK_VALUE_OFFSET + 0)
#define DATA_CHUNK_STREAM_ID_OFFSET (DATA_CHUNK_TSN_OFFSET + DATA_CHUNK_TSN_LENGTH)
#define DATA_CHUNK_STREAM_SEQ_NUMBER_OFFSET (DATA_CHUNK_STREAM_ID_OFFSET + \
- DATA_CHUNK_STREAM_SEQ_NUMBER_LENGTH)
+ DATA_CHUNK_STREAM_ID_LENGTH)
#define DATA_CHUNK_PAYLOAD_PROTOCOL_ID_OFFSET (DATA_CHUNK_STREAM_SEQ_NUMBER_OFFSET + \
DATA_CHUNK_STREAM_SEQ_NUMBER_LENGTH)
#define DATA_CHUNK_PAYLOAD_OFFSET (DATA_CHUNK_PAYLOAD_PROTOCOL_ID_OFFSET + \
DATA_CHUNK_PAYLOAD_PROTOCOL_ID_LENGTH)
+#define I_DATA_CHUNK_RESERVED_OFFSET (DATA_CHUNK_STREAM_ID_OFFSET + \
+ DATA_CHUNK_STREAM_ID_LENGTH)
+#define I_DATA_CHUNK_MID_OFFSET (I_DATA_CHUNK_RESERVED_OFFSET + \
+ I_DATA_CHUNK_RESERVED_LENGTH)
+#define I_DATA_CHUNK_PAYLOAD_PROTOCOL_ID_OFFSET (I_DATA_CHUNK_MID_OFFSET + \
+ I_DATA_CHUNK_MID_LENGTH)
+#define I_DATA_CHUNK_FSN_OFFSET (I_DATA_CHUNK_MID_OFFSET + \
+ I_DATA_CHUNK_MID_LENGTH)
+#define I_DATA_CHUNK_PAYLOAD_OFFSET (I_DATA_CHUNK_PAYLOAD_PROTOCOL_ID_OFFSET + \
+ I_DATA_CHUNK_PAYLOAD_PROTOCOL_ID_LENGTH)
#define DATA_CHUNK_HEADER_LENGTH (CHUNK_HEADER_LENGTH + \
DATA_CHUNK_TSN_LENGTH + \
DATA_CHUNK_STREAM_ID_LENGTH + \
DATA_CHUNK_STREAM_SEQ_NUMBER_LENGTH + \
DATA_CHUNK_PAYLOAD_PROTOCOL_ID_LENGTH)
+#define I_DATA_CHUNK_HEADER_LENGTH (CHUNK_HEADER_LENGTH + \
+ DATA_CHUNK_TSN_LENGTH + \
+ DATA_CHUNK_STREAM_ID_LENGTH + \
+ I_DATA_CHUNK_RESERVED_LENGTH + \
+ I_DATA_CHUNK_MID_LENGTH +\
+ I_DATA_CHUNK_PAYLOAD_PROTOCOL_ID_LENGTH)
#define SCTP_DATA_CHUNK_E_BIT 0x01
#define SCTP_DATA_CHUNK_B_BIT 0x02
@@ -2563,7 +2594,8 @@ typedef struct _frag_key {
guint16 dport;
guint32 verification_tag;
guint16 stream_id;
- guint16 stream_seq_num;
+ guint32 stream_seq_num;
+ guint8 u_bit;
} frag_key;
@@ -2577,7 +2609,8 @@ frag_equal(gconstpointer k1, gconstpointer k2)
(key1->dport == key2->dport) &&
(key1->verification_tag == key2->verification_tag) &&
(key1->stream_id == key2->stream_id) &&
- (key1->stream_seq_num == key2->stream_seq_num)
+ (key1->stream_seq_num == key2->stream_seq_num) &&
+ (key1->u_bit == key2->u_bit)
? TRUE : FALSE);
}
@@ -2588,7 +2621,7 @@ frag_hash(gconstpointer k)
const frag_key *key = (const frag_key *) k;
return key->sport ^ key->dport ^ key->verification_tag ^
- key->stream_id ^ key->stream_seq_num;
+ key->stream_id ^ key->stream_seq_num ^ key->u_bit;
}
@@ -2643,7 +2676,7 @@ sctp_cleanup(void)
static sctp_frag_msg*
-find_message(guint16 stream_id, guint16 stream_seq_num)
+find_message(guint16 stream_id, guint32 stream_seq_num, guint8 u_bit)
{
frag_key key;
@@ -2652,18 +2685,19 @@ find_message(guint16 stream_id, guint16 stream_seq_num)
key.verification_tag = sctp_info.verification_tag;
key.stream_id = stream_id;
key.stream_seq_num = stream_seq_num;
+ key.u_bit = u_bit;
return (sctp_frag_msg *)g_hash_table_lookup(frag_table, &key);
}
static sctp_fragment*
-find_fragment(guint32 tsn, guint16 stream_id, guint16 stream_seq_num)
+find_fragment(guint32 tsn, guint16 stream_id, guint32 stream_seq_num, guint8 u_bit)
{
sctp_frag_msg *msg;
sctp_fragment *next_fragment;
- msg = find_message(stream_id, stream_seq_num);
+ msg = find_message(stream_id, stream_seq_num, u_bit);
if (msg) {
next_fragment = msg->fragments;
@@ -2680,7 +2714,8 @@ find_fragment(guint32 tsn, guint16 stream_id, guint16 stream_seq_num)
static sctp_fragment *
add_fragment(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 tsn,
- guint16 stream_id, guint16 stream_seq_num, guint8 b_bit, guint8 e_bit)
+ guint16 stream_id, guint32 stream_seq_num, guint8 b_bit, guint8 e_bit,
+ guint8 u_bit, guint32 ppi, gboolean is_idata)
{
sctp_frag_msg *msg;
sctp_fragment *fragment, *last_fragment;
@@ -2692,7 +2727,7 @@ add_fragment(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 tsn,
return NULL;
/* lookup message. if not found, create it */
- msg = find_message(stream_id, stream_seq_num);
+ msg = find_message(stream_id, stream_seq_num, u_bit);
if (!msg) {
msg = (sctp_frag_msg *)g_malloc (sizeof (sctp_frag_msg));
@@ -2701,6 +2736,13 @@ add_fragment(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 tsn,
msg->fragments = NULL;
msg->messages = NULL;
msg->next = NULL;
+ if (is_idata)
+ if (b_bit)
+ msg->ppi = ppi;
+ else
+ msg->ppi = 0;
+ else
+ msg->ppi = ppi;
key = (frag_key *)g_malloc(sizeof (frag_key));
key->sport = sctp_info.sport;
@@ -2708,12 +2750,16 @@ add_fragment(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 tsn,
key->verification_tag = sctp_info.verification_tag;
key->stream_id = stream_id;
key->stream_seq_num = stream_seq_num;
+ key->u_bit = u_bit;
g_hash_table_insert(frag_table, key, msg);
+ } else {
+ if (b_bit)
+ msg->ppi = ppi;
}
/* lookup segment. if not found, create it */
- fragment = find_fragment(tsn, stream_id, stream_seq_num);
+ fragment = find_fragment(tsn, stream_id, stream_seq_num, u_bit);
if (fragment) {
/* this fragment is already known.
@@ -2746,6 +2792,7 @@ add_fragment(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 tsn,
fragment->frame_num = pinfo->fd->num;
fragment->tsn = tsn;
fragment->len = tvb_captured_length(tvb);
+ fragment->ppi = msg->ppi;
fragment->next = NULL;
fragment->data = (unsigned char *)g_malloc (fragment->len);
tvb_memcpy(tvb, fragment->data, 0, fragment->len);
@@ -2826,7 +2873,7 @@ add_fragment(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 tsn,
static tvbuff_t*
fragment_reassembly(tvbuff_t *tvb, sctp_fragment *fragment,
packet_info *pinfo, proto_tree *tree, guint16 stream_id,
- guint16 stream_seq_num)
+ guint32 stream_seq_num, guint8 u_bit)
{
sctp_frag_msg *msg;
sctp_complete_msg *message, *last_message;
@@ -2837,7 +2884,7 @@ fragment_reassembly(tvbuff_t *tvb, sctp_fragment *fragment,
proto_item *item;
proto_tree *ptree;
- msg = find_message(stream_id, stream_seq_num);
+ msg = find_message(stream_id, stream_seq_num, u_bit);
if (!msg) {
/* no message, we can't do anything */
@@ -2867,7 +2914,7 @@ fragment_reassembly(tvbuff_t *tvb, sctp_fragment *fragment,
message->len, message->end - message->begin + 1);
if (message->begin > message->end) {
- for (frag_i = find_fragment(message->begin, stream_id, stream_seq_num);
+ for (frag_i = find_fragment(message->begin, stream_id, stream_seq_num, u_bit);
frag_i;
frag_i = frag_i->next) {
@@ -2891,7 +2938,7 @@ fragment_reassembly(tvbuff_t *tvb, sctp_fragment *fragment,
mark_frame_as_depended_upon(pinfo, frag_i->frame_num);
}
} else {
- for (frag_i = find_fragment(message->begin, stream_id, stream_seq_num);
+ for (frag_i = find_fragment(message->begin, stream_id, stream_seq_num, u_bit);
frag_i && frag_i->tsn <= message->end;
frag_i = frag_i->next) {
@@ -3106,7 +3153,7 @@ fragment_reassembly(tvbuff_t *tvb, sctp_fragment *fragment,
message->len, message->end - message->begin + 1);
if (message->begin > message->end) {
- for (frag_i = find_fragment(message->begin, stream_id, stream_seq_num);
+ for (frag_i = find_fragment(message->begin, stream_id, stream_seq_num, u_bit);
frag_i;
frag_i = frag_i->next) {
@@ -3126,7 +3173,7 @@ fragment_reassembly(tvbuff_t *tvb, sctp_fragment *fragment,
offset += frag_i->len;
}
} else {
- for (frag_i = find_fragment(message->begin, stream_id, stream_seq_num);
+ for (frag_i = find_fragment(message->begin, stream_id, stream_seq_num, u_bit);
frag_i && frag_i->tsn <= message->end;
frag_i = frag_i->next) {
@@ -3165,7 +3212,7 @@ export_sctp_data_chunk(packet_info *pinfo, tvbuff_t *tvb, const gchar *proto_nam
static gboolean
dissect_fragmented_payload(tvbuff_t *payload_tvb, packet_info *pinfo, proto_tree *tree,
proto_tree *chunk_tree, guint32 tsn, guint32 ppi, guint16 stream_id,
- guint16 stream_seq_num, guint8 b_bit, guint8 e_bit)
+ guint32 stream_seq_num, guint8 b_bit, guint8 e_bit, guint8 u_bit, gboolean is_idata)
{
sctp_fragment *fragment;
tvbuff_t *new_tvb = NULL;
@@ -3177,11 +3224,11 @@ dissect_fragmented_payload(tvbuff_t *payload_tvb, packet_info *pinfo, proto_tree
if (tvb_reported_length(payload_tvb) > tvb_captured_length(payload_tvb))
return TRUE;
- /* add fragement to list of known fragments. returns NULL if segment is a duplicate */
- fragment = add_fragment(payload_tvb, pinfo, chunk_tree, tsn, stream_id, stream_seq_num, b_bit, e_bit);
+ /* add fragment to list of known fragments. returns NULL if segment is a duplicate */
+ fragment = add_fragment(payload_tvb, pinfo, chunk_tree, tsn, stream_id, stream_seq_num, b_bit, e_bit, u_bit, ppi, is_idata);
if (fragment)
- new_tvb = fragment_reassembly(payload_tvb, fragment, pinfo, chunk_tree, stream_id, stream_seq_num);
+ new_tvb = fragment_reassembly(payload_tvb, fragment, pinfo, chunk_tree, stream_id, stream_seq_num, u_bit);
/* pass reassembled data to next dissector, if possible */
if (new_tvb){
@@ -3189,11 +3236,13 @@ dissect_fragmented_payload(tvbuff_t *payload_tvb, packet_info *pinfo, proto_tree
guint proto_id;
const gchar *proto_name;
gboolean retval;
+ void *tmp;
cur = wmem_list_tail(pinfo->layers);
retval = dissect_payload(new_tvb, pinfo, tree, ppi);
cur = wmem_list_frame_next(cur);
- proto_id = GPOINTER_TO_UINT(wmem_list_frame_data(cur));
+ tmp = wmem_list_frame_data(cur);
+ proto_id = GPOINTER_TO_UINT(tmp);
proto_name = proto_get_protocol_filter_name(proto_id);
if(strcmp(proto_name, "data") != 0){
if (have_tap_listener(exported_pdu_tap)){
@@ -3235,29 +3284,40 @@ dissect_data_chunk(tvbuff_t *chunk_tvb,
proto_tree *chunk_tree,
proto_item *chunk_item,
proto_item *flags_item,
- sctp_half_assoc_t *ha)
+ sctp_half_assoc_t *ha,
+ gboolean is_idata)
{
guint number_of_ppid;
- guint32 payload_proto_id;
+ volatile guint32 payload_proto_id;
tvbuff_t *payload_tvb;
proto_tree *flags_tree;
guint8 e_bit, b_bit, u_bit;
- guint16 stream_id, stream_seq_num = 0;
- guint32 tsn, ppid;
+ guint16 stream_id;
+ guint32 tsn, ppid, stream_seq_num = 0;
proto_item *tsn_item = NULL;
gboolean call_subdissector = FALSE;
gboolean is_retransmission;
+ guint16 header_length;
+ guint16 payload_offset;
- if (chunk_length <= DATA_CHUNK_HEADER_LENGTH) {
- proto_item_append_text(chunk_item, ", bogus chunk length %u < %u)", chunk_length, DATA_CHUNK_HEADER_LENGTH);
- return TRUE;
+ if (is_idata) {
+ if (chunk_length < I_DATA_CHUNK_HEADER_LENGTH) {
+ proto_item_append_text(chunk_item, ", bogus chunk length %u < %u)", chunk_length, I_DATA_CHUNK_HEADER_LENGTH);
+ return TRUE;
+ }
+ payload_proto_id = tvb_get_ntohl(chunk_tvb, I_DATA_CHUNK_PAYLOAD_PROTOCOL_ID_OFFSET);
+ } else {
+ if (chunk_length < DATA_CHUNK_HEADER_LENGTH) {
+ proto_item_append_text(chunk_item, ", bogus chunk length %u < %u)", chunk_length, DATA_CHUNK_HEADER_LENGTH);
+ return TRUE;
+ }
+ payload_proto_id = tvb_get_ntohl(chunk_tvb, DATA_CHUNK_PAYLOAD_PROTOCOL_ID_OFFSET);
}
- payload_proto_id = tvb_get_ntohl(chunk_tvb, DATA_CHUNK_PAYLOAD_PROTOCOL_ID_OFFSET);
-
/* 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++) {
- ppid = GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, proto_sctp, number_of_ppid));
+ void *tmp = p_get_proto_data(pinfo->pool, pinfo, proto_sctp, number_of_ppid);
+ ppid = GPOINTER_TO_UINT(tmp);
if ((ppid == LAST_PPID) || (ppid == payload_proto_id))
break;
}
@@ -3267,12 +3327,13 @@ dissect_data_chunk(tvbuff_t *chunk_tvb,
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;
u_bit = tvb_get_guint8(chunk_tvb, CHUNK_FLAGS_OFFSET) & SCTP_DATA_CHUNK_U_BIT;
- stream_id = tvb_get_ntohs(chunk_tvb, DATA_CHUNK_STREAM_ID_OFFSET);
- stream_seq_num = tvb_get_ntohs(chunk_tvb, DATA_CHUNK_STREAM_SEQ_NUMBER_OFFSET);
tsn = tvb_get_ntohl(chunk_tvb, DATA_CHUNK_TSN_OFFSET);
if (chunk_tree) {
- proto_item_set_len(chunk_item, DATA_CHUNK_HEADER_LENGTH);
+ if (is_idata)
+ proto_item_set_len(chunk_item, I_DATA_CHUNK_HEADER_LENGTH);
+ else
+ proto_item_set_len(chunk_item, DATA_CHUNK_HEADER_LENGTH);
flags_tree = proto_item_add_subtree(flags_item, ett_sctp_data_chunk_flags);
proto_tree_add_item(flags_tree, hf_data_chunk_e_bit, chunk_tvb, CHUNK_FLAGS_OFFSET, CHUNK_FLAGS_LENGTH, ENC_BIG_ENDIAN);
proto_tree_add_item(flags_tree, hf_data_chunk_b_bit, chunk_tvb, CHUNK_FLAGS_OFFSET, CHUNK_FLAGS_LENGTH, ENC_BIG_ENDIAN);
@@ -3280,9 +3341,17 @@ dissect_data_chunk(tvbuff_t *chunk_tvb,
proto_tree_add_item(flags_tree, hf_data_chunk_i_bit, chunk_tvb, CHUNK_FLAGS_OFFSET, CHUNK_FLAGS_LENGTH, ENC_BIG_ENDIAN);
tsn_item = proto_tree_add_item(chunk_tree, hf_data_chunk_tsn, chunk_tvb, DATA_CHUNK_TSN_OFFSET, DATA_CHUNK_TSN_LENGTH, ENC_BIG_ENDIAN);
proto_tree_add_item(chunk_tree, hf_data_chunk_stream_id, chunk_tvb, DATA_CHUNK_STREAM_ID_OFFSET, DATA_CHUNK_STREAM_ID_LENGTH, ENC_BIG_ENDIAN);
- proto_tree_add_item(chunk_tree, hf_data_chunk_stream_seq_number, chunk_tvb, DATA_CHUNK_STREAM_SEQ_NUMBER_OFFSET, DATA_CHUNK_STREAM_SEQ_NUMBER_LENGTH, ENC_BIG_ENDIAN);
- proto_tree_add_item(chunk_tree, hf_data_chunk_payload_proto_id, chunk_tvb, DATA_CHUNK_PAYLOAD_PROTOCOL_ID_OFFSET, DATA_CHUNK_PAYLOAD_PROTOCOL_ID_LENGTH, ENC_BIG_ENDIAN);
-
+ if (is_idata) {
+ proto_tree_add_item(chunk_tree, hf_idata_chunk_reserved, chunk_tvb, I_DATA_CHUNK_RESERVED_OFFSET, I_DATA_CHUNK_RESERVED_LENGTH, ENC_BIG_ENDIAN);
+ proto_tree_add_item(chunk_tree, hf_idata_chunk_mid, chunk_tvb, I_DATA_CHUNK_MID_OFFSET, I_DATA_CHUNK_MID_LENGTH, ENC_BIG_ENDIAN);
+ if (b_bit)
+ proto_tree_add_item(chunk_tree, hf_data_chunk_payload_proto_id, chunk_tvb, I_DATA_CHUNK_PAYLOAD_PROTOCOL_ID_OFFSET, I_DATA_CHUNK_PAYLOAD_PROTOCOL_ID_LENGTH, ENC_BIG_ENDIAN);
+ else
+ proto_tree_add_item(chunk_tree, hf_idata_chunk_fsn, chunk_tvb, I_DATA_CHUNK_FSN_OFFSET, I_DATA_CHUNK_FSN_LENGTH, ENC_BIG_ENDIAN);
+ } else {
+ proto_tree_add_item(chunk_tree, hf_data_chunk_stream_seq_number, chunk_tvb, DATA_CHUNK_STREAM_SEQ_NUMBER_OFFSET, DATA_CHUNK_STREAM_SEQ_NUMBER_LENGTH, ENC_BIG_ENDIAN);
+ proto_tree_add_item(chunk_tree, hf_data_chunk_payload_proto_id, chunk_tvb, DATA_CHUNK_PAYLOAD_PROTOCOL_ID_OFFSET, DATA_CHUNK_PAYLOAD_PROTOCOL_ID_LENGTH, ENC_BIG_ENDIAN);
+ }
proto_item_append_text(chunk_item, "(%s, ", (u_bit) ? "unordered" : "ordered");
if (b_bit) {
if (e_bit)
@@ -3296,19 +3365,41 @@ dissect_data_chunk(tvbuff_t *chunk_tvb,
proto_item_append_text(chunk_item, "middle");
}
- proto_item_append_text(chunk_item, " segment, TSN: %u, SID: %u, SSN: %u, PPID: %u, payload length: %u byte%s)",
- tvb_get_ntohl(chunk_tvb, DATA_CHUNK_TSN_OFFSET),
- tvb_get_ntohs(chunk_tvb, DATA_CHUNK_STREAM_ID_OFFSET),
- tvb_get_ntohs(chunk_tvb, DATA_CHUNK_STREAM_SEQ_NUMBER_OFFSET),
- payload_proto_id,
- chunk_length - DATA_CHUNK_HEADER_LENGTH, plurality(chunk_length - DATA_CHUNK_HEADER_LENGTH, "", "s"));
+ if (is_idata) {
+ if (b_bit)
+ proto_item_append_text(chunk_item, " segment, TSN: %u, SID: %u, MID: %u, payload length: %u byte%s)",
+ tvb_get_ntohl(chunk_tvb, DATA_CHUNK_TSN_OFFSET),
+ tvb_get_ntohs(chunk_tvb, DATA_CHUNK_STREAM_ID_OFFSET),
+ tvb_get_ntohl(chunk_tvb, I_DATA_CHUNK_MID_OFFSET),
+ chunk_length - I_DATA_CHUNK_HEADER_LENGTH, plurality(chunk_length - I_DATA_CHUNK_HEADER_LENGTH, "", "s"));
+ else
+ proto_item_append_text(chunk_item, " segment, TSN: %u, SID: %u, MID: %u, FSN: %u, payload length: %u byte%s)",
+ tvb_get_ntohl(chunk_tvb, DATA_CHUNK_TSN_OFFSET),
+ tvb_get_ntohs(chunk_tvb, DATA_CHUNK_STREAM_ID_OFFSET),
+ tvb_get_ntohl(chunk_tvb, I_DATA_CHUNK_MID_OFFSET),
+ tvb_get_ntohl(chunk_tvb, I_DATA_CHUNK_FSN_OFFSET),
+ chunk_length - I_DATA_CHUNK_HEADER_LENGTH, plurality(chunk_length - I_DATA_CHUNK_HEADER_LENGTH, "", "s"));
+ } else
+ proto_item_append_text(chunk_item, " segment, TSN: %u, SID: %u, SSN: %u, PPID: %u, payload length: %u byte%s)",
+ tvb_get_ntohl(chunk_tvb, DATA_CHUNK_TSN_OFFSET),
+ tvb_get_ntohs(chunk_tvb, DATA_CHUNK_STREAM_ID_OFFSET),
+ tvb_get_ntohs(chunk_tvb, DATA_CHUNK_STREAM_SEQ_NUMBER_OFFSET),
+ payload_proto_id,
+ chunk_length - DATA_CHUNK_HEADER_LENGTH, plurality(chunk_length - DATA_CHUNK_HEADER_LENGTH, "", "s"));
}
- is_retransmission = sctp_tsn(pinfo, chunk_tvb, tsn_item, ha, tsn);
+ is_retransmission = sctp_tsn(pinfo, chunk_tvb, tsn_item, ha, tsn);
- payload_tvb = tvb_new_subset(chunk_tvb, DATA_CHUNK_PAYLOAD_OFFSET,
- MIN(chunk_length - DATA_CHUNK_HEADER_LENGTH, tvb_captured_length_remaining(chunk_tvb, DATA_CHUNK_PAYLOAD_OFFSET)),
- MIN(chunk_length - DATA_CHUNK_HEADER_LENGTH, tvb_reported_length_remaining(chunk_tvb, DATA_CHUNK_PAYLOAD_OFFSET)));
+ if (is_idata) {
+ header_length = I_DATA_CHUNK_HEADER_LENGTH;
+ payload_offset = I_DATA_CHUNK_PAYLOAD_OFFSET;
+ } else {
+ header_length = DATA_CHUNK_HEADER_LENGTH;
+ payload_offset = DATA_CHUNK_PAYLOAD_OFFSET;
+ }
+ payload_tvb = tvb_new_subset(chunk_tvb, I_DATA_CHUNK_PAYLOAD_OFFSET,
+ MIN(chunk_length - header_length, tvb_captured_length_remaining(chunk_tvb, payload_offset)),
+ MIN(chunk_length - header_length, tvb_reported_length_remaining(chunk_tvb, payload_offset)));
/* Is this a fragment? */
if (b_bit && e_bit) {
@@ -3343,13 +3434,15 @@ dissect_data_chunk(tvbuff_t *chunk_tvb,
wmem_list_frame_t *cur;
guint proto_id;
const gchar *proto_name;
+ void *tmp;
cur = wmem_list_tail(pinfo->layers);
retval = dissect_payload(payload_tvb, pinfo, tree, payload_proto_id);
cur = wmem_list_frame_next(cur);
- proto_id = GPOINTER_TO_UINT(wmem_list_frame_data(cur));
+ tmp = wmem_list_frame_data(cur);
+ proto_id = GPOINTER_TO_UINT(tmp);
proto_name = proto_get_protocol_filter_name(proto_id);
- if(strcmp(proto_name, "data") != 0){
+ if (strcmp(proto_name, "data") != 0){
if (have_tap_listener(exported_pdu_tap)){
export_sctp_data_chunk(pinfo,payload_tvb, proto_name);
}
@@ -3378,12 +3471,25 @@ dissect_data_chunk(tvbuff_t *chunk_tvb,
/* The logic above should ensure this... */
DISSECTOR_ASSERT(use_reassembly);
- /* if unordered set stream_seq_num to 0 for easier handling */
- if (u_bit)
- stream_seq_num = 0;
-
+ stream_id = tvb_get_ntohs(chunk_tvb, DATA_CHUNK_STREAM_ID_OFFSET);
+ if (is_idata) {
+ /* The stream_seq_num variable is used to hold the MID, the tsn variable holds the FSN*/
+ stream_seq_num = tvb_get_ntohl(chunk_tvb, I_DATA_CHUNK_MID_OFFSET);
+ if (b_bit) {
+ tsn = 0;
+ } else {
+ tsn = tvb_get_ntohl(chunk_tvb, I_DATA_CHUNK_FSN_OFFSET);
+ payload_proto_id = 0;
+ }
+ } else {
+ /* if unordered set stream_seq_num to 0 for easier handling */
+ if (u_bit)
+ stream_seq_num = 0;
+ else
+ stream_seq_num = tvb_get_ntohs(chunk_tvb, DATA_CHUNK_STREAM_SEQ_NUMBER_OFFSET);
+ }
/* start reassembly */
- return dissect_fragmented_payload(payload_tvb, pinfo, tree, chunk_tree, tsn, payload_proto_id, stream_id, stream_seq_num, b_bit, e_bit);
+ return dissect_fragmented_payload(payload_tvb, pinfo, tree, chunk_tree, tsn, payload_proto_id, stream_id, stream_seq_num, b_bit, e_bit, u_bit, is_idata);
}
}
@@ -4246,7 +4352,10 @@ dissect_sctp_chunk(tvbuff_t *chunk_tvb,
/* now dissect the chunk value */
switch(type) {
case SCTP_DATA_CHUNK_ID:
- result = dissect_data_chunk(chunk_tvb, length, pinfo, tree, chunk_tree, chunk_item, flags_item, ha);
+ result = dissect_data_chunk(chunk_tvb, length, pinfo, tree, chunk_tree, chunk_item, flags_item, ha, FALSE);
+ break;
+ case SCTP_I_DATA_CHUNK_ID:
+ result = dissect_data_chunk(chunk_tvb, length, pinfo, tree, chunk_tree, chunk_item, flags_item, ha, TRUE);
break;
case SCTP_INIT_CHUNK_ID:
dissect_init_chunk(chunk_tvb, length, pinfo, chunk_tree, chunk_item);
@@ -4655,10 +4764,13 @@ proto_register_sctp(void)
#if 0
{ &hf_cumulative_tsn_ack, { "Cumulative TSN Ack", "sctp.cumulative_tsn_ack", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
#endif
- { &hf_data_chunk_tsn, { "TSN", "sctp.data_tsn", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
- { &hf_data_chunk_stream_id, { "Stream Identifier", "sctp.data_sid", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
+ { &hf_data_chunk_tsn, { "Transmission sequence number", "sctp.data_tsn", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+ { &hf_data_chunk_stream_id, { "Stream identifier", "sctp.data_sid", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
{ &hf_data_chunk_stream_seq_number, { "Stream sequence number", "sctp.data_ssn", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_data_chunk_payload_proto_id, { "Payload protocol identifier", "sctp.data_payload_proto_id", FT_UINT32, BASE_DEC, VALS(sctp_payload_proto_id_values), 0x0, NULL, HFILL } },
+ { &hf_idata_chunk_reserved, { "Reserved", "sctp.data_reserved", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+ { &hf_idata_chunk_mid, { "Message identifier", "sctp.data_mid", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+ { &hf_idata_chunk_fsn, { "Fragment sequence number", "sctp.data_fsn", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_data_chunk_e_bit, { "E-Bit", "sctp.data_e_bit", FT_BOOLEAN, 8, TFS(&sctp_data_chunk_e_bit_value), SCTP_DATA_CHUNK_E_BIT, NULL, HFILL } },
{ &hf_data_chunk_b_bit, { "B-Bit", "sctp.data_b_bit", FT_BOOLEAN, 8, TFS(&sctp_data_chunk_b_bit_value), SCTP_DATA_CHUNK_B_BIT, NULL, HFILL } },
{ &hf_data_chunk_u_bit, { "U-Bit", "sctp.data_u_bit", FT_BOOLEAN, 8, TFS(&sctp_data_chunk_u_bit_value), SCTP_DATA_CHUNK_U_BIT, NULL, HFILL } },
diff --git a/epan/dissectors/packet-sctp.h b/epan/dissectors/packet-sctp.h
index 237145b8e0..8b2022e075 100644
--- a/epan/dissectors/packet-sctp.h
+++ b/epan/dissectors/packet-sctp.h
@@ -51,6 +51,7 @@ typedef struct _sctp_fragment {
guint32 frame_num;
guint32 tsn;
guint32 len;
+ guint32 ppi;
unsigned char *data;
struct _sctp_fragment *next;
} sctp_fragment;
@@ -74,6 +75,7 @@ typedef struct _sctp_frag_msg {
sctp_frag_be* ends;
sctp_fragment* fragments;
sctp_complete_msg* messages;
+ guint32 ppi;
struct _sctp_frag_msg* next;
} sctp_frag_msg;
diff --git a/ui/gtk/sctp_chunk_stat.c b/ui/gtk/sctp_chunk_stat.c
index e4266e0df2..8b85c90ed1 100644
--- a/ui/gtk/sctp_chunk_stat.c
+++ b/ui/gtk/sctp_chunk_stat.c
@@ -207,11 +207,12 @@ sctpstat_draw(void *phs)
12, tmp->chunk_count[SCTP_ABORT_CHUNK_ID],
13, tmp->chunk_count[SCTP_ERROR_CHUNK_ID],
14, tmp->chunk_count[SCTP_NR_SACK_CHUNK_ID],
- 15, tmp->chunk_count[SCTP_ASCONF_ACK_CHUNK_ID],
- 16, tmp->chunk_count[SCTP_PKTDROP_CHUNK_ID],
- 17, tmp->chunk_count[SCTP_FORWARD_TSN_CHUNK_ID],
- 18, tmp->chunk_count[SCTP_ASCONF_CHUNK_ID],
- 19, tmp->chunk_count[OTHER_CHUNKS_INDEX],
+ 15, tmp->chunk_count[SCTP_I_DATA_CHUNK_ID],
+ 16, tmp->chunk_count[SCTP_ASCONF_ACK_CHUNK_ID],
+ 17, tmp->chunk_count[SCTP_PKTDROP_CHUNK_ID],
+ 18, tmp->chunk_count[SCTP_FORWARD_TSN_CHUNK_ID],
+ 19, tmp->chunk_count[SCTP_ASCONF_CHUNK_ID],
+ 20, tmp->chunk_count[OTHER_CHUNKS_INDEX],
-1
);
wmem_free(NULL, src_addr);
@@ -250,6 +251,7 @@ static const stat_column titles[]={
{G_TYPE_UINT, TAP_ALIGN_RIGHT, "ABORT" },
{G_TYPE_UINT, TAP_ALIGN_RIGHT, "ERROR" },
{G_TYPE_UINT, TAP_ALIGN_RIGHT, "NR-SACK" },
+ {G_TYPE_UINT, TAP_ALIGN_RIGHT, "I-DATA" },
{G_TYPE_UINT, TAP_ALIGN_RIGHT, "ASCONF-ACK" },
{G_TYPE_UINT, TAP_ALIGN_RIGHT, "PKTDROP" },
{G_TYPE_UINT, TAP_ALIGN_RIGHT, "FORWARD-TSN" },
diff --git a/ui/gtk/sctp_chunk_stat_dlg.c b/ui/gtk/sctp_chunk_stat_dlg.c
index 7308ee01bf..9cdbad045b 100644
--- a/ui/gtk/sctp_chunk_stat_dlg.c
+++ b/ui/gtk/sctp_chunk_stat_dlg.c
@@ -56,6 +56,7 @@ enum chunk_types {
SHUT_COMPLETE = 14,
AUTH = 15,
NR_SACK = 16,
+ I_DATA = 0x40,
ASCONF_ACK = 0x80,
PKTDROP = 0x81,
FORWARD_TSN = 0xC0,
@@ -81,6 +82,7 @@ enum
SHUT_COMPLETE_COLUMN,
AUTH_COLUMN,
NR_SACK_COLUMN,
+ I_DATA_COLUMN,
ASCONF_ACK_COLUMN,
PKTDROP_COLUMN,
FORWARD_TSN_COLUMN,
@@ -122,6 +124,7 @@ GtkWidget* create_list(void)
G_TYPE_INT, /* SHUT_COMPLETE */
G_TYPE_INT, /* AUTH */
G_TYPE_INT, /* NR_SACK */
+ G_TYPE_INT, /* I_DATA */
G_TYPE_INT, /* ASCONF_ACK */
G_TYPE_INT, /* PKTDROP */
G_TYPE_INT, /* FORWARD_TSN */
@@ -351,6 +354,17 @@ GtkWidget* create_list(void)
/* 19:th column... */
renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes ("I-DATA", renderer,
+ "text", I_DATA_COLUMN,
+ NULL);
+ gtk_tree_view_column_set_sort_column_id(column, I_DATA_COLUMN);
+ gtk_tree_view_column_set_resizable(column, TRUE);
+ gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED);
+ gtk_tree_view_column_set_min_width(column, 100);
+ gtk_tree_view_append_column (list_view, column);
+
+ /* 20:th column... */
+ renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("ASCONF-ACK", renderer,
"text", ASCONF_ACK_COLUMN,
NULL);
@@ -360,7 +374,7 @@ GtkWidget* create_list(void)
gtk_tree_view_column_set_min_width(column, 120);
gtk_tree_view_append_column (list_view, column);
- /* 20:th column... */
+ /* 21:th column... */
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("PKTDROP", renderer,
"text", PKTDROP_COLUMN,
@@ -371,7 +385,7 @@ GtkWidget* create_list(void)
gtk_tree_view_column_set_min_width(column, 100);
gtk_tree_view_append_column (list_view, column);
- /* 21:st column... */
+ /* 22:st column... */
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("FORWARD-TSN", renderer,
"text", FORWARD_TSN_COLUMN,
@@ -382,7 +396,7 @@ GtkWidget* create_list(void)
gtk_tree_view_column_set_min_width(column, 140);
gtk_tree_view_append_column (list_view, column);
- /* 22:nd column... */
+ /* 23:nd column... */
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("ASCONF", renderer,
"text", ASCONF_COLUMN,
@@ -393,7 +407,7 @@ GtkWidget* create_list(void)
gtk_tree_view_column_set_min_width(column, 90);
gtk_tree_view_append_column (list_view, column);
- /* 23:rd column... */
+ /* 24:rd column... */
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("Others", renderer,
"text", OTHERS_COLUMN,
@@ -440,6 +454,7 @@ chunk_name(int type)
CASE(SHUT_COMPLETE);
CASE(AUTH);
CASE(NR_SACK);
+ CASE(I_DATA);
CASE(ASCONF_ACK);
CASE(PKTDROP);
CASE(FORWARD_TSN);
@@ -494,7 +509,7 @@ add_to_clist(sctp_addr_chunk* sac)
}
gtk_list_store_insert_with_values( list_store , &iter, G_MAXINT,
- IP_ADDR_COLUMN, field[0],
+ IP_ADDR_COLUMN, field,
DATA_COLUMN, sac->addr_count[SCTP_DATA_CHUNK_ID],
INIT_COLUMN, sac->addr_count[SCTP_INIT_CHUNK_ID],
INIT_ACK_COLUMN, sac->addr_count[SCTP_INIT_ACK_CHUNK_ID],
@@ -512,6 +527,7 @@ add_to_clist(sctp_addr_chunk* sac)
SHUT_COMPLETE_COLUMN, sac->addr_count[SCTP_SHUTDOWN_COMPLETE_CHUNK_ID],
AUTH_COLUMN, sac->addr_count[SCTP_AUTH_CHUNK_ID],
NR_SACK_COLUMN, sac->addr_count[SCTP_NR_SACK_CHUNK_ID],
+ I_DATA_COLUMN, sac->addr_count[SCTP_I_DATA_CHUNK_ID],
ASCONF_ACK_COLUMN, sac->addr_count[SCTP_ASCONF_ACK_CHUNK_ID],
PKTDROP_COLUMN, sac->addr_count[SCTP_PKTDROP_CHUNK_ID],
FORWARD_TSN_COLUMN, sac->addr_count[SCTP_FORWARD_TSN_CHUNK_ID],
diff --git a/ui/gtk/sctp_graph_dlg.c b/ui/gtk/sctp_graph_dlg.c
index f702a68491..0811c3671c 100644
--- a/ui/gtk/sctp_graph_dlg.c
+++ b/ui/gtk/sctp_graph_dlg.c
@@ -569,7 +569,7 @@ draw_tsn_graph(struct sctp_udata *u_data)
while (tlist)
{
type = ((struct chunk_header *)tlist->data)->type;
- if (type == SCTP_DATA_CHUNK_ID || type == SCTP_FORWARD_TSN_CHUNK_ID)
+ if (type == SCTP_DATA_CHUNK_ID || type == SCTP_I_DATA_CHUNK_ID || type == SCTP_FORWARD_TSN_CHUNK_ID)
tsnumber = g_ntohl(((struct data_chunk_header *)tlist->data)->tsn);
if (tsnumber >= min_tsn && tsnumber <= max_tsn && tsn->secs >= min_secs)
{
@@ -589,7 +589,7 @@ draw_tsn_graph(struct sctp_udata *u_data)
#else
cr = gdk_cairo_create (u_data->io->pixmap);
#endif
- if (type == SCTP_DATA_CHUNK_ID)
+ if ((type == SCTP_DATA_CHUNK_ID) || (type == SCTP_I_DATA_CHUNK_ID))
gdk_cairo_set_source_rgba (cr, &black_color);
else
gdk_cairo_set_source_rgba (cr, &pink_color);
diff --git a/ui/qt/sctp_graph_arwnd_dialog.cpp b/ui/qt/sctp_graph_arwnd_dialog.cpp
index abaeb5832a..a36e5bdfbd 100644
--- a/ui/qt/sctp_graph_arwnd_dialog.cpp
+++ b/ui/qt/sctp_graph_arwnd_dialog.cpp
@@ -76,10 +76,10 @@ void SCTPGraphArwndDialog::drawArwndGraph()
if (direction == 1) {
listSACK = g_list_last(selected_assoc->sack1);
- startArwnd = selected_assoc->arwnd1;
+ startArwnd = selected_assoc->arwnd2;
} else {
listSACK = g_list_last(selected_assoc->sack2);
- startArwnd = selected_assoc->arwnd2;
+ startArwnd = selected_assoc->arwnd1;
}
while (listSACK) {
tsn = (tsn_t*) (listSACK->data);
diff --git a/ui/qt/sctp_graph_byte_dialog.cpp b/ui/qt/sctp_graph_byte_dialog.cpp
index 2d24ba73d2..4af5a847e2 100644
--- a/ui/qt/sctp_graph_byte_dialog.cpp
+++ b/ui/qt/sctp_graph_byte_dialog.cpp
@@ -90,8 +90,12 @@ void SCTPGraphByteDialog::drawBytesGraph()
while (tlist)
{
type = ((struct chunk_header *)tlist->data)->type;
- if (type == SCTP_DATA_CHUNK_ID) {
+ if (type == SCTP_DATA_CHUNK_ID || type == SCTP_I_DATA_CHUNK_ID) {
length = g_ntohs(((struct data_chunk_header *)tlist->data)->length);
+ if (type == SCTP_DATA_CHUNK_ID)
+ length -= DATA_CHUNK_HEADER_LENGTH;
+ else
+ length -= I_DATA_CHUNK_HEADER_LENGTH;
sumBytes += length;
yb.append(sumBytes);
xb.append(tsn->secs + tsn->usecs/1000000.0);
diff --git a/ui/qt/sctp_graph_dialog.cpp b/ui/qt/sctp_graph_dialog.cpp
index 27cc4bb0c8..d0efcf5f57 100644
--- a/ui/qt/sctp_graph_dialog.cpp
+++ b/ui/qt/sctp_graph_dialog.cpp
@@ -86,8 +86,8 @@ void SCTPGraphDialog::drawNRSACKGraph()
list = g_list_last(selected_assoc->sack1);
min_tsn = selected_assoc->min_tsn1;
} else {
- list = g_list_last(selected_assoc->sack1);
- min_tsn = selected_assoc->min_tsn1;
+ list = g_list_last(selected_assoc->sack2);
+ min_tsn = selected_assoc->min_tsn2;
}
while (list) {
sack = (tsn_t*) (list->data);
@@ -280,7 +280,7 @@ void SCTPGraphDialog::drawTSNGraph()
while (tlist)
{
type = ((struct chunk_header *)tlist->data)->type;
- if (type == SCTP_DATA_CHUNK_ID || type == SCTP_FORWARD_TSN_CHUNK_ID) {
+ if (type == SCTP_DATA_CHUNK_ID || type == SCTP_I_DATA_CHUNK_ID || type == SCTP_FORWARD_TSN_CHUNK_ID) {
tsnumber = g_ntohl(((struct data_chunk_header *)tlist->data)->tsn);
yt.append(tsnumber);
xt.append(tsn->secs + tsn->usecs/1000000.0);
@@ -314,6 +314,7 @@ void SCTPGraphDialog::drawTSNGraph()
void SCTPGraphDialog::drawGraph(int which)
{
guint32 maxTSN, minTSN;
+ gint64 minBound;
gIsSackChunkPresent = false;
gIsNRSackChunkPresent = false;
@@ -348,7 +349,12 @@ void SCTPGraphDialog::drawGraph(int which)
connect(ui->sctpPlot, SIGNAL(plottableClick(QCPAbstractPlottable*,QMouseEvent*)), this, SLOT(graphClicked(QCPAbstractPlottable*, QMouseEvent*)));
// set axes ranges, so we see all data:
QCPRange myXRange(selected_assoc->min_secs, (selected_assoc->max_secs+1));
- QCPRange myYRange(minTSN, maxTSN);
+ if (maxTSN - minTSN < 5) {
+ minBound = 0;
+ } else {
+ minBound = minTSN;
+ }
+ QCPRange myYRange(minBound, maxTSN);
ui->sctpPlot->xAxis->setRange(myXRange);
ui->sctpPlot->yAxis->setRange(myYRange);
ui->sctpPlot->replot();
diff --git a/ui/tap-sctp-analysis.c b/ui/tap-sctp-analysis.c
index 6652fe705e..6e3db28f4c 100644
--- a/ui/tap-sctp-analysis.c
+++ b/ui/tap-sctp-analysis.c
@@ -478,6 +478,7 @@ packet(void *tapdata _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const voi
if (((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_INIT_CHUNK_ID) ||
((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_INIT_ACK_CHUNK_ID) ||
((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_DATA_CHUNK_ID) ||
+ ((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_I_DATA_CHUNK_ID) ||
((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_SACK_CHUNK_ID) ||
((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_NR_SACK_CHUNK_ID) ||
((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_FORWARD_TSN_CHUNK_ID))
@@ -507,6 +508,7 @@ packet(void *tapdata _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const voi
sack->secs=tsn->secs = (guint32)pinfo->rel_ts.secs;
sack->usecs=tsn->usecs = (guint32)pinfo->rel_ts.nsecs/1000;
if (((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_DATA_CHUNK_ID) ||
+ ((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_I_DATA_CHUNK_ID) ||
((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_SACK_CHUNK_ID) ||
((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_NR_SACK_CHUNK_ID) ||
((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_FORWARD_TSN_CHUNK_ID))
@@ -583,6 +585,7 @@ packet(void *tapdata _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const voi
if (((tvb_get_guint8(sctp_info->tvb[0],0)) != SCTP_INIT_CHUNK_ID) &&
((tvb_get_guint8(sctp_info->tvb[0],0)) != SCTP_INIT_ACK_CHUNK_ID) &&
((tvb_get_guint8(sctp_info->tvb[0],0)) != SCTP_DATA_CHUNK_ID) &&
+ ((tvb_get_guint8(sctp_info->tvb[0],0)) != SCTP_I_DATA_CHUNK_ID) &&
((tvb_get_guint8(sctp_info->tvb[0],0)) != SCTP_SACK_CHUNK_ID) &&
((tvb_get_guint8(sctp_info->tvb[0],0)) != SCTP_NR_SACK_CHUNK_ID) &&
((tvb_get_guint8(sctp_info->tvb[0],0)) != SCTP_FORWARD_TSN_CHUNK_ID))
@@ -604,10 +607,15 @@ packet(void *tapdata _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const voi
info->ep1_chunk_count[idx]++;
info = add_chunk_count(&tmp_info.src, info, 1, idx);
- if ((tvb_get_guint8(sctp_info->tvb[chunk_number],0) == SCTP_DATA_CHUNK_ID))
+ if ((tvb_get_guint8(sctp_info->tvb[chunk_number],0) == SCTP_DATA_CHUNK_ID) ||
+ (tvb_get_guint8(sctp_info->tvb[chunk_number],0) == SCTP_I_DATA_CHUNK_ID))
{
datachunk = TRUE;
- length = tvb_get_ntohs(sctp_info->tvb[chunk_number], CHUNK_LENGTH_OFFSET)-DATA_CHUNK_HEADER_LENGTH;
+ if (tvb_get_guint8(sctp_info->tvb[chunk_number],0) == SCTP_DATA_CHUNK_ID) {
+ length = tvb_get_ntohs(sctp_info->tvb[chunk_number], CHUNK_LENGTH_OFFSET) - DATA_CHUNK_HEADER_LENGTH;
+ } else {
+ length = tvb_get_ntohs(sctp_info->tvb[chunk_number], CHUNK_LENGTH_OFFSET) - I_DATA_CHUNK_HEADER_LENGTH;
+ }
info->n_data_chunks++;
info->n_data_bytes+=length;
info->outstream1 = tvb_get_ntohs((sctp_info->tvb)[chunk_number], DATA_CHUNK_STREAM_ID_OFFSET)+1;
@@ -655,7 +663,11 @@ packet(void *tapdata _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const voi
tsn_s->offset = 0;
tsn_s->framenumber = framenumber;
if (datachunk)
- tsn_s->length = length-DATA_CHUNK_HEADER_LENGTH;
+ if (tvb_get_guint8(sctp_info->tvb[chunk_number],0) == SCTP_DATA_CHUNK_ID) {
+ tsn_s->length = length - DATA_CHUNK_HEADER_LENGTH;
+ } else {
+ tsn_s->length = length - I_DATA_CHUNK_HEADER_LENGTH;
+ }
else
tsn_s->length = length;
if (tsn->secs < info->min_secs)
@@ -781,6 +793,7 @@ packet(void *tapdata _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const voi
if (((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_INIT_CHUNK_ID) ||
((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_INIT_ACK_CHUNK_ID) ||
((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_DATA_CHUNK_ID) ||
+ ((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_I_DATA_CHUNK_ID) ||
((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_SACK_CHUNK_ID) ||
((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_NR_SACK_CHUNK_ID) ||
((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_FORWARD_TSN_CHUNK_ID))
@@ -811,6 +824,7 @@ packet(void *tapdata _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const voi
sack->secs=tsn->secs = (guint32)pinfo->rel_ts.secs;
sack->usecs=tsn->usecs = (guint32)pinfo->rel_ts.nsecs/1000;
if (((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_DATA_CHUNK_ID) ||
+ ((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_I_DATA_CHUNK_ID) ||
((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_SACK_CHUNK_ID) ||
((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_NR_SACK_CHUNK_ID) ||
((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_FORWARD_TSN_CHUNK_ID))
@@ -932,6 +946,7 @@ packet(void *tapdata _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const voi
{
if (((tvb_get_guint8(sctp_info->tvb[0],0)) != SCTP_INIT_ACK_CHUNK_ID) &&
((tvb_get_guint8(sctp_info->tvb[0],0)) != SCTP_DATA_CHUNK_ID) &&
+ ((tvb_get_guint8(sctp_info->tvb[0],0)) != SCTP_I_DATA_CHUNK_ID) &&
((tvb_get_guint8(sctp_info->tvb[0],0)) != SCTP_SACK_CHUNK_ID) &&
((tvb_get_guint8(sctp_info->tvb[0],0)) != SCTP_NR_SACK_CHUNK_ID) &&
((tvb_get_guint8(sctp_info->tvb[0],0)) != SCTP_FORWARD_TSN_CHUNK_ID))
@@ -956,9 +971,10 @@ packet(void *tapdata _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const voi
info->ep2_chunk_count[idx]++;
info = add_chunk_count(&tmp_info.src, info,info->direction, idx);
- if (((tvb_get_guint8(sctp_info->tvb[chunk_number],0)) == SCTP_DATA_CHUNK_ID))
+ if ((tvb_get_guint8(sctp_info->tvb[chunk_number],0) == SCTP_DATA_CHUNK_ID) ||
+ (tvb_get_guint8(sctp_info->tvb[chunk_number],0) == SCTP_I_DATA_CHUNK_ID))
datachunk = TRUE;
- if (((tvb_get_guint8(sctp_info->tvb[chunk_number],0)) == SCTP_FORWARD_TSN_CHUNK_ID))
+ if (tvb_get_guint8(sctp_info->tvb[chunk_number],0) == SCTP_FORWARD_TSN_CHUNK_ID)
forwardchunk = TRUE;
if ((datachunk || forwardchunk) && tsn != NULL)
{
@@ -969,7 +985,11 @@ packet(void *tapdata _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const voi
{
t_s_n = (guint8 *)g_malloc(16);
tvb_memcpy(sctp_info->tvb[chunk_number], (guint8 *)(t_s_n),0, 16);
- length=tvb_get_ntohs(sctp_info->tvb[chunk_number], CHUNK_LENGTH_OFFSET)-DATA_CHUNK_HEADER_LENGTH;
+ if (tvb_get_guint8(sctp_info->tvb[chunk_number],0) == SCTP_DATA_CHUNK_ID) {
+ length=tvb_get_ntohs(sctp_info->tvb[chunk_number], CHUNK_LENGTH_OFFSET)-DATA_CHUNK_HEADER_LENGTH;
+ } else {
+ length = tvb_get_ntohs(sctp_info->tvb[chunk_number], CHUNK_LENGTH_OFFSET) - I_DATA_CHUNK_HEADER_LENGTH;
+ }
info->n_data_chunks++;
info->n_data_bytes+=length;
}
@@ -1056,7 +1076,11 @@ packet(void *tapdata _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const voi
{
if (datachunk)
{
- length = tvb_get_ntohs(sctp_info->tvb[chunk_number], CHUNK_LENGTH_OFFSET)-DATA_CHUNK_HEADER_LENGTH;
+ if (tvb_get_guint8(sctp_info->tvb[chunk_number],0) == SCTP_DATA_CHUNK_ID) {
+ length = tvb_get_ntohs(sctp_info->tvb[chunk_number], CHUNK_LENGTH_OFFSET) - DATA_CHUNK_HEADER_LENGTH;
+ } else {
+ length = tvb_get_ntohs(sctp_info->tvb[chunk_number], CHUNK_LENGTH_OFFSET) - I_DATA_CHUNK_HEADER_LENGTH;
+ }
info->n_data_chunks_ep2++;
info->n_data_bytes_ep2+=length;
}
@@ -1070,7 +1094,11 @@ packet(void *tapdata _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const voi
info->max_tsn2 = tsnumber;
if (datachunk)
{
- length = tvb_get_ntohs(sctp_info->tvb[chunk_number], CHUNK_LENGTH_OFFSET)-DATA_CHUNK_HEADER_LENGTH;
+ if (tvb_get_guint8(sctp_info->tvb[chunk_number],0) == SCTP_DATA_CHUNK_ID) {
+ length = tvb_get_ntohs(sctp_info->tvb[chunk_number], CHUNK_LENGTH_OFFSET) - DATA_CHUNK_HEADER_LENGTH;
+ } else {
+ length = tvb_get_ntohs(sctp_info->tvb[chunk_number], CHUNK_LENGTH_OFFSET) - I_DATA_CHUNK_HEADER_LENGTH;
+ }
info->n_data_chunks_ep2++;
info->n_data_bytes_ep2+=length;
}
diff --git a/ui/tap-sctp-analysis.h b/ui/tap-sctp-analysis.h
index b7fabd19db..18f0b86886 100644
--- a/ui/tap-sctp-analysis.h
+++ b/ui/tap-sctp-analysis.h
@@ -56,6 +56,7 @@ extern "C" {
#define SCTP_SHUTDOWN_COMPLETE_CHUNK_ID 14
#define SCTP_AUTH_CHUNK_ID 15
#define SCTP_NR_SACK_CHUNK_ID 16
+#define SCTP_I_DATA_CHUNK_ID 0x40
#define SCTP_ASCONF_ACK_CHUNK_ID 0x80
#define SCTP_PKTDROP_CHUNK_ID 0x81
#define SCTP_RE_CONFIG_CHUNK_ID 0x82
@@ -65,7 +66,7 @@ extern "C" {
#define SCTP_IETF_EXT 0xFF
#define IS_SCTP_CHUNK_TYPE(t) \
- (((t) <= 16) || ((t) == 0xC0) || ((t) == 0xC1) || ((t) == 0x80) || ((t) == 0x81))
+ (((t) <= 16) || ((t) == 0x40) || ((t) == 0xC0) || ((t) == 0xC1) || ((t) == 0x80) || ((t) == 0x81))
#define CHUNK_TYPE_LENGTH 1
#define CHUNK_FLAGS_LENGTH 1
@@ -99,11 +100,31 @@ extern "C" {
#define DATA_CHUNK_STREAM_ID_LENGTH 2
#define DATA_CHUNK_STREAM_SEQ_NUMBER_LENGTH 2
#define DATA_CHUNK_PAYLOAD_PROTOCOL_ID_LENGTH 4
+#define I_DATA_CHUNK_RESERVED_LENGTH 2
+#define I_DATA_CHUNK_MID_LENGTH 4
+#define I_DATA_CHUNK_PAYLOAD_PROTOCOL_ID_LENGTH 4
+#define I_DATA_CHUNK_FSN_LENGTH 4
+#define I_DATA_CHUNK_RESERVED_OFFSET (DATA_CHUNK_STREAM_ID_OFFSET + \
+ DATA_CHUNK_STREAM_ID_LENGTH)
+#define I_DATA_CHUNK_MID_OFFSET (I_DATA_CHUNK_RESERVED_OFFSET + \
+ I_DATA_CHUNK_RESERVED_LENGTH)
+#define I_DATA_CHUNK_PAYLOAD_PROTOCOL_ID_OFFSET (I_DATA_CHUNK_MID_OFFSET + \
+ I_DATA_CHUNK_MID_LENGTH)
+#define I_DATA_CHUNK_FSN_OFFSET (I_DATA_CHUNK_MID_OFFSET + \
+ I_DATA_CHUNK_MID_LENGTH)
+#define I_DATA_CHUNK_PAYLOAD_OFFSET (I_DATA_CHUNK_PAYLOAD_PROTOCOL_ID_OFFSET + \
+ I_DATA_CHUNK_PAYLOAD_PROTOCOL_ID_LENGTH)
#define DATA_CHUNK_HEADER_LENGTH (CHUNK_HEADER_LENGTH + \
DATA_CHUNK_TSN_LENGTH + \
DATA_CHUNK_STREAM_ID_LENGTH + \
DATA_CHUNK_STREAM_SEQ_NUMBER_LENGTH + \
DATA_CHUNK_PAYLOAD_PROTOCOL_ID_LENGTH)
+#define I_DATA_CHUNK_HEADER_LENGTH (CHUNK_HEADER_LENGTH + \
+ DATA_CHUNK_TSN_LENGTH + \
+ DATA_CHUNK_STREAM_ID_LENGTH + \
+ I_DATA_CHUNK_RESERVED_LENGTH + \
+ I_DATA_CHUNK_MID_LENGTH +\
+ I_DATA_CHUNK_PAYLOAD_PROTOCOL_ID_LENGTH)
#define MAX_ADDRESS_LEN 47
#define SCTP_ABORT_CHUNK_T_BIT 0x01
@@ -159,7 +180,8 @@ static const value_string chunk_type_values[] = {
{ SCTP_CWR_CHUNK_ID, "CWR" },
{ SCTP_SHUTDOWN_COMPLETE_CHUNK_ID, "SHUTDOWN_COMPLETE" },
{ SCTP_AUTH_CHUNK_ID, "AUTH" },
- { SCTP_NR_SACK_CHUNK_ID, "NR-SACK" },
+ { SCTP_NR_SACK_CHUNK_ID, "NR_SACK" },
+ { SCTP_I_DATA_CHUNK_ID, "I_DATA" },
{ SCTP_ASCONF_ACK_CHUNK_ID, "ASCONF_ACK" },
{ SCTP_PKTDROP_CHUNK_ID, "PKTDROP" },
{ SCTP_RE_CONFIG_CHUNK_ID, "RE_CONFIG" },