[Midnightbsd-cvs] src [7972] trunk/sys/netinet/tcp_timer.c: In tcp timers, check INP_DROPPED flag a little later, after
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Thu Sep 15 04:10:51 EDT 2016
Revision: 7972
http://svnweb.midnightbsd.org/src/?rev=7972
Author: laffer1
Date: 2016-09-15 04:10:51 -0400 (Thu, 15 Sep 2016)
Log Message:
-----------
In tcp timers, check INP_DROPPED flag a little later, after
callout_deactivate(), so if INP_DROPPED is set we return with the
timer active flag cleared.
For me this fixes negative keep timer values reported by `netstat -x'
for connections in CLOSE state.
Obtained from: FreeBSD
Modified Paths:
--------------
trunk/sys/netinet/tcp_timer.c
Modified: trunk/sys/netinet/tcp_timer.c
===================================================================
--- trunk/sys/netinet/tcp_timer.c 2016-09-15 08:10:01 UTC (rev 7971)
+++ trunk/sys/netinet/tcp_timer.c 2016-09-15 08:10:51 UTC (rev 7972)
@@ -183,13 +183,18 @@
return;
}
INP_WLOCK(inp);
- if ((inp->inp_flags & INP_DROPPED) || callout_pending(&tp->t_timers->tt_delack)
- || !callout_active(&tp->t_timers->tt_delack)) {
+ if (callout_pending(&tp->t_timers->tt_delack) ||
+ !callout_active(&tp->t_timers->tt_delack)) {
INP_WUNLOCK(inp);
CURVNET_RESTORE();
return;
}
callout_deactivate(&tp->t_timers->tt_delack);
+ if ((inp->inp_flags & INP_DROPPED) != 0) {
+ INP_WUNLOCK(inp);
+ CURVNET_RESTORE();
+ return;
+ }
tp->t_flags |= TF_ACKNOW;
TCPSTAT_INC(tcps_delack);
@@ -229,7 +234,7 @@
}
INP_WLOCK(inp);
tcp_free_sackholes(tp);
- if ((inp->inp_flags & INP_DROPPED) || callout_pending(&tp->t_timers->tt_2msl) ||
+ if (callout_pending(&tp->t_timers->tt_2msl) ||
!callout_active(&tp->t_timers->tt_2msl)) {
INP_WUNLOCK(tp->t_inpcb);
INP_INFO_WUNLOCK(&V_tcbinfo);
@@ -237,6 +242,12 @@
return;
}
callout_deactivate(&tp->t_timers->tt_2msl);
+ if ((inp->inp_flags & INP_DROPPED) != 0) {
+ INP_WUNLOCK(inp);
+ INP_INFO_WUNLOCK(&V_tcbinfo);
+ CURVNET_RESTORE();
+ return;
+ }
/*
* 2 MSL timeout in shutdown went off. If we're closed but
* still waiting for peer to close and connection has been idle
@@ -300,8 +311,8 @@
return;
}
INP_WLOCK(inp);
- if ((inp->inp_flags & INP_DROPPED) || callout_pending(&tp->t_timers->tt_keep)
- || !callout_active(&tp->t_timers->tt_keep)) {
+ if (callout_pending(&tp->t_timers->tt_keep) ||
+ !callout_active(&tp->t_timers->tt_keep)) {
INP_WUNLOCK(inp);
INP_INFO_WUNLOCK(&V_tcbinfo);
CURVNET_RESTORE();
@@ -308,6 +319,12 @@
return;
}
callout_deactivate(&tp->t_timers->tt_keep);
+ if ((inp->inp_flags & INP_DROPPED) != 0) {
+ INP_WUNLOCK(inp);
+ INP_INFO_WUNLOCK(&V_tcbinfo);
+ CURVNET_RESTORE();
+ return;
+ }
/*
* Keep-alive timer went off; send something
* or drop connection if idle for too long.
@@ -397,8 +414,8 @@
return;
}
INP_WLOCK(inp);
- if ((inp->inp_flags & INP_DROPPED) || callout_pending(&tp->t_timers->tt_persist)
- || !callout_active(&tp->t_timers->tt_persist)) {
+ if (callout_pending(&tp->t_timers->tt_persist) ||
+ !callout_active(&tp->t_timers->tt_persist)) {
INP_WUNLOCK(inp);
INP_INFO_WUNLOCK(&V_tcbinfo);
CURVNET_RESTORE();
@@ -405,6 +422,12 @@
return;
}
callout_deactivate(&tp->t_timers->tt_persist);
+ if ((inp->inp_flags & INP_DROPPED) != 0) {
+ INP_WUNLOCK(inp);
+ INP_INFO_WUNLOCK(&V_tcbinfo);
+ CURVNET_RESTORE();
+ return;
+ }
/*
* Persistance timer into zero window.
* Force a byte to be output, if possible.
@@ -469,8 +492,8 @@
return;
}
INP_WLOCK(inp);
- if ((inp->inp_flags & INP_DROPPED) || callout_pending(&tp->t_timers->tt_rexmt)
- || !callout_active(&tp->t_timers->tt_rexmt)) {
+ if (callout_pending(&tp->t_timers->tt_rexmt) ||
+ !callout_active(&tp->t_timers->tt_rexmt)) {
INP_WUNLOCK(inp);
INP_INFO_RUNLOCK(&V_tcbinfo);
CURVNET_RESTORE();
@@ -477,6 +500,12 @@
return;
}
callout_deactivate(&tp->t_timers->tt_rexmt);
+ if ((inp->inp_flags & INP_DROPPED) != 0) {
+ INP_WUNLOCK(inp);
+ INP_INFO_RUNLOCK(&V_tcbinfo);
+ CURVNET_RESTORE();
+ return;
+ }
tcp_free_sackholes(tp);
/*
* Retransmission timer went off. Message has not
More information about the Midnightbsd-cvs
mailing list