NAME

  ShutdownFromULP.seq - Termination of an association by receiving Terminate primitive from upper layers


PURPOSE

  To check that receiving Terminate primitive will cause the endpoint
  to send a SHUTDOWN message to its peer only when all the outstanding
  DATA has been acknowledged.


SYNOPSIS

  ./ShutdownFromULP.seq [-tooloption ...] -pkt ./ShutdownFromULP.def
    -tooloption : v6eval tool option
  See Also: ../common/STD_PKT_COMMON.def
            ../common/SCTP_COMMON.def


PRE-TEST CONDITION

  Association is established between endpoint A and B. Arrange the
  data in endpoint B such that Terminate primitive is received from
  upper layers.


TEST PROCEDURE

  Endpoint A                           Endpoint B                ULP
  (ESTABLISHED)                        (ESTABLISHED)
                                                   <---------    Send
  Don't send SACK     <---------------    DATA 
                                                   <---------    Terminate
                      <---------------    DATA  (retransmission)
  SACK                ---------------->
                      <---------------   SHUTDOWN
  SHUTDOWN ACK        --------------->
                      <---------------   SHUTDOWN COMPLETE
  TEST DESCRIPTION:
  1. Try to terminate an association between endpoint A and endpoint B by 
     sending Terminate primitive to endpoint B from ULP. Before sending 
     Terminate, send some data to endpoint A and don't send SACK for them 
     from A.
  2. Check A: SHUTDOWN message is sent to endpoint A.
  3. Check B: SHUTDOWN is sent only when any data queued up at B has been 
     sent to A and acknowledged by A.


NOTE

  None


REFERENCE

  RFC 4960
  9.2.  Shutdown of an Association
    Using the SHUTDOWN primitive (see Section 10.1), the upper layer of
    an endpoint in an association can gracefully close the association.
    This will allow all outstanding DATA chunks from the peer of the
    shutdown initiator to be delivered before the association terminates.
    Upon receipt of the SHUTDOWN primitive from its upper layer, the
    endpoint enters the SHUTDOWN-PENDING state and remains there until
    all outstanding data has been acknowledged by its peer.  The endpoint
    accepts no new data from its upper layer, but retransmits data to the
    far end if necessary to fill gaps.
    Once all its outstanding data has been acknowledged, the endpoint
    shall send a SHUTDOWN chunk to its peer including in the Cumulative
    TSN Ack field the last sequential TSN it has received from the peer.
    It shall then start the T2-shutdown timer and enter the SHUTDOWN-SENT
    state.  If the timer expires, the endpoint must resend the SHUTDOWN
    with the updated last sequential TSN received from its peer.