Make the misnamed tcp initial keepalive timer value (which is really the

time, in seconds, that state for non-established TCP sessions stays about)
a sysctl modifyable variable.

[part 1 of two commits, I just realized I can't play with the indices as
 I was typing this commit message.]
This commit is contained in:
pst 1996-09-13 23:51:44 +00:00
parent 352c6ccbba
commit 1fd59f43bb
6 changed files with 21 additions and 14 deletions

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_input.c 8.12 (Berkeley) 5/24/95
* $Id: tcp_input.c,v 1.46 1996/05/02 05:54:12 fenner Exp $
* $Id: tcp_input.c,v 1.47 1996/09/13 18:47:03 pst Exp $
*/
#ifndef TUBA_INCLUDE
@ -715,7 +715,7 @@ tcp_input(m, iphlen)
tp->rcv_adv += min(tp->rcv_wnd, TCP_MAXWIN);
tcpstat.tcps_connects++;
soisconnected(so);
tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT;
tp->t_timer[TCPT_KEEP] = tcp_keepinit;
dropsocket = 0; /* committed to socket */
tcpstat.tcps_accepts++;
goto trimthenstep6;
@ -734,7 +734,7 @@ tcp_input(m, iphlen)
*/
tp->t_flags |= TF_ACKNOW;
tp->t_state = TCPS_SYN_RECEIVED;
tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT;
tp->t_timer[TCPT_KEEP] = tcp_keepinit;
dropsocket = 0; /* committed to socket */
tcpstat.tcps_accepts++;
goto trimthenstep6;

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_input.c 8.12 (Berkeley) 5/24/95
* $Id: tcp_input.c,v 1.46 1996/05/02 05:54:12 fenner Exp $
* $Id: tcp_input.c,v 1.47 1996/09/13 18:47:03 pst Exp $
*/
#ifndef TUBA_INCLUDE
@ -715,7 +715,7 @@ tcp_input(m, iphlen)
tp->rcv_adv += min(tp->rcv_wnd, TCP_MAXWIN);
tcpstat.tcps_connects++;
soisconnected(so);
tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT;
tp->t_timer[TCPT_KEEP] = tcp_keepinit;
dropsocket = 0; /* committed to socket */
tcpstat.tcps_accepts++;
goto trimthenstep6;
@ -734,7 +734,7 @@ tcp_input(m, iphlen)
*/
tp->t_flags |= TF_ACKNOW;
tp->t_state = TCPS_SYN_RECEIVED;
tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT;
tp->t_timer[TCPT_KEEP] = tcp_keepinit;
dropsocket = 0; /* committed to socket */
tcpstat.tcps_accepts++;
goto trimthenstep6;

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_timer.c 8.2 (Berkeley) 5/24/95
* $Id: tcp_timer.c,v 1.18 1996/07/11 16:32:35 wollman Exp $
* $Id: tcp_timer.c,v 1.19 1996/07/12 17:28:46 davidg Exp $
*/
#ifndef TUBA_INCLUDE
@ -67,6 +67,10 @@
#include <netinet/tcp_debug.h>
#endif
int tcp_keepinit = TCPTV_KEEP_INIT;
SYSCTL_INT(_net_inet_tcp, TCPCTL_KEEPINIT, keepinit,
CTLFLAG_RW, &tcp_keepinit , 0, "");
int tcp_keepidle = TCPTV_KEEP_IDLE;
SYSCTL_INT(_net_inet_tcp, TCPCTL_KEEPIDLE, keepidle,
CTLFLAG_RW, &tcp_keepidle , 0, "");

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_timer.h 8.1 (Berkeley) 6/10/93
* $Id: tcp_timer.h,v 1.8 1996/01/30 22:58:29 mpp Exp $
* $Id: tcp_timer.h,v 1.9 1996/06/14 17:17:32 wollman Exp $
*/
#ifndef _NETINET_TCP_TIMER_H_
@ -127,6 +127,7 @@ static char *tcptimers[] =
}
#ifdef KERNEL
extern int tcp_keepinit; /* time to establish connection */
extern int tcp_keepidle; /* time before keepalive probes begin */
extern int tcp_keepintvl; /* time between keepalive probes */
extern int tcp_maxidle; /* time to drop after starting probes */

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* From: @(#)tcp_usrreq.c 8.2 (Berkeley) 1/3/94
* $Id: tcp_usrreq.c,v 1.23 1996/07/11 16:32:38 wollman Exp $
* $Id: tcp_usrreq.c,v 1.24 1996/07/12 17:28:47 davidg Exp $
*/
#include <sys/param.h>
@ -891,7 +891,7 @@ tcp_connect(tp, nam)
soisconnecting(so);
tcpstat.tcps_connattempt++;
tp->t_state = TCPS_SYN_SENT;
tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT;
tp->t_timer[TCPT_KEEP] = tcp_keepinit;
tp->iss = tcp_iss; tcp_iss += TCP_ISSINCR/2;
tcp_sendseqinit(tp);

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_var.h 8.4 (Berkeley) 5/24/95
* $Id: tcp_var.h,v 1.33 1996/06/05 16:57:38 wollman Exp $
* $Id: tcp_var.h,v 1.34 1996/07/11 16:32:40 wollman Exp $
*/
#ifndef _NETINET_TCP_VAR_H_
@ -307,9 +307,10 @@ struct tcpstat {
#define TCPCTL_RTTDFLT 5 /* default RTT estimate */
#define TCPCTL_KEEPIDLE 6 /* keepalive idle timer */
#define TCPCTL_KEEPINTVL 7 /* interval to send keepalives */
#define TCPCTL_SENDSPACE 8 /* send buffer space */
#define TCPCTL_RECVSPACE 9 /* receive buffer space */
#define TCPCTL_MAXID 10
#define TCPCTL_KEEPINIT 8 /* timeout for establishing syn */
#define TCPCTL_SENDSPACE 9 /* send buffer space */
#define TCPCTL_RECVSPACE 10 /* receive buffer space */
#define TCPCTL_MAXID 11
#define TCPCTL_NAMES { \
{ 0, 0 }, \
@ -320,6 +321,7 @@ struct tcpstat {
{ "rttdflt", CTLTYPE_INT }, \
{ "keepidle", CTLTYPE_INT }, \
{ "keepintvl", CTLTYPE_INT }, \
{ "keepinit", CTLTYPE_INT }, \
{ "sendspace", CTLTYPE_INT }, \
{ "recvspace", CTLTYPE_INT }, \
}