#!/usr/bin/perl # # SCTP Conformance Test Suite Implementation # (C) Copyright Fujitsu Ltd. 2008, 2009 # # This file is part of the SCTP Conformance Test Suite implementation. # # The SCTP Conformance Test Suite implementation is free software; # you can redistribute it and/or modify it under the terms of # the GNU General Public License version 2 as published by # the Free Software Foundation. # # The SCTP Conformance Test Suite implementation is distributed in the # hope that it will be useful, but WITHOUT ANY WARRANTY; without even # the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR # PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU CC; see the file COPYING. If not, write to # the Free Software Foundation, 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # # Please send any bug reports or fixes you make to the # email address(es): # networktest sctp # # Or submit a bug report through the following website: # http://networktest.sourceforge.net/ # # Written or modified by: # Hiroaki Kago # Wei Yongjun # # Any bugs reported given to us we will try to fix... any fixes shared will # be incorporated into the next SCTP release. # ############################################################################## BEGIN { $V6evalTool::TestVersion = '$Name: REL_1_0_0 $'; } use lib "../common"; use V6evalTool; use SCTP; %pktdesc = ( sctp_chunk_data_a1 => "Send SCTP CHUNK_DATA (Fragment 1st)", sctp_chunk_sack_a1 => "Recv SCTP CHUNK_SACK (Fragment 1st)", sctp_chunk_data_a2 => "Send SCTP CHUNK_DATA (Fragment 2nd)", sctp_chunk_sack_a2 => "Recv SCTP CHUNK_SACK (Fragment 2nd)", sctp_chunk_data_a3 => "Send SCTP CHUNK_DATA (Fragment 3rd)", sctp_chunk_sack_a3 => "Recv SCTP CHUNK_SACK (Fragment 3rd)", sctp_chunk_data_all => "Recv SCTP CHUNK_DATA (All DATA)", sctp_chunk_sack_all => "Send SCTP CHUNK_SACK (All DATA)", ); $IF0 = Link0; vCapture($IF0); sctpCheckEnv($IF0); sctpStartEchoServer($IF0); vConnect($IF0); vLogHTML('================ Main Test ================='); # Send A2 vSend($IF0, sctp_chunk_data_a2); %ret = vWarpRecv($IF0, 10, 0, 0, sctp_chunk_sack_a2); if($ret{status} != 0 || $ret{recvFrame} ne sctp_chunk_sack_a2) { vLogHTML('Cannot receive SCTP CHUNK_SACK
'); vLogHTML('NG'); exit $V6evalTool::exitFail; } # Send A3 vSend($IF0, sctp_chunk_data_a3); %ret = vWarpRecv($IF0, 10, 0, 0, sctp_chunk_sack_a3); if($ret{status} != 0 || $ret{recvFrame} ne sctp_chunk_sack_a3) { vLogHTML('Cannot receive SCTP CHUNK_SACK
'); vLogHTML('NG'); exit $V6evalTool::exitFail; } # Send A1 vSend($IF0, sctp_chunk_data_a1); sctpUpdateRecvACK(); sctpUpdateSendTSN(3); %ret = vWarpRecv($IF0, 10, 0, 0, sctp_chunk_sack_a1, sctp_chunk_data_all); if ($ret{status} == 0 && $ret{recvFrame} eq sctp_chunk_sack_a1) { %ret = vWarpRecv($IF0, 10, 0, 0, sctp_chunk_data_all); if($ret{status} != 0 || $ret{recvFrame} ne sctp_chunk_data_all) { vLogHTML('Cannot receive SCTP CHUNK_SACK
'); vLogHTML('NG'); exit $V6evalTool::exitFail; } vSend($IF0, sctp_chunk_sack_all); } elsif ($ret{status} == 0 && $ret{recvFrame} eq sctp_chunk_data_all) { vSend($IF0, sctp_chunk_sack_all); %ret = vWarpRecv($IF0, 10, 0, 0, sctp_chunk_sack_a1); if($ret{status} != 0 || $ret{recvFrame} ne sctp_chunk_sack_a1) { vLogHTML('Cannot receive SCTP CHUNK_SACK
'); vLogHTML('NG'); exit $V6evalTool::exitFail; } } else { vLogHTML('Cannot receive SCTP CHUNK_SACK
'); vLogHTML('NG'); exit $V6evalTool::exitFail; } vClose($IF0); vLogHTML(OK); exit $V6evalTool::exitPass; ###################################################################### __END__ =head1 NAME FM_MixA2A3A1.seq - Fragmented DATA chunks are received for reassembly (A2->A3->A1) =head1 PURPOSE To check that if fragmented DATA chunks arrive out of order of their TSN, the endpoint MUST hold the received DATA chunks from delivery to the ULP until they are reassembly. =head1 SYNOPSIS =begin html
  ./FM_MixA2A3A1.seq [-tooloption ...] -pkt ./FM_MixA2A3A1.def
    -tooloption : v6eval tool option
  See Also: ../common/STD_PKT_COMMON.def
            ../common/SCTP_COMMON.def
=end html =head1 PRE-TEST CONDITION Association is established between endpoint A and B. Arrange data in endpoint A such that fragmented DATA messages are sent to endpoint B for reassembly. =head1 TEST PROCEDURE Endpoint A Endpoint B ULP (ESTABLISHED) (ESTABLISHED) DATA A2 ----------------> [TSN=1, B=0, E=0] <---------------- SACK DATA A3 ----------------> [TSN=2, B=0, E=1] <---------------- SACK DATA A1 ----------------> [TSN=0, B=1, E=0] <---------------- SACK DATA Arrive -----> <---------------- DATA (ECHO of A1, A2 and A3) SACK ----------------> TEST DESCRIPTION: 1. Send DATA A2 from endpoint A to B with B=0, E=0. 2. Check A: DATA A2 is not delivered to the ULP. 3. Send DATA A3 from endpoint A to B with B=0, E=1. 4. Check B: DATA A3 is not delivered to the ULP. 5. Send DATA A1 from endpoint A to B with B=1, E=0. 6. Check C: DATA A1, A2 and A3 is delivered to the ULP after reassemble and be send back. =head1 NOTE None =head1 REFERENCE RFC 4960 6.9. Fragmentation and Reassembly =begin html
    An endpoint MUST recognize fragmented DATA chunks by examining the
    B/E bits in each of the received DATA chunks, and queue the
    fragmented DATA chunks for reassembly.  Once the user message is
    reassembled, SCTP shall pass the reassembled user message to the
    specific stream for possible reordering and final dispatching.
=end html Note: If the data receiver runs out of buffer space while still waiting for more fragments to complete the reassembly of the message, it should dispatch part of its inbound message through a partial delivery API (see Section 10), freeing some of its receive buffer space so that the rest of the message may be received.