Fri Jul 24 04:33:50 2015 UTC ()
If we are sending a window probe and there's unacked data in the socket, make
sure at least the persist timer is running.


(matt)
diff -r1.183 -r1.184 src/sys/netinet/tcp_output.c

cvs diff -r1.183 -r1.184 src/sys/netinet/tcp_output.c (expand / switch to unified diff)

--- src/sys/netinet/tcp_output.c 2015/05/16 01:15:34 1.183
+++ src/sys/netinet/tcp_output.c 2015/07/24 04:33:50 1.184
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: tcp_output.c,v 1.183 2015/05/16 01:15:34 kefren Exp $ */ 1/* $NetBSD: tcp_output.c,v 1.184 2015/07/24 04:33:50 matt Exp $ */
2 2
3/* 3/*
4 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 4 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -125,27 +125,27 @@ @@ -125,27 +125,27 @@
125 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 125 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
126 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 126 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
127 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 127 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
128 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 128 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
129 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 129 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
130 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 130 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
131 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 131 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
132 * SUCH DAMAGE. 132 * SUCH DAMAGE.
133 * 133 *
134 * @(#)tcp_output.c 8.4 (Berkeley) 5/24/95 134 * @(#)tcp_output.c 8.4 (Berkeley) 5/24/95
135 */ 135 */
136 136
137#include <sys/cdefs.h> 137#include <sys/cdefs.h>
138__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.183 2015/05/16 01:15:34 kefren Exp $"); 138__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.184 2015/07/24 04:33:50 matt Exp $");
139 139
140#include "opt_inet.h" 140#include "opt_inet.h"
141#include "opt_ipsec.h" 141#include "opt_ipsec.h"
142#include "opt_tcp_debug.h" 142#include "opt_tcp_debug.h"
143 143
144#include <sys/param.h> 144#include <sys/param.h>
145#include <sys/systm.h> 145#include <sys/systm.h>
146#include <sys/mbuf.h> 146#include <sys/mbuf.h>
147#include <sys/protosw.h> 147#include <sys/protosw.h>
148#include <sys/socket.h> 148#include <sys/socket.h>
149#include <sys/socketvar.h> 149#include <sys/socketvar.h>
150#include <sys/errno.h> 150#include <sys/errno.h>
151#include <sys/domain.h> 151#include <sys/domain.h>
@@ -1523,34 +1523,44 @@ send: @@ -1523,34 +1523,44 @@ send:
1523 TCP_STATINC(TCP_STAT_SEGSTIMED); 1523 TCP_STATINC(TCP_STAT_SEGSTIMED);
1524 } 1524 }
1525 } 1525 }
1526 1526
1527 /* 1527 /*
1528 * Set retransmit timer if not currently set, 1528 * Set retransmit timer if not currently set,
1529 * and not doing an ack or a keep-alive probe. 1529 * and not doing an ack or a keep-alive probe.
1530 * Initial value for retransmit timer is smoothed 1530 * Initial value for retransmit timer is smoothed
1531 * round-trip time + 2 * round-trip time variance. 1531 * round-trip time + 2 * round-trip time variance.
1532 * Initialize shift counter which is used for backoff 1532 * Initialize shift counter which is used for backoff
1533 * of retransmit time. 1533 * of retransmit time.
1534 */ 1534 */
1535timer: 1535timer:
1536 if (TCP_TIMER_ISARMED(tp, TCPT_REXMT) == 0 && 1536 if (TCP_TIMER_ISARMED(tp, TCPT_REXMT) == 0) {
1537 ((sack_rxmit && tp->snd_nxt != tp->snd_max) || 1537 if ((sack_rxmit && tp->snd_nxt != tp->snd_max)
1538 tp->snd_nxt != tp->snd_una)) { 1538 || tp->snd_nxt != tp->snd_una) {
1539 if (TCP_TIMER_ISARMED(tp, TCPT_PERSIST)) { 1539 if (TCP_TIMER_ISARMED(tp, TCPT_PERSIST)) {
1540 TCP_TIMER_DISARM(tp, TCPT_PERSIST); 1540 TCP_TIMER_DISARM(tp, TCPT_PERSIST);
 1541 tp->t_rxtshift = 0;
 1542 }
 1543 TCP_TIMER_ARM(tp, TCPT_REXMT, tp->t_rxtcur);
 1544 } else if (len == 0 && so->so_snd.sb_cc > 0
 1545 && TCP_TIMER_ISARMED(tp, TCPT_PERSIST) == 0) {
 1546 /*
 1547 * If we are sending a window probe and there's
 1548 * unacked data in the socket, make sure at
 1549 * least the persist timer is running.
 1550 */
1541 tp->t_rxtshift = 0; 1551 tp->t_rxtshift = 0;
 1552 tcp_setpersist(tp);
1542 } 1553 }
1543 TCP_TIMER_ARM(tp, TCPT_REXMT, tp->t_rxtcur); 
1544 } 1554 }
1545 } else 1555 } else
1546 if (SEQ_GT(tp->snd_nxt + len, tp->snd_max)) 1556 if (SEQ_GT(tp->snd_nxt + len, tp->snd_max))
1547 tp->snd_max = tp->snd_nxt + len; 1557 tp->snd_max = tp->snd_nxt + len;
1548 1558
1549#ifdef TCP_DEBUG 1559#ifdef TCP_DEBUG
1550 /* 1560 /*
1551 * Trace. 1561 * Trace.
1552 */ 1562 */
1553 if (so->so_options & SO_DEBUG) 1563 if (so->so_options & SO_DEBUG)
1554 tcp_trace(TA_OUTPUT, tp->t_state, tp, m, 0); 1564 tcp_trace(TA_OUTPUT, tp->t_state, tp, m, 0);
1555#endif 1565#endif
1556 1566