| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: tcp_output.c,v 1.167.10.1 2011/03/29 20:12:14 riz Exp $ */ | | 1 | /* $NetBSD: tcp_output.c,v 1.167.10.1.2.1 2015/07/24 07:44:35 martin 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.167.10.1 2011/03/29 20:12:14 riz Exp $"); | | 138 | __KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.167.10.1.2.1 2015/07/24 07:44:35 martin 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/malloc.h> | | 146 | #include <sys/malloc.h> |
147 | #include <sys/mbuf.h> | | 147 | #include <sys/mbuf.h> |
148 | #include <sys/protosw.h> | | 148 | #include <sys/protosw.h> |
149 | #include <sys/socket.h> | | 149 | #include <sys/socket.h> |
150 | #include <sys/socketvar.h> | | 150 | #include <sys/socketvar.h> |
151 | #include <sys/errno.h> | | 151 | #include <sys/errno.h> |
| @@ -1514,34 +1514,44 @@ send: | | | @@ -1514,34 +1514,44 @@ send: |
1514 | TCP_STATINC(TCP_STAT_SEGSTIMED); | | 1514 | TCP_STATINC(TCP_STAT_SEGSTIMED); |
1515 | } | | 1515 | } |
1516 | } | | 1516 | } |
1517 | | | 1517 | |
1518 | /* | | 1518 | /* |
1519 | * Set retransmit timer if not currently set, | | 1519 | * Set retransmit timer if not currently set, |
1520 | * and not doing an ack or a keep-alive probe. | | 1520 | * and not doing an ack or a keep-alive probe. |
1521 | * Initial value for retransmit timer is smoothed | | 1521 | * Initial value for retransmit timer is smoothed |
1522 | * round-trip time + 2 * round-trip time variance. | | 1522 | * round-trip time + 2 * round-trip time variance. |
1523 | * Initialize shift counter which is used for backoff | | 1523 | * Initialize shift counter which is used for backoff |
1524 | * of retransmit time. | | 1524 | * of retransmit time. |
1525 | */ | | 1525 | */ |
1526 | timer: | | 1526 | timer: |
1527 | if (TCP_TIMER_ISARMED(tp, TCPT_REXMT) == 0 && | | 1527 | if (TCP_TIMER_ISARMED(tp, TCPT_REXMT) == 0) { |
1528 | ((sack_rxmit && tp->snd_nxt != tp->snd_max) || | | 1528 | if ((sack_rxmit && tp->snd_nxt != tp->snd_max) |
1529 | tp->snd_nxt != tp->snd_una)) { | | 1529 | || tp->snd_nxt != tp->snd_una) { |
1530 | if (TCP_TIMER_ISARMED(tp, TCPT_PERSIST)) { | | 1530 | if (TCP_TIMER_ISARMED(tp, TCPT_PERSIST)) { |
1531 | TCP_TIMER_DISARM(tp, TCPT_PERSIST); | | 1531 | TCP_TIMER_DISARM(tp, TCPT_PERSIST); |
| | | 1532 | tp->t_rxtshift = 0; |
| | | 1533 | } |
| | | 1534 | TCP_TIMER_ARM(tp, TCPT_REXMT, tp->t_rxtcur); |
| | | 1535 | } else if (len == 0 && so->so_snd.sb_cc > 0 |
| | | 1536 | && TCP_TIMER_ISARMED(tp, TCPT_PERSIST) == 0) { |
| | | 1537 | /* |
| | | 1538 | * If we are sending a window probe and there's |
| | | 1539 | * unacked data in the socket, make sure at |
| | | 1540 | * least the persist timer is running. |
| | | 1541 | */ |
1532 | tp->t_rxtshift = 0; | | 1542 | tp->t_rxtshift = 0; |
| | | 1543 | tcp_setpersist(tp); |
1533 | } | | 1544 | } |
1534 | TCP_TIMER_ARM(tp, TCPT_REXMT, tp->t_rxtcur); | | | |
1535 | } | | 1545 | } |
1536 | } else | | 1546 | } else |
1537 | if (SEQ_GT(tp->snd_nxt + len, tp->snd_max)) | | 1547 | if (SEQ_GT(tp->snd_nxt + len, tp->snd_max)) |
1538 | tp->snd_max = tp->snd_nxt + len; | | 1548 | tp->snd_max = tp->snd_nxt + len; |
1539 | | | 1549 | |
1540 | #ifdef TCP_DEBUG | | 1550 | #ifdef TCP_DEBUG |
1541 | /* | | 1551 | /* |
1542 | * Trace. | | 1552 | * Trace. |
1543 | */ | | 1553 | */ |
1544 | if (so->so_options & SO_DEBUG) | | 1554 | if (so->so_options & SO_DEBUG) |
1545 | tcp_trace(TA_OUTPUT, tp->t_state, tp, m, 0); | | 1555 | tcp_trace(TA_OUTPUT, tp->t_state, tp, m, 0); |
1546 | #endif | | 1556 | #endif |
1547 | | | 1557 | |