aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorVlad Yasevich <vladislav.yasevich@hp.com>2007-03-19 20:02:30 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-03-20 03:09:45 -0400
commit749bf9215ed1a8b6edb4bb03693c2b62c6b9c2a4 (patch)
treed5656c441181fddef41392a4aa07f54e56487312 /net
parentfb78525ae1b75bfac1da600ceb008aef4d293649 (diff)
[SCTP]: Reset some transport and association variables on restart
If the association has been restarted, we need to reset the transport congestion variables as well as accumulated error counts and CACC variables. If we do not, the association will use the wrong values and may terminate prematurely. This was found with a scenario where the peer restarted the association when lksctp was in the last HB timeout for its association. The restart happened, but the error counts have not been reset and when the timeout occurred, a newly restarted association was terminated due to excessive retransmits. Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com> Signed-off-by: Sridhar Samudrala <sri@us.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/sctp/associola.c9
-rw-r--r--net/sctp/transport.c32
2 files changed, 41 insertions, 0 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index 2505cd3b8d29..78d2ddb5ca18 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -1046,6 +1046,9 @@ void sctp_assoc_update(struct sctp_association *asoc,
1046 trans = list_entry(pos, struct sctp_transport, transports); 1046 trans = list_entry(pos, struct sctp_transport, transports);
1047 if (!sctp_assoc_lookup_paddr(new, &trans->ipaddr)) 1047 if (!sctp_assoc_lookup_paddr(new, &trans->ipaddr))
1048 sctp_assoc_del_peer(asoc, &trans->ipaddr); 1048 sctp_assoc_del_peer(asoc, &trans->ipaddr);
1049
1050 if (asoc->state >= SCTP_STATE_ESTABLISHED)
1051 sctp_transport_reset(trans);
1049 } 1052 }
1050 1053
1051 /* If the case is A (association restart), use 1054 /* If the case is A (association restart), use
@@ -1069,6 +1072,12 @@ void sctp_assoc_update(struct sctp_association *asoc,
1069 */ 1072 */
1070 sctp_ulpq_flush(&asoc->ulpq); 1073 sctp_ulpq_flush(&asoc->ulpq);
1071 1074
1075 /* reset the overall association error count so
1076 * that the restarted association doesn't get torn
1077 * down on the next retransmission timer.
1078 */
1079 asoc->overall_error_count = 0;
1080
1072 } else { 1081 } else {
1073 /* Add any peer addresses from the new association. */ 1082 /* Add any peer addresses from the new association. */
1074 list_for_each(pos, &new->peer.transport_addr_list) { 1083 list_for_each(pos, &new->peer.transport_addr_list) {
diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index a596f5308cb1..c4699f5c409d 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -526,3 +526,35 @@ unsigned long sctp_transport_timeout(struct sctp_transport *t)
526 timeout += jiffies; 526 timeout += jiffies;
527 return timeout; 527 return timeout;
528} 528}
529
530/* Reset transport variables to their initial values */
531void sctp_transport_reset(struct sctp_transport *t)
532{
533 struct sctp_association *asoc = t->asoc;
534
535 /* RFC 2960 (bis), Section 5.2.4
536 * All the congestion control parameters (e.g., cwnd, ssthresh)
537 * related to this peer MUST be reset to their initial values
538 * (see Section 6.2.1)
539 */
540 t->cwnd = min(4*asoc->pathmtu, max_t(__u32, 2*asoc->pathmtu, 4380));
541 t->ssthresh = SCTP_DEFAULT_MAXWINDOW;
542 t->rto = asoc->rto_initial;
543 t->rtt = 0;
544 t->srtt = 0;
545 t->rttvar = 0;
546
547 /* Reset these additional varibles so that we have a clean
548 * slate.
549 */
550 t->partial_bytes_acked = 0;
551 t->flight_size = 0;
552 t->error_count = 0;
553 t->rto_pending = 0;
554
555 /* Initialize the state information for SFR-CACC */
556 t->cacc.changeover_active = 0;
557 t->cacc.cycling_changeover = 0;
558 t->cacc.next_tsn_at_change = 0;
559 t->cacc.cacc_saw_newack = 0;
560}