/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include <inet/ipclassifier.h>
#include <inet/ipp_common.h>
#include <inet/ipsec_impl.h>
#include "sctp_impl.h"
#include "sctp_asconf.h"
#include "sctp_addr.h"
/*
* PR-SCTP comments.
*
* When we get a valid Forward TSN chunk, we check the fragment list for this
* SSN and preceeding SSNs free all them. Further, if this Forward TSN causes
* the next expected SSN to be present in the stream queue, we deliver any
* such stranded messages upstream. We also update the SACK info. appropriately.
* When checking for advancing the cumulative ack (in sctp_cumack()) we must
* check for abandoned chunks and messages. While traversing the tramsmit
* list if we come across an abandoned chunk, we can skip the message (i.e.
* take it out of the (re)transmit list) since this message, and hence this
* chunk, has been marked abandoned by sctp_rexmit(). If we come across an
* unsent chunk for a message this now abandoned we need to check if a
* Forward TSN needs to be sent, this could be a case where we deferred sending
* a Forward TSN in sctp_get_msg_to_send(). Further, after processing a
* SACK we check if the Advanced peer ack point can be moved ahead, i.e.
* if we can send a Forward TSN via sctp_check_abandoned_data().
*/
void
{
sctp_set_t *p;
while (s) {
p = s->next;
s = p;
}
}
static void
{
sctp_set_t *p, *t;
return;
return;
*num = 1;
return;
}
/*
* Handle this special case here so we don't have to check
* for it each time in the loop.
*/
/* add a new set, and move the head pointer */
if (t == NULL)
return;
(*num)++;
*head = t;
return;
}
/*
* We need to handle the following cases, where p points to
* the current set (as we walk through the loop):
*
* 1. tsn is entirely less than p; create a new set before p.
* 2. tsn borders p from less; coalesce p with tsn.
* 3. tsn is withing p; do nothing.
* 4. tsn borders p from greater; coalesce p with tsn.
* 4a. p may now border p->next from less; if so, coalesce those
* two sets.
* 5. tsn is entirely greater then all sets; add a new set at
* the end.
*/
/* 1: add a new set before p. */
if (t == NULL)
return;
t->next = p;
if (p->prev) {
}
p->prev = t;
(*num)++;
return;
}
/* 2: adjust p->begin */
return;
}
/* 3; do nothing */
return;
}
/* 4; adjust p->end */
/* 4a: coalesce p and p->next */
t = p->next;
(*num)--;
}
return;
}
/* 5: add new set at the end */
if (t == NULL)
return;
t->prev = p;
p->next = t;
(*num)++;
return;
}
continue;
}
}
static void
{
sctp_set_t *p, *t;
return;
/* Nothing to remove */
return;
/* Find out where to start removing sets */
break;
}
/* adjust p */
/* all done */
if (p == *head)
return;
/* remove this set too */
p = p->next;
}
/* unlink everything before this set */
t = *head;
*head = p;
}
sctp_free_set(t);
/* recount the number of sets */
*num = 0;
(*num)++;
}
void
{
NULL, 0);
}
void
{
}
{
return (NULL);
}
return (NULL);
}
return (ch);
}
{
int pad;
if (!ch) {
return (NULL);
}
}
}
/*
* Attach ancillary data to a received SCTP segments.
* If the source address (fp) is not the primary, send up a
* unitdata_ind so recvfrom() can populate the msg_name field.
* If ancillary data is also requested, we append it to the
* unitdata_req. Otherwise, we just send up an optdata_ind.
*/
static int
{
int optlen;
int hdrlen;
/* Figure out address size */
} else {
}
/* If app asked to receive send / recv info */
if (sctp->sctp_recvsndrcvinfo)
goto noancillary;
if (hdrlen == 0)
hdrlen = sizeof (struct T_unitdata_ind);
}
/* If app asked for hoplimit and it has changed ... */
if (hdrlen == 0)
hdrlen = sizeof (struct T_unitdata_ind);
}
/* If app asked for tclass and it has changed ... */
if (hdrlen == 0)
hdrlen = sizeof (struct T_unitdata_ind);
}
/* If app asked for hopbyhop headers and it has changed ... */
if (hdrlen == 0)
hdrlen = sizeof (struct T_unitdata_ind);
return (-1);
}
/* If app asked for dst headers before routing headers ... */
if (hdrlen == 0)
hdrlen = sizeof (struct T_unitdata_ind);
return (-1);
}
/* If app asked for routing headers and it has changed ... */
if (hdrlen == 0)
hdrlen = sizeof (struct T_unitdata_ind);
return (-1);
}
/* If app asked for dest headers and it has changed ... */
if (hdrlen == 0)
hdrlen = sizeof (struct T_unitdata_ind);
return (-1);
}
/* Nothing to add */
if (hdrlen == 0)
return (-1);
return (-1);
if (sin4) {
} else {
}
if (sctp->sctp_recvsndrcvinfo) {
/* XXX need backout method if memory allocation fails. */
if (SCTP_DATA_GET_UBIT(dcp)) {
} else {
sri->sinfo_flags = 0;
}
sri->sinfo_context = 0;
sri->sinfo_timetolive = 0;
sri->sinfo_assoc_id = 0;
}
/*
* If app asked for pktinfo and the index has changed ...
* Note that the local address never changes for the connection.
*/
if (addflag.crb_ip_recvpktinfo) {
else
/* Save as "last" value */
}
/* If app asked for hoplimit and it has changed ... */
if (addflag.crb_ipv6_recvhoplimit) {
/* Save as "last" value */
}
/* If app asked for tclass and it has changed ... */
if (addflag.crb_ipv6_recvtclass) {
/* Save as "last" value */
}
if (addflag.crb_ipv6_recvhopopts) {
/* Save as last value */
}
if (addflag.crb_ipv6_recvrthdrdstopts) {
/* Save as last value */
}
if (addflag.crb_ipv6_recvrthdr) {
/* Save as last value */
}
if (addflag.crb_ipv6_recvdstopts) {
/* Save as last value */
}
return (0);
}
void
{
#ifdef DEBUG
#endif
#ifdef DEBUG
/* Partial delivery can leave empty srp */
#endif
}
}
}
/*
* If the series of data fragments of which dmp is a part is successfully
* reassembled, the first mblk in the series is returned. dc is adjusted
* to point at the data chunk in the lead mblk, and b_rptr also points to
* the data chunk; the following mblk's b_rptr's point at the actual payload.
*
* If the series is not yet reassembled, NULL is returned. dc is not changed.
* XXX should probably move this up into the state machine.
*/
/* Fragment list for un-ordered messages. Partial delivery is not supported */
static mblk_t *
{
#ifdef DEBUG
#endif
/* First frag. */
return (NULL);
}
/*
* Insert the segment according to the TSN, fragmented unordered
* chunks are sequenced by TSN.
*/
} else {
}
break;
}
break;
}
}
/* check if we completed a msg */
if (SCTP_DATA_GET_BBIT(*dc)) {
} else if (SCTP_DATA_GET_EBIT(*dc)) {
}
/*
* We walk consecutive TSNs backwards till we get a seg. with
* the B bit
*/
return (NULL);
}
if (SCTP_DATA_GET_BBIT(qdc)) {
break;
}
}
}
/*
* We walk consecutive TSNs till we get a seg. with the E bit
*/
return (NULL);
}
if (SCTP_DATA_GET_EBIT(qdc)) {
break;
}
}
}
return (NULL);
}
/* Got one!, Remove the msg from the list */
} else {
}
/*
* Null out b_next and b_prev and chain using b_cont.
*/
}
#ifdef DEBUG
}
#endif
return (begin);
}
/*
* Try partial delivery.
*/
static mblk_t *
{
/*
* This loop has two exit conditions: the
* end of received chunks has been reached, or
* there is a break in the sequence. We want
* to chop the reassembly list as follows (the
* numbers are TSNs):
* 10 -> 11 -> (end of chunks)
* 10 -> 11 -> | 13 (break in sequence)
*/
break;
tsn++;
}
/*
* We are sending all the fragments upstream, we have to retain
* the srp info for further fragments.
*/
} else {
/*
* There is a gap then some ordered frags which are not
* the next deliverable tsn. When the next deliverable
* frag arrives it will be set as the new list head in
* sctp_data_frag() by setting the B bit.
*/
}
/*
* mp now points at the last chunk in the sequence,
* and prev points to mp's previous in the list.
* We chop the list at prev. Subsequent fragment
* deliveries will follow the normal reassembly
* path unless they too exceed the sctp_pd_point.
*/
/*
* Adjust all mblk's except the lead so their rptr's point to the
* payload. sctp_data_chunk() will need to process the lead's
* data chunk section, so leave it's rptr pointing at the data chunk.
*/
}
}
/*
* Deduct the balance from got and needed here, now that
* we know we are actually delivering these data.
*/
}
}
}
return (dmp);
}
/*
* Handle received fragments for ordered delivery to upper layer protocol.
* Manage the per message reassembly queue and if this fragment completes
* reassembly of the message, or qualifies the already reassembled data
* for partial delivery, prepare the message for delivery upstream.
*
* tpfinished in the caller remains set only when the incoming fragment
* has completed the reassembly of the message associated with its ssn.
*/
static mblk_t *
{
*error = 0;
/*
* Find the reassembly queue for this data chunk, if none
* yet exists, a new per message queue will be created and
* appended to the end of the list of per message queues.
*
* sip points on sctp_instr_t representing instream messages
* as yet undelivered for this stream (sid) of the association.
*/
goto foundit;
break;
}
/*
* First fragment of this message received, allocate a M_CTL that
* will head the reassembly queue for this message. The message
* and all its fragments are identified by having the same ssn.
*
* Arriving fragments will be inserted in tsn order on the
* reassembly queue for this message (ssn), linked by b_cont.
*/
return (NULL);
}
/*
* All per ssn reassembly queues, (one for each message) on
* instr_reass of the instream structure associated with this
* stream id, (sip is initialized as sctp->sctp_instr[sid]).
* Insert the new reassembly queue in the correct (ssn) order.
*/
if (reassq_next != NULL) {
/* head insertion */
} else {
/* mid queue insertion */
}
} else {
/* place new reassembly queue at the end */
} else {
}
}
/* tail always the highest tsn on the reassembly queue for this ssn */
if (SCTP_DATA_GET_BBIT(*dc)) {
/* Incoming frag is flagged as the beginning of message */
} else if (srp->sr_partial_delivered &&
/*
* The real beginning fragment of the message was already
* delivered upward, so this is the earliest frag expected.
* Fake the B-bit then see if this frag also completes the
* message.
*/
if (SCTP_DATA_GET_EBIT(*dc)) {
/* This frag is marked as the end of message */
/* Got all fragments of this message now */
goto frag_done;
}
srp->sr_nexttsn++;
}
/* The only fragment of this message currently queued */
*tpfinished = B_FALSE;
return (NULL);
/*
* This message already has a reassembly queue. Insert the new frag
* in the reassembly queue. Try the tail first, on the assumption
* that the fragments are arriving in order.
*/
/*
* A NULL tail means all existing fragments of the message have
* been entirely consumed during a partially delivery.
*/
goto empty_srp;
} else {
/*
* If partial delivery did take place but the next arriving
* fragment was not the next to be delivered, or partial
* delivery broke off due to a gap, fragments remain on the
* tail. The next fragment due to be delivered still has to
* be set as the new head of list upon arrival. Fake B-bit
* on that frag then see if it also completes the message.
*/
if (srp->sr_partial_delivered &&
if (SCTP_DATA_GET_EBIT(*dc)) {
/* Got all fragments of this message now */
goto frag_done;
}
}
}
/* grab the frag header of already queued tail frag for comparison */
/* check if the frag goes on the tail in order */
srp->sr_nexttsn++;
}
goto inserted;
}
/* Next check if we should insert this frag at the beginning */
if (SCTP_DATA_GET_BBIT(*dc)) {
}
goto preinserted;
}
/* Insert this frag in it's correct order in the middle */
for (;;) {
/* Tail check above should have caught this */
/* insert here */
break;
}
}
/*
* Need head of message and to be due to deliver, otherwise skip
* the recalculation of the message length below.
*/
goto inserted;
/*
* fraglen contains the length of consecutive chunks of fragments.
* starting from the chunk we just inserted.
*/
break;
tsn++;
}
/* Prior to this frag either the beginning or end frag was missing */
/* used to check if we have the first and last fragments */
/*
* If we now have both the beginning and the end of the message,
* calculate how many fragments in the complete message.
*/
}
}
/*
* Try partial delivery if the message length has exceeded the
* partial delivery point. Only do this if we can immediately
* deliver the partially assembled message, and only partially
* deliver one message at a time (i.e. messages cannot be
* intermixed arriving at the upper layer).
* sctp_try_partial_delivery() will return a message consisting
* of only consecutive fragments.
*/
/* we don't have the full message yet */
}
*tpfinished = B_FALSE;
/*
* NULL unless a segment of the message now qualified for
* partial_delivery and has been prepared for delivery by
* sctp_try_partial_delivery().
*/
return (dmp);
}
/*
* Reassembly complete for this message, prepare the data for delivery.
* First unlink the reassembly queue for this ssn from the list of
* messages in reassembly.
*/
if (reassq_curr->b_next)
} else {
if (reassq_curr->b_next)
}
/*
* Need to clean up b_prev and b_next as freeb() will
* ASSERT that they are unused.
*/
dmp = reassq_curr;
/* point to the head of the reassembled data message */
/* Tell our caller that we are returning a complete message. */
*tpfinished = B_TRUE;
/*
* Adjust all mblk's except the lead so their rptr's point to the
* payload. sctp_data_chunk() will need to process the lead's data
* data chunk section, so leave its rptr pointing at the data chunk
* header.
*/
}
return (dmp);
}
static void
{
return;
}
/* first time? */
return;
}
}
/* maximum reached */
return;
}
/* add the duplicate tsn */
}
/*
* All incoming sctp data, complete messages and fragments are handled by
* this function. Unless the U-bit is set in the data chunk it will be
* delivered in order or queued until an in-order delivery can be made.
*/
static void
{
int ubit;
int sid;
int isfrag;
int dlen;
int error;
/* The following are used multiple times, so we inline them */
if ((sctp)->sctp_sack_gaps > 0) \
/* Got a gap; record it */ \
&sctp->sctp_sack_gaps); \
}
/* Check for duplicates */
return;
}
/* Check for dups of sack'ed data */
dprint(4,
("sctp_data_chunk: dropping dup > "
"cumtsn\n"));
return;
}
}
}
/* We can no longer deliver anything up, but still need to handle it. */
if (SCTP_IS_DETACHED(sctp)) {
}
/*
* Check for buffer space. Note if this is the next expected TSN
* we have to take it to avoid deadlock because we cannot deliver
* later queued TSNs and thus clear buffer space without it.
* We drop anything that is purely zero window probe data here.
*/
/* Drop and SACK, but don't advance the cumulative TSN. */
dprint(0, ("sctp_data_chunk: exceed rwnd %d rxqueued %d "
return;
}
/* Data received for a stream not negotiated for this association */
/* Will populate the CAUSE block in the ERROR chunk. */
/* RESERVED, ignored at the receiving end */
inval_parm.bsc_pad = 0;
/* ack and drop it */
sizeof (sctp_bsc_t), fp);
return;
}
/* unordered delivery OK for this data if ubit set */
/* select per stream structure for this stream from the array */
/* Initialize the stream, if not yet used */
/* Begin and End bit set would mean a complete message */
/* The ssn of this sctp message and of any fragments in it */
/* drop it and don't ack, let the peer retransmit */
return;
}
/*
* Past header and payload, note: the underlying buffer may
* contain further chunks from the same incoming IP packet,
* if so db_ref will be greater than one.
*/
if (isfrag) {
error = 0;
/* fragmented data chunk */
if (ubit) {
/* prepare data for unordered delivery */
#if DEBUG
}
#endif
} else {
/*
* Assemble fragments and queue for ordered delivery,
* dmp returned is NULL or the head of a complete or
* "partial delivery" message. Any returned message
* and all its fragments will have the same ssn as the
* input fragment currently being handled.
*/
&tpfinished);
}
/* back out the adjustment made earlier */
/*
* Don't ack the segment,
* the peer will retransmit.
*/
return;
}
/*
* The frag has been queued for later in-order delivery,
* but the cumulative TSN may need to advance, so also
* need to perform the gap ack checks at the done label.
*/
goto done;
}
}
/*
* Unless message is the next for delivery to the ulp, queue complete
* message in the correct order for ordered delivery.
* Note: tpfinished is true when the incoming chunk contains a complete
* message or is the final missing fragment which completed a message.
*/
/* Adjust rptr to point at the data chunk for compares */
dprint(2,
("data_chunk: inserted %x in pq (ssn %d expected %d)\n",
} else {
/*
* XXXNeed to take sequence wraps into account,
* ... and a more efficient insertion algo.
*/
for (;;) {
} else {
}
break;
}
break;
}
}
}
(instr->istr_nmsgs)++;
(sctp->sctp_istr_nmsgs)++;
return;
}
/*
* Deliver the data directly. Recalculate dlen now since
* we may have just reassembled this data.
*/
/* Deliver the message. */
if (can_deliver) {
/* step past header to the payload */
/*
* We overload the meaning of b_flag for SCTP sockfs
* internal use, to advise sockfs of partial delivery
* semantics.
*/
if (sctp->sctp_flowctrld) {
}
}
} else {
/* No memory don't ack, the peer will retransmit. */
return;
}
} else {
/* Closed above, ack to peer and free the data */
}
/*
* Data now enqueued, may already have been processed and free'd
* by the ULP (or we may have just freed it above, if we could not
* deliver), so we must not reference it (this is why we saved the
* ssn and ubit earlier).
*/
if (ubit != 0) {
goto done;
}
/*
* There was a partial delivery and it has not finished,
* don't pull anything from the pqueues or increment the
* nextseq. This msg must complete before starting on
* the next ssn and the partial message must have the
* same ssn as the next expected message..
*/
if (!tpfinished) {
/*
* Verify the partial delivery is part of the
* message expected for ordered delivery.
*/
" delivery error, sctp 0x%p"
" sid = 0x%x ssn != nextseq"
" tsn 0x%x ftsn 0x%x"
" ssn 0x%x nextseq 0x%x",
}
goto done;
}
"sid = 0x%x ssn != nextseq ssn 0x%x nextseq 0x%x",
}
/*
* Deliver any successive data chunks waiting in the instr pqueue
* for the data just sent up.
*/
while (instr->istr_nmsgs > 0) {
/* Stop at the first gap in the sequence */
break;
/*
* Ready to deliver all data before the gap
* to the upper layer.
*/
(instr->istr_nmsgs)--;
(sctp->sctp_istr_nmsgs)--;
/*
* Composite messages indicate this chunk was reassembled,
* each b_cont represents another TSN; Follow the chain to
* reach the frag with the last tsn in order to advance ftsn
* shortly by calling SCTP_ACK_IT().
*/
if (can_deliver) {
/*
* Meaning of b_flag overloaded for SCTP sockfs
* internal use, advise sockfs of partial
* delivery semantics.
*/
0 : SCTP_PARTIAL_DATA;
if (sctp->sctp_flowctrld) {
}
}
} else {
/* don't ack, the peer will retransmit */
return;
}
} else {
/* Closed above, ack and free the data */
}
}
done:
/*
* If there are gap reports pending, check if advancing
* the ftsn here closes a gap. If so, we can advance
* ftsn to the end of the set.
*/
}
/*
* If ftsn has moved forward, maybe we can remove gap reports.
* NB: dmp may now be NULL, so don't dereference it here.
*/
&sctp->sctp_sack_gaps);
}
#ifdef DEBUG
}
#endif
}
void
{
/* Chunk hdr */
/* SACK chunk */
} else {
sc->ssc_a_rwnd = 0;
}
/* Remember the last window sent to peer. */
sc->ssc_numdups = 0;
/* lay in gap reports */
/* start */
} else {
/* sequence number wrap */
}
/* end */
} else {
/* sequence number wrap */
}
sf++;
/* This is just for debugging (a la the following assertion) */
num_gaps--;
}
/* If the SACK timer is running, stop it */
if (sctp->sctp_ack_timer_running) {
}
}
mblk_t *
{
if (sctp->sctp_force_sack) {
sctp->sctp_force_sack = 0;
goto checks_done;
}
/* no need to SACK right now */
(void *)sctp));
return (NULL);
sctp->sctp_sack_toggle = 0;
}
}
(void *)sctp));
return (NULL);
}
else
dups_len = 0;
/*
* If there are error chunks, check and see if we can send the
* SACK chunk and error chunks together in one packet. If not,
* send the error chunks out now.
*/
sctp->sctp_err_len = 0;
return (NULL);
}
sctp->sctp_err_len = 0;
}
}
return (NULL);
}
}
sctp->sctp_err_len = 0;
}
return (smp);
}
/*
* Check and see if we need to send a SACK chunk. If it is needed,
* send it out. Return true if a SACK chunk is sent, false otherwise.
*/
{
/* If we are shutting down, let send_shutdown() bundle the SACK */
sctp_send_shutdown(sctp, 0);
}
/* The caller of sctp_sack() will not free the dups mblk. */
return (B_FALSE);
}
(void *)sctp->sctp_lastdata,
return (B_TRUE);
}
/*
* This is called if we have a message that was partially sent and is
* abandoned. The cum TSN will be the last chunk sent for this message,
* subsequent chunks will be marked ABANDONED. We send a Forward TSN
* chunk in this case with the TSN of the last sent chunk so that the
* peer can clean up its fragment list for this message. This message
* will be removed from the transmit list when the peer sends a SACK
* back.
*/
int
{
if (!ubit &&
return (ENOMEM);
}
return (ENOMEM);
}
return (ENOMEM);
}
if (!fp->sf_timer_running)
}
/*
* Update ULP the amount of queued data, which is
* sent-unack'ed + unsent.
*/
if (!SCTP_IS_DETACHED(sctp))
return (0);
}
return (-1);
}
{
/*
* Free messages only when they're completely acked.
*/
if (SCTP_CHUNK_ABANDONED(mp)) {
break;
}
/*
* We check for abandoned message if we are PR-SCTP
* aware, if this is not the first chunk in the
* message (b_cont) and if the message is marked
* abandoned.
*/
if (!SCTP_CHUNK_ISSENT(mp)) {
if (sctp->sctp_prsctp_aware &&
(SCTP_IS_MSG_ABANDONED(ump) ||
sctp))) {
(void) sctp_check_abandoned_msg(sctp,
ump);
}
goto cum_ack_done;
}
continue;
if (sctp->sctp_out_time != 0 &&
/* Got a new RTT measurement */
ddi_get_lbolt64() -
sctp->sctp_out_time = 0;
}
if (SCTP_CHUNK_ISACKED(mp))
continue;
SCTP_CHUNK_SET_SACKCNT(mp, 0);
sctp->sctp_unacked -=
/* all outstanding data acked */
} else {
}
} else {
goto cum_ack_done;
}
}
if (SCTP_IS_MSG_ABANDONED(ump)) {
} else {
}
}
*first_unacked = mp;
if (cumack_forward > 0) {
}
/*
* Update ULP the amount of queued data, which is
* sent-unack'ed + unsent.
*/
if (!SCTP_IS_DETACHED(sctp))
/* Time to send a shutdown? */
sctp_send_shutdown(sctp, 0);
}
} else {
/* dup ack */
}
return (cumack_forward);
}
static int
{
sctp->sctp_frwnd = 0;
return (0);
}
return (1);
} else {
return (0);
}
}
/*
* For un-ordered messages.
* Walk the sctp->sctp_uo_frag list and remove any fragments with TSN
* strictly in sequence (w.r.t TSN).
*/
static int
{
int dlen = 0;
return (dlen);
}
return (dlen);
}
/*
* For ordered messages.
* Check for existing fragments for an sid-ssn pair reported as abandoned,
* hence will not receive, in the Forward TSN. If there are fragments, then
* we just nuke them. If and when Partial Delivery API is supported, we
* would need to send a notification to the upper layer about this.
*/
static int
{
int dlen = 0;
return (dlen);
/*
* If we had sent part of this message up, send a partial
* delivery event. Since this is ordered delivery, we should
* have sent partial message only for the next in sequence,
* hence the ASSERT. See comments in sctp_data_chunk() for
* trypartial.
*/
if (srp->sr_partial_delivered) {
" delivery notify, sctp 0x%p"
" sip = 0x%p ssn != nextseq"
" ssn 0x%x nextseq 0x%x",
}
/* Take it out of the reass queue */
}
}
return (dlen);
}
/*
* Update sctp_ftsn to the cumulative TSN from the Forward TSN chunk. Remove
* any SACK gaps less than the newly updated sctp_ftsn. Walk through the
* sid-ssn pair in the Forward TSN and for each, clean the fragment list
* for this pair, if needed, and check if we can deliver subsequent
* messages, if any, from the instream queue (that were waiting for this
* sid-ssn message to show up). Once we are done try to update the SACK
* info. We could get a duplicate Forward TSN, in which case just send
* a SACK. If any of the sid values in the Forward TSN is invalid,
* send back an "Invalid Stream Identifier" error and continue processing
* the rest.
*/
static void
{
int flen;
if (SCTP_IS_DETACHED(sctp)) {
}
/*
* un-ordered messages don't have SID-SSN pair entries, we check
* for any fragments (for un-ordered message) to be discarded using
* the cumulative FTSN.
*/
if (flen > 0) {
}
while (remaining >= sizeof (*ftsn_entry)) {
/* Will populate the CAUSE block in the ERROR chunk. */
/* RESERVED, ignored at the receiving end */
inval_parm.bsc_pad = 0;
ftsn_entry++;
remaining -= sizeof (*ftsn_entry);
continue;
}
/* Indicates frags were nuked, update rxqueued */
if (flen > 0) {
}
/*
* It is possible to receive an FTSN chunk with SSN smaller
* than then nextseq if this chunk is a retransmission because
* of incomplete processing when it was first processed.
*/
while (instr->istr_nmsgs > 0) {
break;
}
if (can_deliver) {
int error;
/*
* Override b_flag for SCTP sockfs
* internal use
*/
if (sctp->sctp_flowctrld) {
}
if (sctp->sctp_ulp_recv(
}
} else {
/*
* We will resume processing when
* the FTSN chunk is re-xmitted.
*/
dprint(0,
("FTSN dequeuing %u failed\n",
return;
}
} else {
}
instr->istr_nmsgs--;
sctp->sctp_istr_nmsgs--;
}
ftsn_entry++;
remaining -= sizeof (*ftsn_entry);
}
/* Duplicate FTSN */
return;
}
/* Advance cum TSN to that reported in the Forward TSN chunk */
/* Remove all the SACK gaps before the new cum TSN */
&sctp->sctp_sack_gaps);
}
/*
* If there are gap reports pending, check if advancing
* the ftsn here closes a gap. If so, we can advance
* ftsn to the end of the set.
* If ftsn has moved forward, maybe we can remove gap reports.
*/
&sctp->sctp_sack_gaps);
}
}
/*
* When we have processed a SACK we check to see if we can advance the
* cumulative TSN if there are abandoned chunks immediately following
* the updated cumulative TSN. If there are, we attempt to send a
* Forward TSN chunk.
*/
static void
{
/*
* We only check in the first meta since otherwise we can't
* advance the cumulative ack point. We just look for chunks
* marked for retransmission, else we might prematurely
* send an FTSN for a sent, but unacked, chunk.
*/
if (!SCTP_CHUNK_ISSENT(mp))
return;
if (SCTP_CHUNK_WANT_REXMIT(mp))
break;
}
return;
if (!fp->sf_timer_running)
return;
}
if (!fp->sf_timer_running)
}
}
/*
* The processing here follows the same logic in sctp_got_sack(), the reason
* we do this separately is because, usually, gap blocks are ordered and
* we can process it in sctp_got_sack(). However if they aren't we would
* need to do some additional non-optimal stuff when we start processing the
* unordered gaps. To that effect sctp_got_sack() does the processing in the
* simple case and this does the same in the more involved case.
*/
static uint32_t
{
int gapcnt;
int gstart;
/*
* gstart tracks the last (in the order of TSN) gapstart that
* we process in this SACK gaps walk.
*/
if (gapstart != 0) {
/*
* If we have reached the end of the transmit list or
* hit an unsent chunk or encountered an unordered gap
* block start from the ctsn again.
*/
}
}
/*
* Sanity checks:
*
* 1. SACK for TSN we have not sent - ABORT
* 2. Invalid or spurious gaps, ignore all gaps
*/
*trysend = -1;
return (acked);
break;
}
/*
* The xtsn can be the TSN processed for the last gap
* (gapend) or it could be the cumulative TSN. We continue
* with the last xtsn as long as the gaps are ordered, when
* we hit an unordered gap, we re-start from the cumulative
* TSN. For the first gap it is always the cumulative TSN.
*/
/*
* We can't reliably check for reneged chunks
* when walking the unordered list, so we don't.
* In case the peer reneges then we will end up
* sending the reneged chunk via timeout.
*/
/*
* ump can't be NULL because of the sanity
* check above.
*/
}
/*
* mp can't be unsent because of the sanity check
* above.
*/
}
/*
* Now that we have found the chunk with TSN == 'gapstart',
* let's walk till we hit the chunk with TSN == 'gapend'.
* All intermediate chunks will be marked ACKED, if they
* haven't already been.
*/
/*
* SACKed
*/
SCTP_CHUNK_SET_SACKCNT(mp, 0);
if (!SCTP_CHUNK_ISACKED(mp)) {
/* All outstanding data acked. */
}
}
/*
* Move to the next message in the transmit list
* if we are done with all the chunks from the current
* message. Note, it is possible to hit the end of the
* transmit list here, i.e. if we have already completed
* processing the gap block.
*/
break;
}
}
/*
* Likewise, we can hit an unsent chunk once we have
* completed processing the gap block.
*/
if (!SCTP_CHUNK_ISSENT(mp)) {
break;
}
}
/*
* We keep track of the last gap we successfully processed
* so that we can terminate the walk below for incrementing
* the SACK count.
*/
}
/*
* Check if have incremented the SACK count for all unacked TSNs in
* sctp_got_sack(), if so we are done.
*/
return (acked);
/*
* We have incremented SACK count for TSNs less than fr_tsn
* in sctp_got_sack(), so don't increment them again here.
*/
if (SCTP_CHUNK_SACKCNT(mp) ==
*trysend = 1;
if (!*fast_recovery) {
/*
* Entering fast recovery.
*/
fp->sf_ssthresh =
}
*fast_recovery = B_TRUE;
}
}
}
/* We can't get to the end of the transmit list here */
}
/* We can't hit an unsent chunk here */
}
return (acked);
}
static int
{
int num_gaps;
int trysend = 0;
int i;
return (0);
cumtsn));
/* out of order */
return (0);
/* Send an ABORT */
return (-1);
}
/*
* Cwnd only done when not in fast recovery mode.
*/
/*
* .. and if the cum TSN is not moving ahead on account Forward TSN
*/
else
/*
* If we were doing a zero win probe and the win
* has now opened to at least MSS, re-transmit the
* zero win probe via sctp_rexmit_packet().
*/
/*
* Reset the RTO since we have been backing-off
* to send the ZWP.
*/
/* Resend the ZWP */
&pkt_len);
return (0);
}
}
} else {
if (sctp->sctp_zero_win_probe) {
/*
* Reset the RTO since we have been backing-off
* to send the ZWP.
*/
/* This is probably not required */
if (!sctp->sctp_rexmitting) {
}
}
if (acked > 0) {
trysend = 1;
sctp->sctp_adv_pap)) {
}
}
}
goto ret;
}
#ifdef DEBUG
/*
* Since we delete any message that has been acked completely,
* the unacked chunk must belong to sctp_xmit_head (as
* we don't have a back pointer from the mp to the meta data
* we do this).
*/
{
break;
}
}
#endif
/*
* Just remember where we started from, in case we need to call
* sctp_process_uo_gaps() if the gap blocks are unordered.
*/
/*
* Go through SACK gaps. They are ordered based on start TSN.
*/
if (gapstart != 0) {
/* check for unordered gap */
if (trysend < 0) {
return (-1);
}
break;
}
}
/*
* Sanity checks:
*
* 1. SACK for TSN we have not sent - ABORT
* 2. Invalid or spurious gaps, ignore all gaps
*/
return (-1);
break;
}
/*
* Let's start at the current TSN (for the 1st gap we start
* from the cumulative TSN, for subsequent ones we start from
* where the previous gapend was found - second while loop
* below) and walk the transmit list till we find the TSN
* corresponding to gapstart. All the unacked chunks till we
* get to the chunk with TSN == gapstart will have their
* SACKCNT incremented by 1. Note since the gap blocks are
* ordered, we won't be incrementing the SACKCNT for an
* unacked chunk by more than one while processing the gap
* blocks. If the SACKCNT for any unacked chunk exceeds
* the fast retransmit threshold, we will fast retransmit
* after processing all the gap blocks.
*/
if (SCTP_CHUNK_SACKCNT(mp) ==
trysend = 1;
if (!fast_recovery) {
/*
* Entering fast recovery.
*/
fp->sf_ssthresh =
}
}
}
/*
* Peer may have reneged on this chunk, so un-sack
* it now. If the peer did renege, we need to
* readjust unacked.
*/
if (SCTP_CHUNK_ISACKED(mp)) {
if (!fp->sf_timer_running) {
}
}
/*
* ump can't be NULL given the sanity check
* above. But if it is NULL, it means that
* there is a data corruption. We'd better
* panic.
*/
panic("Memory corruption detected: gap "
"start TSN 0x%x missing from the "
"xmit list: %p", gapstart,
(void *)sctp);
}
}
/*
* mp can't be unsent given the sanity check above.
*/
}
/*
* Now that we have found the chunk with TSN == 'gapstart',
* let's walk till we hit the chunk with TSN == 'gapend'.
* All intermediate chunks will be marked ACKED, if they
* haven't already been.
*/
/*
* SACKed
*/
SCTP_CHUNK_SET_SACKCNT(mp, 0);
if (!SCTP_CHUNK_ISACKED(mp)) {
/* All outstanding data acked. */
}
}
/* Go to the next chunk of the current message */
/*
* Move to the next message in the transmit list
* if we are done with all the chunks from the current
* message. Note, it is possible to hit the end of the
* transmit list here, i.e. if we have already completed
* processing the gap block. But the TSN must be equal
* to the gapend because of the above sanity check.
* If it is not equal, it means that some data is
* missing.
* Also, note that we break here, which means we
* continue processing gap blocks, if any. In case of
* ordered gap blocks there can't be any following
* this (if there is it will fail the sanity check
* above). In case of un-ordered gap blocks we will
* switch to sctp_process_uo_gaps(). In either case
* but we just reset it to xmit_head.
*/
panic("Memory corruption "
"detected: gap end TSN "
"0x%x missing from the "
"xmit list: %p", gapend,
(void *)sctp);
}
break;
}
}
/*
* Likewise, we could hit an unsent chunk once we have
* completed processing the gap block. Again, it is
* fine to continue processing gap blocks with mp
* pointing to the unsent chunk, because if there
* are more ordered gap blocks, they will fail the
* sanity check, and if there are un-ordered gap blocks,
* we will continue processing in sctp_process_uo_gaps()
* We just reset the mp to the one we started with.
*/
if (!SCTP_CHUNK_ISSENT(mp)) {
break;
}
}
}
if (sctp->sctp_prsctp_aware)
if (sctp->sctp_chk_fast_rexmit)
ret:
/*
* If receive window is closed while there is unsent data,
* set a timer for doing zero window probes.
*/
sctp->sctp_unsent != 0) {
}
/*
* Set cwnd for all destinations.
* Congestion window gets increased only when cumulative
* TSN moves forward, we're not in fast recovery, and
* cwnd has been fully utilized (almost fully, need to allow
* some leeway due to non-MSS sized messages).
*/
/*
* Fast-path, only data sent to sctp_current got acked.
*/
if (cumack_forward && !fast_recovery &&
/*
* Slow start
*/
} else {
}
} else {
/*
* Congestion avoidance
*/
}
}
}
/*
* Limit the burst of transmitted data segments.
*/
}
goto check_ss_rxmit;
}
} else {
}
} else {
}
}
}
}
}
/*
* If this is a SACK following a timeout, check if there are
* still unacked chunks (sent before the timeout) that we can
* send.
*/
if (sctp->sctp_rexmitting) {
/*
* As we are in retransmission phase, we may get a
* SACK which indicates some new chunks are received
* but cum_tsn does not advance. During this
* phase, the other side advances cum_tsn only because
* it receives our retransmitted chunks. Only
* this signals that some chunks are still
* missing.
*/
if (cumack_forward) {
}
} else {
fp->sf_rxt_unacked = 0;
}
}
return (trysend);
}
/*
* Returns 0 if the caller should stop processing any more chunks,
* 1 if the caller should skip this chunk and continue processing.
*/
static int
{
/* check top two bits for action required */
/* skip and continue */
return (1);
} else {
/* stop processing */
return (0);
}
}
/* skip and continue, no error */
return (1);
}
/* top two bits are clear; stop processing and no error */
return (0);
}
/*
* Basic sanity checks on all input chunks and parameters: they must
* be of legitimate size for their purported type, and must follow
* ordering conventions as defined in rfc2960.
*
* Returns 1 if the chunk and all encloded params are legitimate,
* 0 otherwise.
*/
/*ARGSUSED*/
static int
{
void *p = NULL;
return (0);
}
case CHUNK_DATA:
if (ch_len < sizeof (sctp_data_hdr_t)) {
return (0);
}
return (1);
case CHUNK_INIT:
case CHUNK_INIT_ACK:
{
/*
* INIT and INIT-ACK chunks must not be bundled with
* any other.
*/
sizeof (sctp_init_chunk_t)))) {
return (0);
}
/* may have params that need checking */
sizeof (sctp_init_chunk_t));
}
break;
case CHUNK_SACK:
return (0);
}
/* dup and gap reports checked by got_sack() */
return (1);
case CHUNK_SHUTDOWN:
return (0);
}
return (1);
case CHUNK_ABORT:
case CHUNK_ERROR:
return (0);
}
/* may have params that need checking */
p = ch + 1;
break;
case CHUNK_ECNE:
case CHUNK_CWR:
case CHUNK_HEARTBEAT:
case CHUNK_HEARTBEAT_ACK:
/* Full ASCONF chunk and parameter checks are in asconf.c */
case CHUNK_ASCONF:
case CHUNK_ASCONF_ACK:
return (0);
}
/* heartbeat data checked by process_heartbeat() */
return (1);
case CHUNK_SHUTDOWN_COMPLETE:
{
/*
* SHUTDOWN-COMPLETE chunk must not be bundled with any
* other
*/
return (0);
}
}
return (1);
case CHUNK_COOKIE:
case CHUNK_COOKIE_ACK:
case CHUNK_SHUTDOWN_ACK:
return (0);
}
return (1);
case CHUNK_FORWARD_TSN:
return (0);
return (1);
default:
return (1); /* handled by strange_chunk() */
}
/* check and byteorder parameters */
if (clen <= 0) {
return (1);
}
ph = p;
return (0);
}
}
/* All OK */
return (1);
}
static mblk_t *
{
} else {
}
if (policy_present) {
/*
* The conn_t parameter is NULL because we already know
* nobody's home.
*/
return (NULL);
}
return (mp);
}
/* Handle out-of-the-blue packets */
void
{
/*
* All subsequent code is vastly simplified if it can
* assume a single contiguous chunk of data.
*/
return;
}
}
} else {
}
return;
}
case CHUNK_INIT:
/* no listener; send abort */
return;
break;
case CHUNK_INIT_ACK:
/* check for changed src addr */
/* success; proceed to normal path */
if (sctp->sctp_running) {
} else {
/*
* If the source address is changed, we
* don't need to worry too much about
* out of order processing. So we don't
* check if the recvq is empty or not here.
*/
}
return;
}
/* else bogus init ack; drop it */
break;
case CHUNK_SHUTDOWN_ACK:
return;
return;
case CHUNK_ERROR:
case CHUNK_ABORT:
case CHUNK_COOKIE_ACK:
case CHUNK_SHUTDOWN_COMPLETE:
break;
default:
return;
break;
}
}
/*
* Handle sctp packets.
* Note that we rele the sctp_t (the caller got a reference on it).
*/
void
{
/*
* We check some fields in conn_t without holding a lock.
* This should be fine.
*/
if (((iraflags & IRAF_IS_IPV4) ?
secure) {
/* Note that mp is NULL */
return;
}
}
if (sctp->sctp_running) {
goto done;
} else {
goto done;
}
}
else
done:
}
static void
{
/*
* SCTP_COMM_LOST is only sent up if the association is
* established (sctp_state >= SCTPS_ESTABLISHED).
*/
}
}
void
{
int gotdata;
int trysend;
int recv_adaptation;
/*
* All subsequent code is vastly simplified if it can
* assume a single contiguous chunk of data.
*/
return;
}
}
ipp.ipp_fields = 0;
/*
* Record packet information in the ip_pkt_t
*/
B_FALSE);
} else {
/*
* IPv6 packets can only be received by applications
* that are prepared to receive IPv6 addresses.
* The IP fanout must ensure this.
*/
&nexthdrp);
/* Could have caused a pullup? */
}
}
} else {
}
return;
}
goto done;
}
/*
* Check verfication tag (special handling for INIT,
* COOKIE, SHUTDOWN_COMPLETE and SHUTDOWN_ACK chunks).
* ABORTs are handled in the chunk processing loop, since
* may not appear first. All other checked chunks must
* appear first, or will have been dropped by check_input().
*/
case CHUNK_INIT:
/* drop it */
goto done;
}
break;
case CHUNK_SHUTDOWN_COMPLETE:
break;
SCTP_GET_TBIT(ch)) {
break;
}
/* else drop it */
goto done;
case CHUNK_ABORT:
case CHUNK_COOKIE:
/* handled below */
break;
case CHUNK_SHUTDOWN_ACK:
/* treat as OOTB */
return;
}
/* else fallthru */
default:
/*
* All other packets must have a valid
* verification tag, however if this is a
* listener, we use a refined version of
* out-of-the-blue logic.
*/
/* drop it */
goto done;
}
break;
}
/* Have a valid sctp for this packet */
gotdata = 0;
trysend = 0;
/* Process the chunks */
do {
/* drop it */
goto done;
}
}
switch (sctp->sctp_state) {
case SCTPS_ESTABLISHED:
case SCTPS_SHUTDOWN_PENDING:
case SCTPS_SHUTDOWN_SENT:
case CHUNK_DATA:
/* 0-length data chunks are not allowed */
SCTP_ERR_NO_USR_DATA, (char *)&tsn,
0, NULL);
goto done;
}
gotdata = 1;
/* Restart shutdown timer if shutting down */
/*
* If we have exceeded our max
* wait bound for waiting for a
* shutdown ack from the peer,
* abort the association.
*/
if (sctps->sctps_shutack_wait_bound !=
0 &&
sctp->sctp_out_time) >
SCTP_COMM_LOST, 0, NULL);
goto done;
}
}
break;
case CHUNK_SACK:
/*
* Peer is real and alive if it can ack our
* data.
*/
if (trysend < 0) {
SCTP_COMM_LOST, 0, NULL);
goto done;
}
break;
case CHUNK_HEARTBEAT:
if (!hb_already) {
/*
* In any one packet, there should
* only be one heartbeat chunk. So
* we should not process more than
* once.
*/
hb_already = B_TRUE;
}
break;
case CHUNK_HEARTBEAT_ACK:
break;
case CHUNK_SHUTDOWN:
break;
case CHUNK_SHUTDOWN_ACK:
SCTP_SHUTDOWN_COMP, 0, NULL);
sctp_clean_death(sctp, 0);
goto done;
}
break;
case CHUNK_ABORT: {
/* Ignore if delete pending */
if (sp->saddr_ipif_delete_pending) {
break;
}
goto done;
}
case CHUNK_INIT:
break;
case CHUNK_COOKIE:
0, NULL);
if (recv_adaptation) {
}
} else {
}
break;
case CHUNK_ERROR: {
int error;
ira);
if (error != 0) {
0, NULL);
goto done;
}
break;
}
case CHUNK_ASCONF:
break;
case CHUNK_ASCONF_ACK:
break;
case CHUNK_FORWARD_TSN:
gotdata = 1;
break;
default:
goto nomorechunks;
} /* else skip and continue processing */
break;
}
break;
case SCTPS_LISTEN:
case CHUNK_INIT:
break;
case CHUNK_COOKIE: {
ira) == -1) {
goto done;
}
/*
* The cookie is good; ensure that
* the peer used the verification
* tag from the init ack in the header.
*/
goto done;
goto done;
}
/*
* If there were extra chunks
* bundled with the cookie,
* they must be processed
* on the eager's queue. We
* accomplish this by refeeding
* the whole packet into the
* state machine on the right
* q. The packet (mp) gets
* there via the eager's
* cookie_mp field (overloaded
* with the active open role).
* This is picked up when
* processing the null bind
* request put on the eager's
* q by sctp_accept(). We must
* first revert the cookie
* chunk's length field to network
* byteorder so it can be
* properly reprocessed on the
* eager's queue.
*/
/*
* If no mem, just let
* the peer retransmit.
*/
}
if (recv_adaptation) {
}
wake_eager = B_TRUE;
/*
* Process rest of the chunks with eager.
*/
/*
* Confirm peer's original source. fp can
* only be NULL if peer does not use the
* original source as one of its addresses...
*/
else
/*
* Validate the peer addresses. It also starts
* the heartbeat timer.
*/
break;
}
/* Anything else is considered out-of-the-blue */
case CHUNK_ERROR:
case CHUNK_ABORT:
case CHUNK_COOKIE_ACK:
case CHUNK_SHUTDOWN_COMPLETE:
goto done;
default:
goto done;
}
break;
case SCTPS_COOKIE_WAIT:
case CHUNK_INIT_ACK:
break;
case CHUNK_ABORT:
goto done;
case CHUNK_INIT:
break;
case CHUNK_COOKIE:
break;
}
if (!SCTP_IS_DETACHED(sctp)) {
}
if (sctp->sctp_cookie_mp) {
}
/* Validate the peer addresses. */
if (recv_adaptation) {
}
/* Try sending queued data, or ASCONFs */
trysend = 1;
break;
default:
goto nomorechunks;
} /* else skip and continue processing */
break;
}
break;
case SCTPS_COOKIE_ECHOED:
case CHUNK_COOKIE_ACK:
if (!SCTP_IS_DETACHED(sctp)) {
}
if (sctp->sctp_unacked == 0)
if (sctp->sctp_cookie_mp) {
}
/* Validate the peer addresses. */
/* Try sending queued data, or ASCONFs */
trysend = 1;
break;
case CHUNK_ABORT:
goto done;
case CHUNK_COOKIE:
break;
}
if (!SCTP_IS_DETACHED(sctp)) {
}
if (sctp->sctp_unacked == 0)
if (sctp->sctp_cookie_mp) {
}
/* Validate the peer addresses. */
if (recv_adaptation) {
}
/* Try sending queued data, or ASCONFs */
trysend = 1;
break;
case CHUNK_INIT:
break;
case CHUNK_ERROR: {
sctp_parm_hdr_t *p;
/* check for a stale cookie */
(sizeof (*p) + sizeof (*ch)) +
sizeof (uint32_t)) {
if (p->sph_type ==
SCTP_COMM_LOST, 0, NULL);
goto done;
}
}
break;
}
case CHUNK_HEARTBEAT:
if (!hb_already) {
hb_already = B_TRUE;
}
break;
default:
goto nomorechunks;
} /* else skip and continue processing */
} /* switch (ch->sch_id) */
break;
case SCTPS_SHUTDOWN_ACK_SENT:
case CHUNK_ABORT:
/* Pass gathered wisdom to IP for keeping */
goto done;
case CHUNK_SHUTDOWN_COMPLETE:
NULL);
/* Pass gathered wisdom to IP for keeping */
sctp_clean_death(sctp, 0);
goto done;
case CHUNK_SHUTDOWN_ACK:
NULL);
sctp_clean_death(sctp, 0);
goto done;
case CHUNK_COOKIE:
break;
case CHUNK_HEARTBEAT:
if (!hb_already) {
hb_already = B_TRUE;
}
break;
default:
goto nomorechunks;
} /* else skip and continue processing */
break;
}
break;
case SCTPS_SHUTDOWN_RECEIVED:
case CHUNK_SHUTDOWN:
/*
* shutdown_ack_needed may have been set as
* mentioned in the case CHUNK_SACK below.
* If sctp_shutdown_received() above found
* the xmit queue empty the SHUTDOWN ACK chunk
* has already been sent (or scheduled to be
* sent on the timer) and the SCTP state
* changed, so reset shutdown_ack_needed.
*/
break;
case CHUNK_SACK:
if (trysend < 0) {
SCTP_COMM_LOST, 0, NULL);
goto done;
}
/*
* All data acknowledgement after a shutdown
* should be done with SHUTDOWN chunk.
* However some peer SCTP do not conform with
* this and can unexpectedly send a SACK chunk.
* If all data are acknowledged, set
* shutdown_ack_needed here indicating that
* SHUTDOWN ACK needs to be sent later by
* sctp_send_shutdown_ack().
*/
break;
case CHUNK_ABORT:
goto done;
case CHUNK_HEARTBEAT:
if (!hb_already) {
hb_already = B_TRUE;
}
break;
default:
goto nomorechunks;
} /* else skip and continue processing */
break;
}
break;
default:
/*
* The only remaining states are SCTPS_IDLE and
* SCTPS_BOUND, and we should not be getting here
* for these.
*/
ASSERT(0);
} /* switch (sctp->sctp_state) */
goto done;
/* Finished processing all chunks in packet */
if (shutdown_ack_needed)
/* SACK if necessary */
if (gotdata) {
(sctp->sctp_sack_toggle)++;
/* If a SACK is sent, no need to restart the timer. */
}
}
if (trysend) {
}
/*
* If there is unsent data, make sure a timer is running, check
* timer_mp, if sctp_closei_local() ran the timers may be free.
*/
}
done:
if (wake_eager) {
/*
* sctp points to newly created control block, need to
* release it before exiting.
*/
}
}
/*
* Some amount of data got removed from ULP's receive queue and we can
* push messages up if we are flow controlled before. Reset the receive
* window to full capacity (conn_rcvbuf) and check if we should send a
* window update.
*/
void
{
/* This is the amount of data queued in ULP. */
}
}