diff options
author | rrs <rrs@FreeBSD.org> | 2007-07-17 20:58:26 +0000 |
---|---|---|
committer | rrs <rrs@FreeBSD.org> | 2007-07-17 20:58:26 +0000 |
commit | baae800484b92bf7eee24218fdc96dca410b1846 (patch) | |
tree | 6c79e4122192f2fc2cd2730d66ed9af4e467112a /sys/netinet/sctputil.c | |
parent | eeef9fbdacbbff0d2c008a8f385bddf21f2b0f04 (diff) | |
download | FreeBSD-src-baae800484b92bf7eee24218fdc96dca410b1846.zip FreeBSD-src-baae800484b92bf7eee24218fdc96dca410b1846.tar.gz |
- added pre-checks to the bindx call.
- use proper tick gathering macro instead of ticks directly.
- Placed reasonable boundaries on sets that a user can do
that are converted to ticks from ms.
- Fix CMT_PF to always check to be sure CMT is on.
- Fix ticks use of CMT_PF.
- put back code to allow asconfs to be queued while INITs are in flight
and before the assoc is established.
- During window probes, an ack'd packet might be left with the window
probe mark on it causing it to be retransmitted. Change so that
the flight decrease macro clears the window_probe mark.
- Additional logging flight size/reading and ASOC LOG. This
is only enabled if you manually insert things into opt_sctp.h
since its a set of debug code only.
- Found an interesting SMP race in the way data was appended which
could cause a reader to lose a part of a message, had to
reorder when we marked the message was complete to after
the data was appended.
- bug in ADD-IP for the subset bound socket case when the peer has only
one address
- fix ASCONF implicit success/error handling case
- proper support of jails in Freebsd 6>
- copy out the timeval for the 64 bit sparc world on cookie-echo
alignment error crashes without this).
Approved by: re(Ken Smith)
Diffstat (limited to 'sys/netinet/sctputil.c')
-rw-r--r-- | sys/netinet/sctputil.c | 83 |
1 files changed, 60 insertions, 23 deletions
diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 4fa0d45..b70a1e7 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -918,6 +918,16 @@ sctp_init_asoc(struct sctp_inpcb *m, struct sctp_tcb *stcb, else asoc->hb_is_disabled = 0; +#ifdef SCTP_ASOCLOG_OF_TSNS + asoc->tsn_in_at = 0; + asoc->tsn_out_at = 0; + asoc->tsn_in_wrapped = 0; + asoc->tsn_out_wrapped = 0; + asoc->cumack_log_at = 0; +#endif +#ifdef SCTP_FS_SPEC_LOG + asoc->fs_index = 0; +#endif asoc->refcnt = 0; asoc->assoc_up_sent = 0; asoc->assoc_id = asoc->my_vtag; @@ -2565,9 +2575,10 @@ uint32_t sctp_calculate_rto(struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_nets *net, - struct timeval *old) + struct timeval *told, + int safe) { - /* + /*- * given an association and the starting time of the current RTT * period (in value1/value2) return RTO in number of msecs. */ @@ -2575,8 +2586,19 @@ sctp_calculate_rto(struct sctp_tcb *stcb, int o_calctime; uint32_t new_rto = 0; int first_measure = 0; - struct timeval now; - + struct timeval now, then, *old; + + /* Copy it out for sparc64 */ + if (safe == sctp_align_unsafe_makecopy) { + old = &then; + memcpy(&then, told, sizeof(struct timeval)); + } else if (safe == sctp_align_safe_nocopy) { + old = told; + } else { + /* error */ + SCTP_PRINTF("Huh, bad rto calc call\n"); + return (0); + } /************************/ /* 1. calculate new RTT */ /************************/ @@ -3650,6 +3672,7 @@ sctp_abort_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, void sctp_print_out_track_log(struct sctp_tcb *stcb) { +#ifdef NOSIY_PRINTS int i; SCTP_PRINTF("Last ep reason:%x\n", stcb->sctp_ep->last_abort_code); @@ -3704,6 +3727,7 @@ none_in: stcb->asoc.out_tsnlog[i].sz); } } +#endif } #endif @@ -4232,15 +4256,6 @@ get_out: } tail = m; } - if (end) { - /* message is complete */ - if (stcb && (control == stcb->asoc.control_pdapi)) { - stcb->asoc.control_pdapi = NULL; - } - control->held_length = 0; - control->end_added = 1; - } - atomic_add_int(&control->length, len); if (control->tail_mbuf) { /* append */ SCTP_BUF_NEXT(control->tail_mbuf) = m; @@ -4255,6 +4270,15 @@ get_out: control->data = m; control->tail_mbuf = tail; } + atomic_add_int(&control->length, len); + if (end) { + /* message is complete */ + if (stcb && (control == stcb->asoc.control_pdapi)) { + stcb->asoc.control_pdapi = NULL; + } + control->held_length = 0; + control->end_added = 1; + } if (stcb == NULL) { control->do_not_ref_stcb = 1; } @@ -4656,7 +4680,6 @@ sctp_sorecvmsg(struct socket *so, uint32_t rwnd_req = 0; int hold_sblock = 0; int hold_rlock = 0; - int alen = 0; int slen = 0; uint32_t held_length = 0; int sockbuf_lock = 0; @@ -5059,6 +5082,26 @@ found_one: sinfo->sinfo_flags |= SCTP_UNORDERED; } } +#ifdef SCTP_ASOCLOG_OF_TSNS + { + int index, newindex; + struct sctp_pcbtsn_rlog *entry; + + do { + index = inp->readlog_index; + newindex = index + 1; + if (newindex >= SCTP_READ_LOG_SIZE) { + newindex = 0; + } + } while (atomic_cmpset_int(&inp->readlog_index, index, newindex) == 0); + entry = &inp->readlog[index]; + entry->vtag = control->sinfo_assoc_id; + entry->strm = control->sinfo_stream; + entry->seq = control->sinfo_ssn; + entry->sz = control->length; + entry->flgs = control->sinfo_flags; + } +#endif if (fromlen && from) { struct sockaddr *to; @@ -5171,10 +5214,7 @@ get_more_data: embuf = m; copied_so_far += cp_len; freed_so_far += cp_len; - alen = atomic_fetchadd_int(&control->length, -(cp_len)); - if (alen < cp_len) { - panic("Control length goes negative?"); - } + atomic_subtract_int(&control->length, cp_len); control->data = sctp_m_free(m); m = control->data; /* @@ -5228,10 +5268,7 @@ get_more_data: sctp_sblog(&so->so_rcv, control->do_not_ref_stcb ? NULL : stcb, SCTP_LOG_SBRESULT, 0); } - alen = atomic_fetchadd_int(&control->length, -(cp_len)); - if (alen < cp_len) { - panic("Control length goes negative2?"); - } + atomic_subtract_int(&control->length, cp_len); } else { copied_so_far += cp_len; } @@ -5895,7 +5932,7 @@ sctp_bindx_add_address(struct socket *so, struct sctp_inpcb *inp, *error = EINVAL; return; } - *error = sctp_inpcb_bind(so, addr_touse, NULL, p); + *error = sctp_inpcb_bind(so, addr_touse, p); return; } /* |