From 86b2c02c2458def71c8930fb9c15f0e86c6178b0 Mon Sep 17 00:00:00 2001
From: Hoelscher <jens.hoelscher@fh-muenster.de>
Date: Tue, 12 Apr 2016 13:50:37 +0200
Subject: [PATCH] fix for bug in sids list for
 OUTGOING-/INCOMING_SSN_RESET_REQUEST

---
 gtests/net/packetdrill/sctp_chunk_to_string.c                 | 2 +-
 gtests/net/packetdrill/sctp_packet.c                          | 4 ++--
 .../tests/bsd/sctp/sctp_reconfig/add_outgoing_streams.pkt     | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gtests/net/packetdrill/sctp_chunk_to_string.c b/gtests/net/packetdrill/sctp_chunk_to_string.c
index ab647ae7..190be82a 100644
--- a/gtests/net/packetdrill/sctp_chunk_to_string.c
+++ b/gtests/net/packetdrill/sctp_chunk_to_string.c
@@ -339,7 +339,7 @@ static int sctp_outgoing_ssn_reset_request_parameter_to_string(
 	fputs("sids=[", s);
 	for(len = 0; len < ((length-16)/sizeof(u16)); len++) {
 		u16 sid;
-		sid = ntohs(parameter->sids[len]);
+		sid = ntohs((u16)(parameter->sids)[len]);
 		if (len > 0)
 			fprintf(s, ", ");
 		fprintf(s, "%hu", sid);
diff --git a/gtests/net/packetdrill/sctp_packet.c b/gtests/net/packetdrill/sctp_packet.c
index 2c5232c0..6e61ad52 100644
--- a/gtests/net/packetdrill/sctp_packet.c
+++ b/gtests/net/packetdrill/sctp_packet.c
@@ -1834,7 +1834,7 @@ sctp_outgoing_ssn_reset_request_parameter_new(s64 reqsn, s64 respsn, s64 last_ts
 	if (sids != NULL) {
 		struct sctp_u16_list_item *item;
 		for (item = sids->first; item != NULL; item = item->next) {
-			parameter->sids[i] = item->value;
+			parameter->sids[i++] = htons(item->value);
 		}
 	}
 
@@ -1870,7 +1870,7 @@ sctp_incoming_ssn_reset_request_parameter_new(s64 reqsn, struct sctp_u16_list *s
 	if (sids != NULL) {
 		struct sctp_u16_list_item *item;
 		for (item = sids->first; item != NULL; item = item->next) {
-			parameter->sids[i] = item->value;
+			parameter->sids[i++] = htons(item->value);
 		}
 	}
 	return sctp_parameter_list_item_new((struct sctp_parameter *)parameter,
diff --git a/gtests/net/packetdrill/tests/bsd/sctp/sctp_reconfig/add_outgoing_streams.pkt b/gtests/net/packetdrill/tests/bsd/sctp/sctp_reconfig/add_outgoing_streams.pkt
index 88f99244..18d5175b 100644
--- a/gtests/net/packetdrill/tests/bsd/sctp/sctp_reconfig/add_outgoing_streams.pkt
+++ b/gtests/net/packetdrill/tests/bsd/sctp/sctp_reconfig/add_outgoing_streams.pkt
@@ -5,8 +5,8 @@
 +0.0 fcntl(3, F_GETFL) = 0x02 (flags O_RDWR)
 +0.0 fcntl(3, F_SETFL, O_RDWR | O_NONBLOCK) = 0
 
-+0.0 setsockopt(3, IPPROTO_SCTP, SCTP_ENABLE_STREAM_RESET, {assoc_id=3, assoc_value=SCTP_ENABLE_RESET_STREAM_REQ}, 8) = 0
-+0.0 getsockopt(3, IPPROTO_SCTP, SCTP_ENABLE_STREAM_RESET, {assoc_id=3, assoc_value=SCTP_ENABLE_RESET_STREAM_REQ}, [8]) = 0
++0.0 setsockopt(3, IPPROTO_SCTP, SCTP_ENABLE_STREAM_RESET, {assoc_id=3, assoc_value=SCTP_ENABLE_CHANGE_ASSOC_REQ}, 8) = 0
++0.0 getsockopt(3, IPPROTO_SCTP, SCTP_ENABLE_STREAM_RESET, {assoc_id=3, assoc_value=SCTP_ENABLE_CHANGE_ASSOC_REQ}, [8]) = 0
 
 // Trigger the active associtation setup
 +0.1 connect(3, ..., ...) = -1 EINPROGRESS (Operation now in progress)
-- 
GitLab