Deleted Added
full compact
sctp_output.c (171440) sctp_output.c (171477)
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_output.c,v 1.46 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_output.c,v 1.46 2005/03/06 16:04:17 itojun Exp $ */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/netinet/sctp_output.c 171440 2007-07-14 09:36:28Z rrs $");
34__FBSDID("$FreeBSD: head/sys/netinet/sctp_output.c 171477 2007-07-17 20:58:26Z rrs $");
35
36#include <netinet/sctp_os.h>
37#include <sys/proc.h>
38#include <netinet/sctp_var.h>
39#include <netinet/sctp_sysctl.h>
40#include <netinet/sctp_header.h>
41#include <netinet/sctp_pcb.h>
42#include <netinet/sctputil.h>

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

3432 * Add debug message here if
3433 * destination is not in PF
3434 * state.
3435 */
3436 /*
3437 * Stop any running T3
3438 * timers here?
3439 */
35
36#include <netinet/sctp_os.h>
37#include <sys/proc.h>
38#include <netinet/sctp_var.h>
39#include <netinet/sctp_sysctl.h>
40#include <netinet/sctp_header.h>
41#include <netinet/sctp_pcb.h>
42#include <netinet/sctputil.h>

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

3432 * Add debug message here if
3433 * destination is not in PF
3434 * state.
3435 */
3436 /*
3437 * Stop any running T3
3438 * timers here?
3439 */
3440 if (sctp_cmt_pf) {
3440 if (sctp_cmt_on_off && sctp_cmt_pf) {
3441 net->dest_state &= ~SCTP_ADDR_PF;
3442 SCTPDBG(SCTP_DEBUG_OUTPUT1, "Destination %p moved from PF to unreachable.\n",
3443 net);
3444 }
3445 }
3446 }
3447 if (stcb) {
3448 if (net == stcb->asoc.primary_destination) {

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

3830 sctp_timer_start(SCTP_TIMER_TYPE_INIT, inp, stcb, net);
3831
3832 m = sctp_get_mbuf_for_msg(MCLBYTES, 1, M_DONTWAIT, 1, MT_DATA);
3833 if (m == NULL) {
3834 /* No memory, INIT timer will re-attempt. */
3835 return;
3836 }
3837 SCTP_BUF_LEN(m) = sizeof(struct sctp_init_msg);
3441 net->dest_state &= ~SCTP_ADDR_PF;
3442 SCTPDBG(SCTP_DEBUG_OUTPUT1, "Destination %p moved from PF to unreachable.\n",
3443 net);
3444 }
3445 }
3446 }
3447 if (stcb) {
3448 if (net == stcb->asoc.primary_destination) {

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

3830 sctp_timer_start(SCTP_TIMER_TYPE_INIT, inp, stcb, net);
3831
3832 m = sctp_get_mbuf_for_msg(MCLBYTES, 1, M_DONTWAIT, 1, MT_DATA);
3833 if (m == NULL) {
3834 /* No memory, INIT timer will re-attempt. */
3835 return;
3836 }
3837 SCTP_BUF_LEN(m) = sizeof(struct sctp_init_msg);
3838 /*
3839 * assume peer supports asconf in order to be able to queue local
3840 * address changes while an INIT is in flight and before the assoc
3841 * is established.
3842 */
3843 stcb->asoc.peer_supports_asconf = 1;
3838 /* Now lets put the SCTP header in place */
3839 initm = mtod(m, struct sctp_init_msg *);
3840 initm->sh.src_port = inp->sctp_lport;
3841 initm->sh.dest_port = stcb->rport;
3842 initm->sh.v_tag = 0;
3843 initm->sh.checksum = 0; /* calculate later */
3844 /* now the chunk header */
3845 initm->msg.ch.chunk_type = SCTP_INITIATION;

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

6478
6479 dchkh = mtod(chk->data, struct sctp_data_chunk *);
6480 /*
6481 * Put the rest of the things in place now. Size was done earlier in
6482 * previous loop prior to padding.
6483 */
6484
6485#ifdef SCTP_ASOCLOG_OF_TSNS
3844 /* Now lets put the SCTP header in place */
3845 initm = mtod(m, struct sctp_init_msg *);
3846 initm->sh.src_port = inp->sctp_lport;
3847 initm->sh.dest_port = stcb->rport;
3848 initm->sh.v_tag = 0;
3849 initm->sh.checksum = 0; /* calculate later */
3850 /* now the chunk header */
3851 initm->msg.ch.chunk_type = SCTP_INITIATION;

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

6484
6485 dchkh = mtod(chk->data, struct sctp_data_chunk *);
6486 /*
6487 * Put the rest of the things in place now. Size was done earlier in
6488 * previous loop prior to padding.
6489 */
6490
6491#ifdef SCTP_ASOCLOG_OF_TSNS
6492 SCTP_TCB_LOCK_ASSERT(stcb);
6493 if (asoc->tsn_out_at >= SCTP_TSN_LOG_SIZE) {
6494 asoc->tsn_out_at = 0;
6495 asoc->tsn_out_wrapped = 1;
6496 }
6486 asoc->out_tsnlog[asoc->tsn_out_at].tsn = chk->rec.data.TSN_seq;
6487 asoc->out_tsnlog[asoc->tsn_out_at].strm = chk->rec.data.stream_number;
6488 asoc->out_tsnlog[asoc->tsn_out_at].seq = chk->rec.data.stream_seq;
6489 asoc->out_tsnlog[asoc->tsn_out_at].sz = chk->send_size;
6490 asoc->out_tsnlog[asoc->tsn_out_at].flgs = chk->rec.data.rcv_flags;
6497 asoc->out_tsnlog[asoc->tsn_out_at].tsn = chk->rec.data.TSN_seq;
6498 asoc->out_tsnlog[asoc->tsn_out_at].strm = chk->rec.data.stream_number;
6499 asoc->out_tsnlog[asoc->tsn_out_at].seq = chk->rec.data.stream_seq;
6500 asoc->out_tsnlog[asoc->tsn_out_at].sz = chk->send_size;
6501 asoc->out_tsnlog[asoc->tsn_out_at].flgs = chk->rec.data.rcv_flags;
6502 asoc->out_tsnlog[asoc->tsn_out_at].stcb = (void *)stcb;
6503 asoc->out_tsnlog[asoc->tsn_out_at].in_pos = asoc->tsn_out_at;
6504 asoc->out_tsnlog[asoc->tsn_out_at].in_out = 2;
6491 asoc->tsn_out_at++;
6505 asoc->tsn_out_at++;
6492 if (asoc->tsn_out_at >= SCTP_TSN_LOG_SIZE) {
6493 asoc->tsn_out_at = 0;
6494 asoc->tsn_out_wrapped = 1;
6495 }
6496#endif
6497
6498 dchkh->ch.chunk_type = SCTP_DATA;
6499 dchkh->ch.chunk_flags = chk->rec.data.rcv_flags;
6500 dchkh->dp.tsn = htonl(chk->rec.data.TSN_seq);
6501 dchkh->dp.stream_id = htons(strq->stream_no);
6502 dchkh->dp.stream_sequence = htons(chk->rec.data.stream_seq);
6503 dchkh->dp.protocol_id = chk->rec.data.payloadtype;

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

6735 struct sctp_nets *a_net;
6736
6737 SCTP_TCB_LOCK_ASSERT(stcb);
6738 /*
6739 * JRS 5/14/07 - If CMT PF is turned on, find an alternate
6740 * destination using the PF algorithm for finding alternate
6741 * destinations.
6742 */
6506#endif
6507
6508 dchkh->ch.chunk_type = SCTP_DATA;
6509 dchkh->ch.chunk_flags = chk->rec.data.rcv_flags;
6510 dchkh->dp.tsn = htonl(chk->rec.data.TSN_seq);
6511 dchkh->dp.stream_id = htons(strq->stream_no);
6512 dchkh->dp.stream_sequence = htons(chk->rec.data.stream_seq);
6513 dchkh->dp.protocol_id = chk->rec.data.payloadtype;

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

6745 struct sctp_nets *a_net;
6746
6747 SCTP_TCB_LOCK_ASSERT(stcb);
6748 /*
6749 * JRS 5/14/07 - If CMT PF is turned on, find an alternate
6750 * destination using the PF algorithm for finding alternate
6751 * destinations.
6752 */
6743 if (sctp_cmt_pf) {
6753 if (sctp_cmt_on_off && sctp_cmt_pf) {
6744 a_net = sctp_find_alternate_net(stcb, net, 2);
6745 } else {
6746 a_net = sctp_find_alternate_net(stcb, net, 0);
6747 }
6748 if ((a_net != net) &&
6749 ((a_net->dest_state & SCTP_ADDR_REACHABLE) == SCTP_ADDR_REACHABLE)) {
6750 /*
6751 * We only proceed if a valid alternate is found that is not

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

7405 }
7406 /* must start a send timer if data is being sent */
7407 if (bundle_at && (!SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer))) {
7408 /*
7409 * no timer running on this destination
7410 * restart it.
7411 */
7412 sctp_timer_start(SCTP_TIMER_TYPE_SEND, inp, stcb, net);
6754 a_net = sctp_find_alternate_net(stcb, net, 2);
6755 } else {
6756 a_net = sctp_find_alternate_net(stcb, net, 0);
6757 }
6758 if ((a_net != net) &&
6759 ((a_net->dest_state & SCTP_ADDR_REACHABLE) == SCTP_ADDR_REACHABLE)) {
6760 /*
6761 * We only proceed if a valid alternate is found that is not

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

7415 }
7416 /* must start a send timer if data is being sent */
7417 if (bundle_at && (!SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer))) {
7418 /*
7419 * no timer running on this destination
7420 * restart it.
7421 */
7422 sctp_timer_start(SCTP_TIMER_TYPE_SEND, inp, stcb, net);
7413 } else if (sctp_cmt_pf && pf_hbflag && ((net->dest_state & SCTP_ADDR_PF) == SCTP_ADDR_PF)
7423 } else if (sctp_cmt_on_off && sctp_cmt_pf && pf_hbflag && ((net->dest_state & SCTP_ADDR_PF) == SCTP_ADDR_PF)
7414 && (!SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer))) {
7415 /*
7416 * JRS 5/14/07 - If a HB has been sent to a
7417 * PF destination and no T3 timer is
7418 * currently running, start the T3 timer to
7419 * track the HBs that were sent.
7420 */
7421 sctp_timer_start(SCTP_TIMER_TYPE_SEND, inp, stcb, net);

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

8654 * if possible move things off of this address we
8655 * still may send below due to the dormant state but
8656 * we try to find an alternate address to send to
8657 * and if we have one we move all queued data on the
8658 * out wheel to this alternate address.
8659 */
8660 if (net->ref_count > 1)
8661 sctp_move_to_an_alt(stcb, asoc, net);
7424 && (!SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer))) {
7425 /*
7426 * JRS 5/14/07 - If a HB has been sent to a
7427 * PF destination and no T3 timer is
7428 * currently running, start the T3 timer to
7429 * track the HBs that were sent.
7430 */
7431 sctp_timer_start(SCTP_TIMER_TYPE_SEND, inp, stcb, net);

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

8664 * if possible move things off of this address we
8665 * still may send below due to the dormant state but
8666 * we try to find an alternate address to send to
8667 * and if we have one we move all queued data on the
8668 * out wheel to this alternate address.
8669 */
8670 if (net->ref_count > 1)
8671 sctp_move_to_an_alt(stcb, asoc, net);
8662 } else if (sctp_cmt_pf && ((net->dest_state & SCTP_ADDR_PF) ==
8672 } else if (sctp_cmt_on_off && sctp_cmt_pf && ((net->dest_state & SCTP_ADDR_PF) ==
8663 SCTP_ADDR_PF)) {
8664 /*
8665 * JRS 5/14/07 - If CMT PF is on and the current
8666 * destination is in PF state, move all queued data
8667 * to an alternate desination.
8668 */
8669 if (net->ref_count > 1)
8670 sctp_move_to_an_alt(stcb, asoc, net);

--- 3324 unchanged lines hidden ---
8673 SCTP_ADDR_PF)) {
8674 /*
8675 * JRS 5/14/07 - If CMT PF is on and the current
8676 * destination is in PF state, move all queued data
8677 * to an alternate desination.
8678 */
8679 if (net->ref_count > 1)
8680 sctp_move_to_an_alt(stcb, asoc, net);

--- 3324 unchanged lines hidden ---