diff --git a/gtests/net/packetdrill/run_packet.c b/gtests/net/packetdrill/run_packet.c index 08e368296b09e4af0b4866938697b9c6969f7dec..8ad4e2a0aafc4e4f1f181aae9674c0cf4cfe8c41 100644 --- a/gtests/net/packetdrill/run_packet.c +++ b/gtests/net/packetdrill/run_packet.c @@ -2154,8 +2154,11 @@ static int do_inbound_script_packet( if (socket->state == SOCKET_PASSIVE_INIT_ACK_SENT) { for (; item != NULL; item = item->next) { if (item->chunk->type == SCTP_COOKIE_ECHO_CHUNK_TYPE) { - assert(item->next == NULL); /*FIXME: Handle chunks after the COOKIE_ECHO */ offset = socket->prepared_state_cookie_length - item->length; + assert(packet->ip_bytes + offset <= packet->buffer_bytes); + memmove((u8 *)item->chunk + item->length + offset, + (u8 *)item->chunk + item->length, + packet_end(packet) - ((u8 *)item->chunk + item->length)); memcpy(item->chunk, socket->prepared_state_cookie, socket->prepared_state_cookie_length); item->length = socket->prepared_state_cookie_length; packet->buffer_bytes += offset; diff --git a/gtests/net/packetdrill/tests/bsd/sctp/sctp_passive.pkt b/gtests/net/packetdrill/tests/bsd/sctp/sctp_passive.pkt index 563e07562563ae8b72a5ef9349a9be425c71bd2a..7e4e14cba2dbfe81472b6124bcd2f3b9ee597b07 100644 --- a/gtests/net/packetdrill/tests/bsd/sctp/sctp_passive.pkt +++ b/gtests/net/packetdrill/tests/bsd/sctp/sctp_passive.pkt @@ -4,21 +4,22 @@ +0.0 listen(3, 1) = 0 +0.0 < sctp: INIT[tag=1 a_rwnd=1500 os=1 is=1 tsn=0] +0.0 > sctp: INIT_ACK[tag=2 tsn=10] // faked cookie -+0.1 < sctp: COOKIE_ECHO[] // syntax not clear -+0.0 > sctp: COOKIE_ACK[] ++0.1 < sctp: COOKIE_ECHO[]; DATA[tsn=0 sid=0 ssn=0 ppid=0]// syntax not clear ++0.0 > sctp: COOKIE_ACK[]; SACK[tsn=0] +0.0 accept(3, ..., ...) = 4 ++0.0 read(4, ..., 1000) = 1000 // Send some data. +1.0 write(4, ..., 1000) = 1000 +0.0 > sctp: DATA[tsn=10 sid=0 ssn=0 ppid=0] +0.1 < sctp: SACK[tsn=10 a_rwnd=1500] // Receive some data -+1.0 < sctp: DATA[tsn=0 sid=0 ssn=0 ppid=0] // How to handle payload? ++1.0 < sctp: DATA[tsn=1 sid=0 ssn=1 ppid=0] // How to handle payload? +0.0 read(4, ..., 2000) = 1000 -+0.0 > sctp: SACK[tsn=0] ++0.2 > sctp: SACK[tsn=1] // Receive more data, observe delayed SACKi -+1.0 < sctp: DATA[tsn=1 sid=0 ssn=1 ppid=0] ++1.0 < sctp: DATA[tsn=2 sid=0 ssn=2 ppid=0] +0.0 read(4, ..., 2000) = 1000 -+0.2 > sctp: SACK[tsn=1] ++0.2 > sctp: SACK[tsn=2] // Tear down the association +1.0 < sctp: SHUTDOWN[tsn=0] +0.0 > sctp: SHUTDOWN_ACK[]