Re: tcp keepalive diff #1
Here is sthen's first diff again that fixes keepalives, without that stray variable and with the space vs. tabs nits cleared up. It works well here, anyone willing to ok this for sthen? -Bryan. Index: netinet/tcp_input.c === RCS file: /cvs/src/sys/netinet/tcp_input.c,v retrieving revision 1.250 diff -u -p -u -r1.250 tcp_input.c --- netinet/tcp_input.c 13 May 2011 14:31:16 - 1.250 +++ netinet/tcp_input.c 21 Jun 2011 11:51:40 - @@ -961,8 +961,12 @@ findpcb: * Reset idle time and keep-alive timer. */ tp->t_rcvtime = tcp_now; - if (TCPS_HAVEESTABLISHED(tp->t_state)) - TCP_TIMER_ARM(tp, TCPT_KEEP, tcp_keepidle); + if (TCPS_HAVEESTABLISHED(tp->t_state)) { + if (tp->t_inpcb->inp_socket->so_options & SO_KEEPALIVE) + TCP_TIMER_ARM(tp, TCPT_KEEP, tcp_keepintvl); + else + TCP_TIMER_ARM(tp, TCPT_KEEP, tcp_keepidle); + } #ifdef TCP_SACK if (tp->sack_enable)
Re: tcp keepalive diff #1
On 2011/06/14 16:22, Stuart Henderson wrote: > actually send keepalives at tcp_keepintvl half-seconds. > > previously, tcp_timer.c would arm the timer at tcp_keepintvl half-seconds > in tcp_timer_keep(), but then the code touched in the diff below would > reset it to tcp_keepidle half-seconds instead > > any comments? > ok? > > Index: netinet/tcp_input.c > === > RCS file: /cvs/src/sys/netinet/tcp_input.c,v > retrieving revision 1.250 > diff -u -p -r1.250 tcp_input.c > --- netinet/tcp_input.c 13 May 2011 14:31:16 - 1.250 > +++ netinet/tcp_input.c 14 Jun 2011 15:17:50 - > @@ -961,8 +961,13 @@ findpcb: >* Reset idle time and keep-alive timer. >*/ > tp->t_rcvtime = tcp_now; > - if (TCPS_HAVEESTABLISHED(tp->t_state)) > - TCP_TIMER_ARM(tp, TCPT_KEEP, tcp_keepidle); > + if (TCPS_HAVEESTABLISHED(tp->t_state)) { > + if (tcp_always_keepalive || > + tp->t_inpcb->inp_socket->so_options & SO_KEEPALIVE) sorry, brynet pointed out this depends on diff #2; if you'd like to test it alone, use this line instead: + if (tp->t_inpcb->inp_socket->so_options & SO_KEEPALIVE) > + TCP_TIMER_ARM(tp, TCPT_KEEP, tcp_keepintvl); > + else > + TCP_TIMER_ARM(tp, TCPT_KEEP, tcp_keepidle); > + } > > #ifdef TCP_SACK > if (tp->sack_enable)
tcp keepalive diff #1
actually send keepalives at tcp_keepintvl half-seconds. previously, tcp_timer.c would arm the timer at tcp_keepintvl half-seconds in tcp_timer_keep(), but then the code touched in the diff below would reset it to tcp_keepidle half-seconds instead any comments? ok? Index: netinet/tcp_input.c === RCS file: /cvs/src/sys/netinet/tcp_input.c,v retrieving revision 1.250 diff -u -p -r1.250 tcp_input.c --- netinet/tcp_input.c 13 May 2011 14:31:16 - 1.250 +++ netinet/tcp_input.c 14 Jun 2011 15:17:50 - @@ -961,8 +961,13 @@ findpcb: * Reset idle time and keep-alive timer. */ tp->t_rcvtime = tcp_now; - if (TCPS_HAVEESTABLISHED(tp->t_state)) - TCP_TIMER_ARM(tp, TCPT_KEEP, tcp_keepidle); + if (TCPS_HAVEESTABLISHED(tp->t_state)) { + if (tcp_always_keepalive || + tp->t_inpcb->inp_socket->so_options & SO_KEEPALIVE) + TCP_TIMER_ARM(tp, TCPT_KEEP, tcp_keepintvl); + else + TCP_TIMER_ARM(tp, TCPT_KEEP, tcp_keepidle); + } #ifdef TCP_SACK if (tp->sack_enable)