Deleted Added
full compact
sctp_indata.c (189444) sctp_indata.c (189790)
1/*-
2 * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * a) Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.

--- 17 unchanged lines hidden (view full) ---

26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 * THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31/* $KAME: sctp_indata.c,v 1.36 2005/03/06 16:04:17 itojun Exp $ */
32
33#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * a) Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.

--- 17 unchanged lines hidden (view full) ---

26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 * THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31/* $KAME: sctp_indata.c,v 1.36 2005/03/06 16:04:17 itojun Exp $ */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/netinet/sctp_indata.c 189444 2009-03-06 11:03:52Z rrs $");
34__FBSDID("$FreeBSD: head/sys/netinet/sctp_indata.c 189790 2009-03-14 13:42:13Z rrs $");
35
36#include <netinet/sctp_os.h>
37#include <netinet/sctp_var.h>
38#include <netinet/sctp_sysctl.h>
39#include <netinet/sctp_pcb.h>
40#include <netinet/sctp_header.h>
41#include <netinet/sctputil.h>
42#include <netinet/sctp_output.h>

--- 3632 unchanged lines hidden (view full) ---

3675 * time macros when _KERNEL is undefined.
3676 */
3677 (timevalcmp(&now, &tp1->rec.data.timetodrop, >))
3678 ) {
3679 /* Yes so drop it */
3680 if (tp1->data != NULL) {
3681 (void)sctp_release_pr_sctp_chunk(stcb, tp1,
3682 (SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT),
35
36#include <netinet/sctp_os.h>
37#include <netinet/sctp_var.h>
38#include <netinet/sctp_sysctl.h>
39#include <netinet/sctp_pcb.h>
40#include <netinet/sctp_header.h>
41#include <netinet/sctputil.h>
42#include <netinet/sctp_output.h>

--- 3632 unchanged lines hidden (view full) ---

3675 * time macros when _KERNEL is undefined.
3676 */
3677 (timevalcmp(&now, &tp1->rec.data.timetodrop, >))
3678 ) {
3679 /* Yes so drop it */
3680 if (tp1->data != NULL) {
3681 (void)sctp_release_pr_sctp_chunk(stcb, tp1,
3682 (SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT),
3683 &asoc->sent_queue, SCTP_SO_NOT_LOCKED);
3683 SCTP_SO_NOT_LOCKED);
3684 }
3685 tp1 = TAILQ_NEXT(tp1, sctp_next);
3686 continue;
3687 }
3688 }
3689 if ((PR_SCTP_RTX_ENABLED(tp1->flags)) && tp1->sent < SCTP_DATAGRAM_ACKED) {
3690 /* Has it been retransmitted tv_sec times? */
3691 if (tp1->snd_count > tp1->rec.data.timetodrop.tv_sec) {
3692 /* Yes, so drop it */
3693 if (tp1->data != NULL) {
3694 (void)sctp_release_pr_sctp_chunk(stcb, tp1,
3695 (SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT),
3684 }
3685 tp1 = TAILQ_NEXT(tp1, sctp_next);
3686 continue;
3687 }
3688 }
3689 if ((PR_SCTP_RTX_ENABLED(tp1->flags)) && tp1->sent < SCTP_DATAGRAM_ACKED) {
3690 /* Has it been retransmitted tv_sec times? */
3691 if (tp1->snd_count > tp1->rec.data.timetodrop.tv_sec) {
3692 /* Yes, so drop it */
3693 if (tp1->data != NULL) {
3694 (void)sctp_release_pr_sctp_chunk(stcb, tp1,
3695 (SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT),
3696 &asoc->sent_queue, SCTP_SO_NOT_LOCKED);
3696 SCTP_SO_NOT_LOCKED);
3697 }
3698 tp1 = TAILQ_NEXT(tp1, sctp_next);
3699 continue;
3700 }
3701 }
3702 }
3703 if (compare_with_wrap(tp1->rec.data.TSN_seq,
3704 asoc->this_sack_highest_gap, MAX_TSN)) {

--- 368 unchanged lines hidden (view full) ---

4073 }
4074 tp1 = TAILQ_FIRST(&asoc->sent_queue);
4075 while (tp1) {
4076 if (tp1->sent != SCTP_FORWARD_TSN_SKIP &&
4077 tp1->sent != SCTP_DATAGRAM_RESEND) {
4078 /* no chance to advance, out of here */
4079 break;
4080 }
3697 }
3698 tp1 = TAILQ_NEXT(tp1, sctp_next);
3699 continue;
3700 }
3701 }
3702 }
3703 if (compare_with_wrap(tp1->rec.data.TSN_seq,
3704 asoc->this_sack_highest_gap, MAX_TSN)) {

--- 368 unchanged lines hidden (view full) ---

4073 }
4074 tp1 = TAILQ_FIRST(&asoc->sent_queue);
4075 while (tp1) {
4076 if (tp1->sent != SCTP_FORWARD_TSN_SKIP &&
4077 tp1->sent != SCTP_DATAGRAM_RESEND) {
4078 /* no chance to advance, out of here */
4079 break;
4080 }
4081 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_TRY_ADVANCE) {
4082 if (tp1->sent == SCTP_FORWARD_TSN_SKIP) {
4083 sctp_misc_ints(SCTP_FWD_TSN_CHECK,
4084 asoc->advanced_peer_ack_point,
4085 tp1->rec.data.TSN_seq, 0, 0);
4086 }
4087 }
4081 if (!PR_SCTP_ENABLED(tp1->flags)) {
4082 /*
4083 * We can't fwd-tsn past any that are reliable aka
4084 * retransmitted until the asoc fails.
4085 */
4086 break;
4087 }
4088 if (!now_filled) {

--- 13 unchanged lines hidden (view full) ---

4102 * Now is this one marked for resend and its time is
4103 * now up?
4104 */
4105 if (timevalcmp(&now, &tp1->rec.data.timetodrop, >)) {
4106 /* Yes so drop it */
4107 if (tp1->data) {
4108 (void)sctp_release_pr_sctp_chunk(stcb, tp1,
4109 (SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT),
4088 if (!PR_SCTP_ENABLED(tp1->flags)) {
4089 /*
4090 * We can't fwd-tsn past any that are reliable aka
4091 * retransmitted until the asoc fails.
4092 */
4093 break;
4094 }
4095 if (!now_filled) {

--- 13 unchanged lines hidden (view full) ---

4109 * Now is this one marked for resend and its time is
4110 * now up?
4111 */
4112 if (timevalcmp(&now, &tp1->rec.data.timetodrop, >)) {
4113 /* Yes so drop it */
4114 if (tp1->data) {
4115 (void)sctp_release_pr_sctp_chunk(stcb, tp1,
4116 (SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT),
4110 &asoc->sent_queue, SCTP_SO_NOT_LOCKED);
4117 SCTP_SO_NOT_LOCKED);
4111 }
4112 } else {
4113 /*
4114 * No, we are done when hit one for resend
4115 * whos time as not expired.
4116 */
4117 break;
4118 }
4119 }
4120 /*
4121 * Ok now if this chunk is marked to drop it we can clean up
4122 * the chunk, advance our peer ack point and we can check
4123 * the next chunk.
4124 */
4125 if (tp1->sent == SCTP_FORWARD_TSN_SKIP) {
4126 /* advance PeerAckPoint goes forward */
4118 }
4119 } else {
4120 /*
4121 * No, we are done when hit one for resend
4122 * whos time as not expired.
4123 */
4124 break;
4125 }
4126 }
4127 /*
4128 * Ok now if this chunk is marked to drop it we can clean up
4129 * the chunk, advance our peer ack point and we can check
4130 * the next chunk.
4131 */
4132 if (tp1->sent == SCTP_FORWARD_TSN_SKIP) {
4133 /* advance PeerAckPoint goes forward */
4127 asoc->advanced_peer_ack_point = tp1->rec.data.TSN_seq;
4128 a_adv = tp1;
4134 if (compare_with_wrap(tp1->rec.data.TSN_seq,
4135 asoc->advanced_peer_ack_point,
4136 MAX_TSN)) {
4137
4138 asoc->advanced_peer_ack_point = tp1->rec.data.TSN_seq;
4139 a_adv = tp1;
4140 } else if (tp1->rec.data.TSN_seq == asoc->advanced_peer_ack_point) {
4141 /* No update but we do save the chk */
4142 a_adv = tp1;
4143 }
4129 } else {
4130 /*
4131 * If it is still in RESEND we can advance no
4132 * further
4133 */
4134 break;
4135 }
4136 /*
4137 * If we hit here we just dumped tp1, move to next tsn on
4138 * sent queue.
4139 */
4140 tp1 = tp2;
4141 }
4142 return (a_adv);
4143}
4144
4144 } else {
4145 /*
4146 * If it is still in RESEND we can advance no
4147 * further
4148 */
4149 break;
4150 }
4151 /*
4152 * If we hit here we just dumped tp1, move to next tsn on
4153 * sent queue.
4154 */
4155 tp1 = tp2;
4156 }
4157 return (a_adv);
4158}
4159
4145static void
4160static int
4146sctp_fs_audit(struct sctp_association *asoc)
4147{
4148 struct sctp_tmit_chunk *chk;
4149 int inflight = 0, resend = 0, inbetween = 0, acked = 0, above = 0;
4161sctp_fs_audit(struct sctp_association *asoc)
4162{
4163 struct sctp_tmit_chunk *chk;
4164 int inflight = 0, resend = 0, inbetween = 0, acked = 0, above = 0;
4165 int entry_flight, entry_cnt, ret;
4150
4166
4167 entry_flight = asoc->total_flight;
4168 entry_cnt = asoc->total_flight_count;
4169 ret = 0;
4170
4171 if (asoc->pr_sctp_cnt >= asoc->sent_queue_cnt)
4172 return (0);
4173
4151 TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) {
4152 if (chk->sent < SCTP_DATAGRAM_RESEND) {
4174 TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) {
4175 if (chk->sent < SCTP_DATAGRAM_RESEND) {
4176 printf("Chk TSN:%u size:%d inflight cnt:%d\n",
4177 chk->rec.data.TSN_seq,
4178 chk->send_size,
4179 chk->snd_count
4180 );
4153 inflight++;
4154 } else if (chk->sent == SCTP_DATAGRAM_RESEND) {
4155 resend++;
4156 } else if (chk->sent < SCTP_DATAGRAM_ACKED) {
4157 inbetween++;
4158 } else if (chk->sent > SCTP_DATAGRAM_ACKED) {
4159 above++;
4160 } else {
4161 acked++;
4162 }
4163 }
4164
4165 if ((inflight > 0) || (inbetween > 0)) {
4166#ifdef INVARIANTS
4167 panic("Flight size-express incorrect? \n");
4168#else
4181 inflight++;
4182 } else if (chk->sent == SCTP_DATAGRAM_RESEND) {
4183 resend++;
4184 } else if (chk->sent < SCTP_DATAGRAM_ACKED) {
4185 inbetween++;
4186 } else if (chk->sent > SCTP_DATAGRAM_ACKED) {
4187 above++;
4188 } else {
4189 acked++;
4190 }
4191 }
4192
4193 if ((inflight > 0) || (inbetween > 0)) {
4194#ifdef INVARIANTS
4195 panic("Flight size-express incorrect? \n");
4196#else
4169 SCTP_PRINTF("Flight size-express incorrect inflight:%d inbetween:%d\n",
4170 inflight, inbetween);
4197 printf("asoc->total_flight:%d cnt:%d\n",
4198 entry_flight, entry_cnt);
4199
4200 SCTP_PRINTF("Flight size-express incorrect F:%d I:%d R:%d Ab:%d ACK:%d\n",
4201 inflight, inbetween, resend, above, acked);
4202 ret = 1;
4171#endif
4172 }
4203#endif
4204 }
4205 return (ret);
4173}
4174
4175
4176static void
4177sctp_window_probe_recovery(struct sctp_tcb *stcb,
4178 struct sctp_association *asoc,
4179 struct sctp_nets *net,
4180 struct sctp_tmit_chunk *tp1)

--- 404 unchanged lines hidden (view full) ---

4585 }
4586 }
4587 }
4588 if ((j == 0) &&
4589 (!TAILQ_EMPTY(&asoc->sent_queue)) &&
4590 (asoc->sent_queue_retran_cnt == 0) &&
4591 (win_probe_recovered == 0) &&
4592 (done_once == 0)) {
4206}
4207
4208
4209static void
4210sctp_window_probe_recovery(struct sctp_tcb *stcb,
4211 struct sctp_association *asoc,
4212 struct sctp_nets *net,
4213 struct sctp_tmit_chunk *tp1)

--- 404 unchanged lines hidden (view full) ---

4618 }
4619 }
4620 }
4621 if ((j == 0) &&
4622 (!TAILQ_EMPTY(&asoc->sent_queue)) &&
4623 (asoc->sent_queue_retran_cnt == 0) &&
4624 (win_probe_recovered == 0) &&
4625 (done_once == 0)) {
4593 /* huh, this should not happen */
4594 sctp_fs_audit(asoc);
4595 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4596 net->flight_size = 0;
4597 }
4598 asoc->total_flight = 0;
4599 asoc->total_flight_count = 0;
4600 asoc->sent_queue_retran_cnt = 0;
4601 TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
4602 if (tp1->sent < SCTP_DATAGRAM_RESEND) {
4603 sctp_flight_size_increase(tp1);
4604 sctp_total_flight_increase(stcb, tp1);
4605 } else if (tp1->sent == SCTP_DATAGRAM_RESEND) {
4606 asoc->sent_queue_retran_cnt++;
4626 /*
4627 * huh, this should not happen unless all packets are
4628 * PR-SCTP and marked to skip of course.
4629 */
4630 if (sctp_fs_audit(asoc)) {
4631 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4632 if (net->flight_size) {
4633 net->flight_size = 0;
4634 }
4607 }
4635 }
4636 asoc->total_flight = 0;
4637 asoc->total_flight_count = 0;
4638 asoc->sent_queue_retran_cnt = 0;
4639 TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
4640 if (tp1->sent < SCTP_DATAGRAM_RESEND) {
4641 sctp_flight_size_increase(tp1);
4642 sctp_total_flight_increase(stcb, tp1);
4643 } else if (tp1->sent == SCTP_DATAGRAM_RESEND) {
4644 asoc->sent_queue_retran_cnt++;
4645 }
4646 }
4608 }
4609 done_once = 1;
4610 goto again;
4611 }
4612 /**********************************/
4613 /* Now what about shutdown issues */
4614 /**********************************/
4615 if (TAILQ_EMPTY(&asoc->send_queue) && TAILQ_EMPTY(&asoc->sent_queue)) {

--- 107 unchanged lines hidden (view full) ---

4723 MAX_TSN)) {
4724 send_forward_tsn(stcb, asoc);
4725 /*
4726 * ECN Nonce: Disable Nonce Sum check when
4727 * FWD TSN is sent and store resync tsn
4728 */
4729 asoc->nonce_sum_check = 0;
4730 asoc->nonce_resync_tsn = asoc->advanced_peer_ack_point;
4647 }
4648 done_once = 1;
4649 goto again;
4650 }
4651 /**********************************/
4652 /* Now what about shutdown issues */
4653 /**********************************/
4654 if (TAILQ_EMPTY(&asoc->send_queue) && TAILQ_EMPTY(&asoc->sent_queue)) {

--- 107 unchanged lines hidden (view full) ---

4762 MAX_TSN)) {
4763 send_forward_tsn(stcb, asoc);
4764 /*
4765 * ECN Nonce: Disable Nonce Sum check when
4766 * FWD TSN is sent and store resync tsn
4767 */
4768 asoc->nonce_sum_check = 0;
4769 asoc->nonce_resync_tsn = asoc->advanced_peer_ack_point;
4770 } else if (lchk) {
4771 /* try to FR fwd-tsn's that get lost too */
4772 lchk->rec.data.fwd_tsn_cnt++;
4773 if (lchk->rec.data.fwd_tsn_cnt > 3) {
4774 send_forward_tsn(stcb, asoc);
4775 lchk->rec.data.fwd_tsn_cnt = 0;
4776 }
4731 }
4732 }
4733 if (lchk) {
4734 /* Assure a timer is up */
4735 sctp_timer_start(SCTP_TIMER_TYPE_SEND,
4736 stcb->sctp_ep, stcb, lchk->whoTo);
4737 }
4738 }

--- 69 unchanged lines hidden (view full) ---

4808 stcb->asoc.cumack_log_at++;
4809 if (stcb->asoc.cumack_log_at > SCTP_TSN_LOG_SIZE) {
4810 stcb->asoc.cumack_log_at = 0;
4811 }
4812#endif
4813 num_seg = ntohs(sack->num_gap_ack_blks);
4814 a_rwnd = rwnd;
4815
4777 }
4778 }
4779 if (lchk) {
4780 /* Assure a timer is up */
4781 sctp_timer_start(SCTP_TIMER_TYPE_SEND,
4782 stcb->sctp_ep, stcb, lchk->whoTo);
4783 }
4784 }

--- 69 unchanged lines hidden (view full) ---

4854 stcb->asoc.cumack_log_at++;
4855 if (stcb->asoc.cumack_log_at > SCTP_TSN_LOG_SIZE) {
4856 stcb->asoc.cumack_log_at = 0;
4857 }
4858#endif
4859 num_seg = ntohs(sack->num_gap_ack_blks);
4860 a_rwnd = rwnd;
4861
4816 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_SACK_ARRIVALS_ENABLE) {
4817 sctp_misc_ints(SCTP_SACK_LOG_NORMAL, cum_ack,
4818 rwnd, stcb->asoc.last_acked_seq, stcb->asoc.peers_rwnd);
4819 }
4820 /* CMT DAC algo */
4821 cmt_dac_flag = ch->ch.chunk_flags & SCTP_SACK_CMT_DAC;
4822 num_dup = ntohs(sack->num_dup_tsns);
4823
4824 old_rwnd = stcb->asoc.peers_rwnd;
4825 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) {
4826 sctp_misc_ints(SCTP_THRESHOLD_CLEAR,
4827 stcb->asoc.overall_error_count,

--- 772 unchanged lines hidden (view full) ---

5600 }
5601 }
5602 }
5603 if ((j == 0) &&
5604 (!TAILQ_EMPTY(&asoc->sent_queue)) &&
5605 (asoc->sent_queue_retran_cnt == 0) &&
5606 (win_probe_recovered == 0) &&
5607 (done_once == 0)) {
4862 /* CMT DAC algo */
4863 cmt_dac_flag = ch->ch.chunk_flags & SCTP_SACK_CMT_DAC;
4864 num_dup = ntohs(sack->num_dup_tsns);
4865
4866 old_rwnd = stcb->asoc.peers_rwnd;
4867 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) {
4868 sctp_misc_ints(SCTP_THRESHOLD_CLEAR,
4869 stcb->asoc.overall_error_count,

--- 772 unchanged lines hidden (view full) ---

5642 }
5643 }
5644 }
5645 if ((j == 0) &&
5646 (!TAILQ_EMPTY(&asoc->sent_queue)) &&
5647 (asoc->sent_queue_retran_cnt == 0) &&
5648 (win_probe_recovered == 0) &&
5649 (done_once == 0)) {
5608 /* huh, this should not happen */
5609 sctp_fs_audit(asoc);
5610 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
5611 net->flight_size = 0;
5612 }
5613 asoc->total_flight = 0;
5614 asoc->total_flight_count = 0;
5615 asoc->sent_queue_retran_cnt = 0;
5616 TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
5617 if (tp1->sent < SCTP_DATAGRAM_RESEND) {
5618 sctp_flight_size_increase(tp1);
5619 sctp_total_flight_increase(stcb, tp1);
5620 } else if (tp1->sent == SCTP_DATAGRAM_RESEND) {
5621 asoc->sent_queue_retran_cnt++;
5650 /*
5651 * huh, this should not happen unless all packets are
5652 * PR-SCTP and marked to skip of course.
5653 */
5654 if (sctp_fs_audit(asoc)) {
5655 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
5656 net->flight_size = 0;
5622 }
5657 }
5658 asoc->total_flight = 0;
5659 asoc->total_flight_count = 0;
5660 asoc->sent_queue_retran_cnt = 0;
5661 TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
5662 if (tp1->sent < SCTP_DATAGRAM_RESEND) {
5663 sctp_flight_size_increase(tp1);
5664 sctp_total_flight_increase(stcb, tp1);
5665 } else if (tp1->sent == SCTP_DATAGRAM_RESEND) {
5666 asoc->sent_queue_retran_cnt++;
5667 }
5668 }
5623 }
5624 done_once = 1;
5625 goto again;
5626 }
5627 /* Fix up the a-p-a-p for future PR-SCTP sends */
5628 if (compare_with_wrap(cum_ack, asoc->advanced_peer_ack_point, MAX_TSN)) {
5629 asoc->advanced_peer_ack_point = cum_ack;
5630 }

--- 7 unchanged lines hidden (view full) ---

5638 /* C3. See if we need to send a Fwd-TSN */
5639 if (compare_with_wrap(asoc->advanced_peer_ack_point, cum_ack,
5640 MAX_TSN)) {
5641 /*
5642 * ISSUE with ECN, see FWD-TSN processing for notes
5643 * on issues that will occur when the ECN NONCE
5644 * stuff is put into SCTP for cross checking.
5645 */
5669 }
5670 done_once = 1;
5671 goto again;
5672 }
5673 /* Fix up the a-p-a-p for future PR-SCTP sends */
5674 if (compare_with_wrap(cum_ack, asoc->advanced_peer_ack_point, MAX_TSN)) {
5675 asoc->advanced_peer_ack_point = cum_ack;
5676 }

--- 7 unchanged lines hidden (view full) ---

5684 /* C3. See if we need to send a Fwd-TSN */
5685 if (compare_with_wrap(asoc->advanced_peer_ack_point, cum_ack,
5686 MAX_TSN)) {
5687 /*
5688 * ISSUE with ECN, see FWD-TSN processing for notes
5689 * on issues that will occur when the ECN NONCE
5690 * stuff is put into SCTP for cross checking.
5691 */
5692 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_TRY_ADVANCE) {
5693 sctp_misc_ints(SCTP_FWD_TSN_CHECK,
5694 0xee, cum_ack, asoc->advanced_peer_ack_point,
5695 old_adv_peer_ack_point);
5696 }
5646 if (compare_with_wrap(asoc->advanced_peer_ack_point, old_adv_peer_ack_point,
5647 MAX_TSN)) {
5648 send_forward_tsn(stcb, asoc);
5649 /*
5650 * ECN Nonce: Disable Nonce Sum check when
5651 * FWD TSN is sent and store resync tsn
5652 */
5653 asoc->nonce_sum_check = 0;
5654 asoc->nonce_resync_tsn = asoc->advanced_peer_ack_point;
5697 if (compare_with_wrap(asoc->advanced_peer_ack_point, old_adv_peer_ack_point,
5698 MAX_TSN)) {
5699 send_forward_tsn(stcb, asoc);
5700 /*
5701 * ECN Nonce: Disable Nonce Sum check when
5702 * FWD TSN is sent and store resync tsn
5703 */
5704 asoc->nonce_sum_check = 0;
5705 asoc->nonce_resync_tsn = asoc->advanced_peer_ack_point;
5706 } else if (lchk) {
5707 /* try to FR fwd-tsn's that get lost too */
5708 lchk->rec.data.fwd_tsn_cnt++;
5709 if (lchk->rec.data.fwd_tsn_cnt > 3) {
5710 send_forward_tsn(stcb, asoc);
5711 lchk->rec.data.fwd_tsn_cnt = 0;
5712 }
5655 }
5656 }
5657 if (lchk) {
5658 /* Assure a timer is up */
5659 sctp_timer_start(SCTP_TIMER_TYPE_SEND,
5660 stcb->sctp_ep, stcb, lchk->whoTo);
5661 }
5662 }

--- 351 unchanged lines hidden (view full) ---

6014 *ippp = new_cum_tsn;
6015 }
6016 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_33;
6017 sctp_abort_an_association(stcb->sctp_ep, stcb,
6018 SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED);
6019 return;
6020 }
6021 SCTP_STAT_INCR(sctps_fwdtsn_map_over);
5713 }
5714 }
5715 if (lchk) {
5716 /* Assure a timer is up */
5717 sctp_timer_start(SCTP_TIMER_TYPE_SEND,
5718 stcb->sctp_ep, stcb, lchk->whoTo);
5719 }
5720 }

--- 351 unchanged lines hidden (view full) ---

6072 *ippp = new_cum_tsn;
6073 }
6074 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_33;
6075 sctp_abort_an_association(stcb->sctp_ep, stcb,
6076 SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED);
6077 return;
6078 }
6079 SCTP_STAT_INCR(sctps_fwdtsn_map_over);
6022slide_out:
6023 memset(stcb->asoc.mapping_array, 0, stcb->asoc.mapping_array_size);
6024 cumack_set_flag = 1;
6025 asoc->mapping_array_base_tsn = new_cum_tsn + 1;
6026 asoc->cumulative_tsn = asoc->highest_tsn_inside_map = new_cum_tsn;
6027 /* EY - nr_sack: nr_mapping_array version of the above */
6028 if (SCTP_BASE_SYSCTL(sctp_nr_sack_on_off) && asoc->peer_supports_nr_sack) {
6029 memset(stcb->asoc.nr_mapping_array, 0, stcb->asoc.nr_mapping_array_size);
6030 asoc->nr_mapping_array_base_tsn = new_cum_tsn + 1;

--- 7 unchanged lines hidden (view full) ---

6038 }
6039 }
6040 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) {
6041 sctp_log_map(0, 3, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT);
6042 }
6043 asoc->last_echo_tsn = asoc->highest_tsn_inside_map;
6044 } else {
6045 SCTP_TCB_LOCK_ASSERT(stcb);
6080 memset(stcb->asoc.mapping_array, 0, stcb->asoc.mapping_array_size);
6081 cumack_set_flag = 1;
6082 asoc->mapping_array_base_tsn = new_cum_tsn + 1;
6083 asoc->cumulative_tsn = asoc->highest_tsn_inside_map = new_cum_tsn;
6084 /* EY - nr_sack: nr_mapping_array version of the above */
6085 if (SCTP_BASE_SYSCTL(sctp_nr_sack_on_off) && asoc->peer_supports_nr_sack) {
6086 memset(stcb->asoc.nr_mapping_array, 0, stcb->asoc.nr_mapping_array_size);
6087 asoc->nr_mapping_array_base_tsn = new_cum_tsn + 1;

--- 7 unchanged lines hidden (view full) ---

6095 }
6096 }
6097 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) {
6098 sctp_log_map(0, 3, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT);
6099 }
6100 asoc->last_echo_tsn = asoc->highest_tsn_inside_map;
6101 } else {
6102 SCTP_TCB_LOCK_ASSERT(stcb);
6046 if ((compare_with_wrap(((uint32_t) asoc->cumulative_tsn + gap), asoc->highest_tsn_inside_map, MAX_TSN)) ||
6047 (((uint32_t) asoc->cumulative_tsn + gap) == asoc->highest_tsn_inside_map)) {
6048 goto slide_out;
6049 } else {
6050 for (i = 0; i <= gap; i++) {
6051 SCTP_SET_TSN_PRESENT(asoc->mapping_array, i);
6052 }
6103 for (i = 0; i <= gap; i++) {
6104 SCTP_SET_TSN_PRESENT(asoc->mapping_array, i);
6053 }
6054 /*
6055 * Now after marking all, slide thing forward but no sack
6056 * please.
6057 */
6058 sctp_sack_check(stcb, 0, 0, abort_flag);
6059 if (*abort_flag)
6060 return;
6061 }
6105 }
6106 /*
6107 * Now after marking all, slide thing forward but no sack
6108 * please.
6109 */
6110 sctp_sack_check(stcb, 0, 0, abort_flag);
6111 if (*abort_flag)
6112 return;
6113 }
6062
6063 /*************************************************************/
6064 /* 2. Clear up re-assembly queue */
6065 /*************************************************************/
6066 /*
6067 * First service it if pd-api is up, just in case we can progress it
6068 * forward
6069 */
6070 if (asoc->fragmented_delivery_inprogress) {

--- 7 unchanged lines hidden (view full) ---

6078 * work to spin through and stop after dumping one msg aka
6079 * seeing the start of a new msg at the head, and call the
6080 * delivery function... to see if it can be delivered... But
6081 * for now we just dump everything on the queue.
6082 */
6083 chk = TAILQ_FIRST(&asoc->reasmqueue);
6084 while (chk) {
6085 at = TAILQ_NEXT(chk, sctp_next);
6114 /*************************************************************/
6115 /* 2. Clear up re-assembly queue */
6116 /*************************************************************/
6117 /*
6118 * First service it if pd-api is up, just in case we can progress it
6119 * forward
6120 */
6121 if (asoc->fragmented_delivery_inprogress) {

--- 7 unchanged lines hidden (view full) ---

6129 * work to spin through and stop after dumping one msg aka
6130 * seeing the start of a new msg at the head, and call the
6131 * delivery function... to see if it can be delivered... But
6132 * for now we just dump everything on the queue.
6133 */
6134 chk = TAILQ_FIRST(&asoc->reasmqueue);
6135 while (chk) {
6136 at = TAILQ_NEXT(chk, sctp_next);
6086 if (compare_with_wrap(asoc->cumulative_tsn,
6087 chk->rec.data.TSN_seq, MAX_TSN) ||
6088 asoc->cumulative_tsn == chk->rec.data.TSN_seq) {
6137 if ((compare_with_wrap(new_cum_tsn,
6138 chk->rec.data.TSN_seq, MAX_TSN)) ||
6139 (new_cum_tsn == chk->rec.data.TSN_seq)) {
6089 /* It needs to be tossed */
6090 TAILQ_REMOVE(&asoc->reasmqueue, chk, sctp_next);
6091 if (compare_with_wrap(chk->rec.data.TSN_seq,
6092 asoc->tsn_last_delivered, MAX_TSN)) {
6093 asoc->tsn_last_delivered =
6094 chk->rec.data.TSN_seq;
6095 asoc->str_of_pdapi =
6096 chk->rec.data.stream_number;

--- 512 unchanged lines hidden (view full) ---

6609 }
6610 }
6611 }
6612 if ((j == 0) &&
6613 (!TAILQ_EMPTY(&asoc->sent_queue)) &&
6614 (asoc->sent_queue_retran_cnt == 0) &&
6615 (win_probe_recovered == 0) &&
6616 (done_once == 0)) {
6140 /* It needs to be tossed */
6141 TAILQ_REMOVE(&asoc->reasmqueue, chk, sctp_next);
6142 if (compare_with_wrap(chk->rec.data.TSN_seq,
6143 asoc->tsn_last_delivered, MAX_TSN)) {
6144 asoc->tsn_last_delivered =
6145 chk->rec.data.TSN_seq;
6146 asoc->str_of_pdapi =
6147 chk->rec.data.stream_number;

--- 512 unchanged lines hidden (view full) ---

6660 }
6661 }
6662 }
6663 if ((j == 0) &&
6664 (!TAILQ_EMPTY(&asoc->sent_queue)) &&
6665 (asoc->sent_queue_retran_cnt == 0) &&
6666 (win_probe_recovered == 0) &&
6667 (done_once == 0)) {
6617 /* huh, this should not happen */
6618 sctp_fs_audit(asoc);
6619 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
6620 net->flight_size = 0;
6621 }
6622 asoc->total_flight = 0;
6623 asoc->total_flight_count = 0;
6624 asoc->sent_queue_retran_cnt = 0;
6625 TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
6626 if (tp1->sent < SCTP_DATAGRAM_RESEND) {
6627 sctp_flight_size_increase(tp1);
6628 sctp_total_flight_increase(stcb, tp1);
6629 } else if (tp1->sent == SCTP_DATAGRAM_RESEND) {
6630 asoc->sent_queue_retran_cnt++;
6668 /*
6669 * huh, this should not happen unless all packets are
6670 * PR-SCTP and marked to skip of course.
6671 */
6672 if (sctp_fs_audit(asoc)) {
6673 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
6674 net->flight_size = 0;
6631 }
6675 }
6676 asoc->total_flight = 0;
6677 asoc->total_flight_count = 0;
6678 asoc->sent_queue_retran_cnt = 0;
6679 TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
6680 if (tp1->sent < SCTP_DATAGRAM_RESEND) {
6681 sctp_flight_size_increase(tp1);
6682 sctp_total_flight_increase(stcb, tp1);
6683 } else if (tp1->sent == SCTP_DATAGRAM_RESEND) {
6684 asoc->sent_queue_retran_cnt++;
6685 }
6686 }
6632 }
6633 done_once = 1;
6634 goto again;
6635 }
6636 /**********************************/
6637 /* Now what about shutdown issues */
6638 /**********************************/
6639 if (TAILQ_EMPTY(&asoc->send_queue) && TAILQ_EMPTY(&asoc->sent_queue)) {

--- 1525 unchanged lines hidden (view full) ---

8165 }
8166 }
8167 }
8168 if ((j == 0) &&
8169 (!TAILQ_EMPTY(&asoc->sent_queue)) &&
8170 (asoc->sent_queue_retran_cnt == 0) &&
8171 (win_probe_recovered == 0) &&
8172 (done_once == 0)) {
6687 }
6688 done_once = 1;
6689 goto again;
6690 }
6691 /**********************************/
6692 /* Now what about shutdown issues */
6693 /**********************************/
6694 if (TAILQ_EMPTY(&asoc->send_queue) && TAILQ_EMPTY(&asoc->sent_queue)) {

--- 1525 unchanged lines hidden (view full) ---

8220 }
8221 }
8222 }
8223 if ((j == 0) &&
8224 (!TAILQ_EMPTY(&asoc->sent_queue)) &&
8225 (asoc->sent_queue_retran_cnt == 0) &&
8226 (win_probe_recovered == 0) &&
8227 (done_once == 0)) {
8173 /* huh, this should not happen */
8174 sctp_fs_audit(asoc);
8175 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
8176 net->flight_size = 0;
8177 }
8178 asoc->total_flight = 0;
8179 asoc->total_flight_count = 0;
8180 asoc->sent_queue_retran_cnt = 0;
8181 TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
8182 if (tp1->sent < SCTP_DATAGRAM_RESEND) {
8183 sctp_flight_size_increase(tp1);
8184 sctp_total_flight_increase(stcb, tp1);
8185 } else if (tp1->sent == SCTP_DATAGRAM_RESEND) {
8186 asoc->sent_queue_retran_cnt++;
8228 /*
8229 * huh, this should not happen unless all packets are
8230 * PR-SCTP and marked to skip of course.
8231 */
8232 if (sctp_fs_audit(asoc)) {
8233 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
8234 net->flight_size = 0;
8187 }
8235 }
8236 asoc->total_flight = 0;
8237 asoc->total_flight_count = 0;
8238 asoc->sent_queue_retran_cnt = 0;
8239 TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
8240 if (tp1->sent < SCTP_DATAGRAM_RESEND) {
8241 sctp_flight_size_increase(tp1);
8242 sctp_total_flight_increase(stcb, tp1);
8243 } else if (tp1->sent == SCTP_DATAGRAM_RESEND) {
8244 asoc->sent_queue_retran_cnt++;
8245 }
8246 }
8188 }
8189 done_once = 1;
8190 goto again;
8191 }
8192 /*********************************************/
8193 /* Here we perform PR-SCTP procedures */
8194 /* (section 4.2) */
8195 /*********************************************/

--- 20 unchanged lines hidden (view full) ---

8216 MAX_TSN)) {
8217 send_forward_tsn(stcb, asoc);
8218 /*
8219 * ECN Nonce: Disable Nonce Sum check when
8220 * FWD TSN is sent and store resync tsn
8221 */
8222 asoc->nonce_sum_check = 0;
8223 asoc->nonce_resync_tsn = asoc->advanced_peer_ack_point;
8247 }
8248 done_once = 1;
8249 goto again;
8250 }
8251 /*********************************************/
8252 /* Here we perform PR-SCTP procedures */
8253 /* (section 4.2) */
8254 /*********************************************/

--- 20 unchanged lines hidden (view full) ---

8275 MAX_TSN)) {
8276 send_forward_tsn(stcb, asoc);
8277 /*
8278 * ECN Nonce: Disable Nonce Sum check when
8279 * FWD TSN is sent and store resync tsn
8280 */
8281 asoc->nonce_sum_check = 0;
8282 asoc->nonce_resync_tsn = asoc->advanced_peer_ack_point;
8283 } else if (lchk) {
8284 /* try to FR fwd-tsn's that get lost too */
8285 lchk->rec.data.fwd_tsn_cnt++;
8286 if (lchk->rec.data.fwd_tsn_cnt > 3) {
8287 send_forward_tsn(stcb, asoc);
8288 lchk->rec.data.fwd_tsn_cnt = 0;
8289 }
8224 }
8225 }
8226 if (lchk) {
8227 /* Assure a timer is up */
8228 sctp_timer_start(SCTP_TIMER_TYPE_SEND,
8229 stcb->sctp_ep, stcb, lchk->whoTo);
8230 }
8231 }
8232 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SACK_RWND_LOGGING_ENABLE) {
8233 sctp_misc_ints(SCTP_SACK_RWND_UPDATE,
8234 a_rwnd,
8235 stcb->asoc.peers_rwnd,
8236 stcb->asoc.total_flight,
8237 stcb->asoc.total_output_queue_size);
8238 }
8239}
8290 }
8291 }
8292 if (lchk) {
8293 /* Assure a timer is up */
8294 sctp_timer_start(SCTP_TIMER_TYPE_SEND,
8295 stcb->sctp_ep, stcb, lchk->whoTo);
8296 }
8297 }
8298 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SACK_RWND_LOGGING_ENABLE) {
8299 sctp_misc_ints(SCTP_SACK_RWND_UPDATE,
8300 a_rwnd,
8301 stcb->asoc.peers_rwnd,
8302 stcb->asoc.total_flight,
8303 stcb->asoc.total_output_queue_size);
8304 }
8305}