#!/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 = (); $IF0 = Link0; vCapture($IF0); sctpCheckEnv($IF0); sctpStartClient($IF0); vListen($IF0); $COOKIE = $SCTP::CONF{'COOKIE'}; $VERTAG = $SCTP::CONF{"VERTAG"}; vLogHTML('================ Main Test ================='); %ret = vWarpRecv($IF0, 10, 0, 0, sctp_chunk_cookie_echo_rcv); if($ret{status} != 0 || $ret{recvFrame} ne sctp_chunk_cookie_echo_rcv) { vLogHTML('Cannot receive SCTP CHUNK_COOKIE_ECHO
'); vLogHTML('NG'); exit $V6evalTool::exitFail; } vSend($IF0, sctp_chunk_init_snd); %ret = vWarpRecv3($IF0, 10, 0, 0, sctp_chunk_init_ack_rcv); if($ret{status} != 0 || $ret{recvFrame} ne sctp_chunk_init_ack_rcv) { vLogHTML('Cannot receive SCTP CHUNK_INIT_ACK
'); vLogHTML('NG'); exit $V6evalTool::exitFail; } sctpFetchInitField(\%ret); vSend($IF0, sctp_chunk_cookie_echo_snd); %ret = vWarpRecv($IF0, 10, 0, 0, sctp_chunk_cookie_ack_rcv); if($ret{status} != 0 || $ret{recvFrame} ne sctp_chunk_cookie_ack_rcv) { vLogHTML('Cannot receive SCTP CHUNK_COOKIE_ACK
'); vLogHTML('NG'); exit $V6evalTool::exitFail; } vRecvMsg($IF0); vShutdown($IF0); if ($VERTAG != $SCTP::CONF{"VERTAG"}) { vLogHTML('Init Tag should be equal to the Init Tag in the existing association
'); vLogHTML('NG'); exit $V6evalTool::exitFail; } if ($COOKIE eq $SCTP::CONF{"COOKIE"}) { vLogHTML('The Cookie sent in the INIT-ACK message should be the newly generated Cookie
'); vLogHTML('NG'); exit $V6evalTool::exitFail; } vLogHTML(OK); exit $V6evalTool::exitPass; ###################################################################### __END__ =head1 NAME DupInitInCookieEchoed.seq - Duplicate INIT chunk is received in COOKIE-ECHOED state =head1 PURPOSE To check that if INIT chunk is received in COOKIE-ECHOED state then the endpoint should respond with an INIT-ACK using the same parameters it sent in its original INIT chunk. =head1 SYNOPSIS =begin html
  ./DupInitInCookieEchoed.seq [-tooloption ...] -pkt ./DupInitInCookieEchoed.def
    -tooloption : v6eval tool option
  See Also: ../common/STD_PKT_COMMON.def
            ../common/SCTP_COMMON.def
=end html =head1 PRE-TEST CONDITION Association not established between endpoint A and B. Also arrange the data in endpoint B such that upper layers send Associate primitive to startup an association with endpoint A. =head1 TEST PROCEDURE Endpoint A Endpoint B ULP (CLOSED) (CLOSED) <----- Associate <----------------- INIT INIT-ACK -----------------> <----------------- COOKIE-ECHO INIT -----------------> <----------------- INIT-ACK COOKIE-ECHO -----------------> <----------------- COOKIE-ACK <----- Send <----------------- DATA SACK -----------------> TEST DESCRIPTION: 1. Start normal association procedure by sending associate primitive from ULP in endpoint B and from ULP in endpoint A at the same time. Record the message sequence using a signal emulator. 2. Send INIT message to endpoint B after receiving COOKIE-ECHO message to the endpoint B. 3. Check A: INIT-ACK message is sent in response to INIT message. 4. Check B: In the INIT-ACK message, verification tag field is set to the peer's new tag value received in the duplicate INIT message. 5. Check C: In the INIT-ACK message, Init Tag is equal to the Init Tag in the existing association. 6. Check D: Cookie, sent in the INIT-ACK message, is the newly generated Cookie with the information in the duplicate INIT message with local tie tag and peer tie tag equal to current verification tag and peer verification tag. =head1 NOTE None =head1 REFERENCE RFC 4960 5.2.1. INIT Received in COOKIE-WAIT or COOKIE-ECHOED State (Item B) This usually indicates an initialization collision, i.e., each endpoint is attempting, at about the same time, to establish an association with the other endpoint. Upon receipt of an INIT in the COOKIE-WAIT state, an endpoint MUST respond with an INIT ACK using the same parameters it sent in its original INIT chunk (including its Initiate Tag, unchanged). When responding, the endpoint MUST send the INIT ACK back to the same address that the original INIT (sent by this endpoint) was sent. =begin html
    Upon receipt of an INIT in the COOKIE-ECHOED state, an endpoint MUST
    respond with an INIT ACK using the same parameters it sent in its
    original INIT chunk (including its Initiate Tag, unchanged), provided
    that no NEW address has been added to the forming association.  If
    the INIT message indicates that a new address has been added to the
    association, then the entire INIT MUST be discarded, and NO changes
    should be made to the existing association.  An ABORT SHOULD be sent
    in response that MAY include the error 'Restart of an association
    with new addresses'.  The error SHOULD list the addresses that were
    added to the restarting association.
=end html When responding in either state (COOKIE-WAIT or COOKIE-ECHOED) with an INIT ACK, the original parameters are combined with those from the newly received INIT chunk. The endpoint shall also generate a State Cookie with the INIT ACK. The endpoint uses the parameters sent in its INIT to calculate the State Cookie. After that, the endpoint MUST NOT change its state, the T1-init timer shall be left running, and the corresponding TCB MUST NOT be destroyed. The normal procedures for handling State Cookies when a TCB exists will resolve the duplicate INITs to a single association. For an endpoint that is in the COOKIE-ECHOED state, it MUST populate its Tie-Tags within both the association TCB and inside the State Cookie (see Section 5.2.2 for a description of the Tie-Tags).