#!/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 = (); $count = 48; $sndcnt = 0; $rcvcnt = 0; $sackcnt = 0; $error = 0; for($i = 0; $i < $count; $i++) { $pktdesc{"sctp_chunk_data_snd_frag$i"} = "Send SCTP CHUNK_DATA ($i)"; $pktdesc{"sctp_chunk_sack_rcv_frag$i"} = "Recv SCTP CHUNK_SACK ($i)"; $pktdesc{"sctp_chunk_data_rcv_frag$i"} = "Recv SCTP CHUNK_DATA ($i)"; $pktdesc{"sctp_chunk_sack_snd_frag$i"} = "Send SCTP CHUNK_SACK ($i)"; } $IF0 = Link0; vCapture($IF0); sctpCheckEnv($IF0); sctpStartEchoServer($IF0); vConnect($IF0); vLogHTML('================ Main Test ================='); $ARWND = $SCTP::CONF{'ARWND'}; $limit = $SCTP::CONF{"ENABLE_IPV6"} ? ($ARWND / 1432) : ($ARWND / 1452); $limit = int($limit) + 1 if($limit > int($limit)); for($sndcnt = 0; $sndcnt < $limit; $sndcnt++) { vSend($IF0, "sctp_chunk_data_snd_frag$sndcnt"); %ret = vWarpRecv($IF0, 10, 0, 0, "sctp_chunk_sack_rcv_frag$sndcnt"); if($ret{status} != 0 || $ret{recvFrame} ne "sctp_chunk_sack_rcv_frag$sndcnt") { vLogHTML('Cannot receive SCTP CHUNK_SACK
'); vLogHTML('NG'); exit $V6evalTool::exitFail; } } vSend($IF0, "sctp_chunk_data_snd_frag$sndcnt"); $sackcnt = $sndcnt; for($rcvcnt = 0; $rcvcnt < $limit; $rcvcnt++) { %ret = vWarpRecv($IF0, 10, 0, 0, "sctp_chunk_data_rcv_frag$rcvcnt", "sctp_chunk_sack_rcv_frag$sackcnt"); if ($ret{recvFrame} eq "sctp_chunk_sack_rcv_frag$sackcnt") { $sackcnt++; %ret = vWarpRecv($IF0, 10, 0, 0, "sctp_chunk_data_rcv_frag$rcvcnt"); } last if ($ret{status} != 0); vSend($IF0, "sctp_chunk_sack_snd_frag$rcvcnt"); } $error = $rcvcnt; while(($sndcnt < $count || $rcvcnt < $count) && $error < $rcvcnt + 5) { if (++$sndcnt < $count) { vSend($IF0, "sctp_chunk_data_snd_frag$sndcnt"); } for(; $rcvcnt < $count && $rcvcnt <= $sndcnt; $rcvcnt++) { %ret = vWarpRecv($IF0, 10, 0, 0, "sctp_chunk_data_rcv_frag$rcvcnt", "sctp_chunk_sack_rcv_frag$sackcnt"); if ($ret{recvFrame} eq "sctp_chunk_sack_rcv_frag$sackcnt") { $sackcnt++; %ret = vWarpRecv($IF0, 10, 0, 0, "sctp_chunk_data_rcv_frag$rcvcnt"); } last if ($ret{status} != 0 && ++$error); vSend($IF0, "sctp_chunk_sack_snd_frag$rcvcnt"); $error = $rcvcnt; } } sctpUpdateRecvACK($count); vClose($IF0); if ($error >= $rcvcnt + 5) { vLogHTML('NG'); exit $V6evalTool::exitFail; } vLogHTML(OK); exit $V6evalTool::exitPass; ###################################################################### __END__ =head1 NAME FM_PartialDelivery.seq - Fragmented DATA chunks are received for reassembly (Partial Delivery) =head1 PURPOSE To check that 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. =head1 SYNOPSIS =begin html
  ./FM_PartialDelivery.seq [-tooloption ...] -pkt ./FM_PartialDelivery.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 ----------------> [TSN=0,B=1,E=0] <---------------- SACK DATA ----------------> [TSN=1,B=0,E=0] <---------------- SACK ...... DATA ----------------> [TSN=47,B=0,E=1] <---------------- SACK TEST DESCRIPTION: 1. Send DATA from endpoint A to B with B=1, E=0. 2. Check A: DATA is not delivered to the ULP. 3. Send DATA from endpoint A to B with B=0, E=0 until the data receiver runs out of buffer space. 4. Check B: Fragmented DATA chunks is delivered to the ULP after reassemble and be send back. 5. Send DATA from endpoint A to B with B=0, E=1. 6. Check C: Fragmented DATA chunks is delivered to the ULP after reassemble and be send back. =head1 NOTE None =head1 REFERENCE RFC 4960 6.9. Fragmentation and Reassembly 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. =begin 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.
=end html