Page MenuHomeFreeBSD

D8243.id21363.diff
No OneTemporary

D8243.id21363.diff

Index: sys/netinet/tcp_input.c
===================================================================
--- sys/netinet/tcp_input.c
+++ sys/netinet/tcp_input.c
@@ -1565,8 +1565,6 @@
* validation to ignore broken/spoofed segs.
*/
tp->t_rcvtime = ticks;
- if (TCPS_HAVEESTABLISHED(tp->t_state))
- tcp_timer_activate(tp, TT_KEEP, TP_KEEPIDLE(tp));
/*
* Scale up the window into a 32-bit value.
Index: sys/netinet/tcp_stacks/fastpath.c
===================================================================
--- sys/netinet/tcp_stacks/fastpath.c
+++ sys/netinet/tcp_stacks/fastpath.c
@@ -1819,8 +1819,6 @@
* validation to ignore broken/spoofed segs.
*/
tp->t_rcvtime = ticks;
- if (TCPS_HAVEESTABLISHED(tp->t_state))
- tcp_timer_activate(tp, TT_KEEP, TP_KEEPIDLE(tp));
/*
* Unscale the window into a 32-bit value.
@@ -2266,8 +2264,6 @@
* validation to ignore broken/spoofed segs.
*/
tp->t_rcvtime = ticks;
- if (TCPS_HAVEESTABLISHED(tp->t_state))
- tcp_timer_activate(tp, TT_KEEP, TP_KEEPIDLE(tp));
/*
* Unscale the window into a 32-bit value.
Index: sys/netinet/tcp_timer.c
===================================================================
--- sys/netinet/tcp_timer.c
+++ sys/netinet/tcp_timer.c
@@ -468,6 +468,26 @@
}
KASSERT((tp->t_timers->tt_flags & TT_STOPPED) == 0,
("%s: tp %p tcpcb can't be stopped here", __func__, tp));
+
+ /*
+ * Because we don't regularly reset the keepalive callout in
+ * the ESTABLISHED state, it may be that we don't actually need
+ * to send a keepalive yet. If that occurs, schedule another
+ * call for the next time the keepalive timer might expire.
+ */
+ if (TCPS_HAVEESTABLISHED(tp->t_state)) {
+ u_int idletime;
+
+ idletime = ticks - tp->t_rcvtime;
+ if (idletime < TP_KEEPIDLE(tp)) {
+ callout_reset(&tp->t_timers->tt_keep,
+ TP_KEEPIDLE(tp) - idletime, tcp_timer_keep, tp);
+ INP_WUNLOCK(inp);
+ CURVNET_RESTORE();
+ return;
+ }
+ }
+
/*
* Keep-alive timer went off; send something
* or drop connection if idle for too long.

File Metadata

Mime Type
text/plain
Expires
Sat, Oct 11, 10:26 PM (18 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
23595175
Default Alt Text
D8243.id21363.diff (1 KB)

Event Timeline