Make TCP_KEEP* socket options readable. At least PostgreSQL wants
to read the values. Reported by: sobomax
This commit is contained in:
parent
cd28e9c5e0
commit
2f3eb7f4d8
@ -38,7 +38,7 @@
|
||||
.\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd March 7, 2012
|
||||
.Dd November 8, 2013
|
||||
.Dt TCP 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -48,6 +48,7 @@
|
||||
.In sys/types.h
|
||||
.In sys/socket.h
|
||||
.In netinet/in.h
|
||||
.In netinet/tcp.h
|
||||
.Ft int
|
||||
.Fn socket AF_INET SOCK_STREAM 0
|
||||
.Sh DESCRIPTION
|
||||
@ -147,7 +148,7 @@ See
|
||||
.Xr mod_cc 4
|
||||
for details.
|
||||
.It Dv TCP_KEEPINIT
|
||||
This write-only
|
||||
This
|
||||
.Xr setsockopt 2
|
||||
option accepts a per-socket timeout argument of
|
||||
.Vt "u_int"
|
||||
@ -160,7 +161,7 @@ in the
|
||||
.Sx MIB Variables
|
||||
section further down.
|
||||
.It Dv TCP_KEEPIDLE
|
||||
This write-only
|
||||
This
|
||||
.Xr setsockopt 2
|
||||
option accepts an argument of
|
||||
.Vt "u_int"
|
||||
@ -176,7 +177,7 @@ in the
|
||||
.Sx MIB Variables
|
||||
section further down.
|
||||
.It Dv TCP_KEEPINTVL
|
||||
This write-only
|
||||
This
|
||||
.Xr setsockopt 2
|
||||
option accepts an argument of
|
||||
.Vt "u_int"
|
||||
@ -191,7 +192,7 @@ in the
|
||||
.Sx MIB Variables
|
||||
section further down.
|
||||
.It Dv TCP_KEEPCNT
|
||||
This write-only
|
||||
This
|
||||
.Xr setsockopt 2
|
||||
option accepts an argument of
|
||||
.Vt "u_int"
|
||||
|
@ -1585,6 +1585,27 @@ tcp_ctloutput(struct socket *so, struct sockopt *sopt)
|
||||
INP_WUNLOCK(inp);
|
||||
error = sooptcopyout(sopt, buf, TCP_CA_NAME_MAX);
|
||||
break;
|
||||
case TCP_KEEPIDLE:
|
||||
case TCP_KEEPINTVL:
|
||||
case TCP_KEEPINIT:
|
||||
case TCP_KEEPCNT:
|
||||
switch (sopt->sopt_name) {
|
||||
case TCP_KEEPIDLE:
|
||||
ui = tp->t_keepidle / hz;
|
||||
break;
|
||||
case TCP_KEEPINTVL:
|
||||
ui = tp->t_keepintvl / hz;
|
||||
break;
|
||||
case TCP_KEEPINIT:
|
||||
ui = tp->t_keepinit / hz;
|
||||
break;
|
||||
case TCP_KEEPCNT:
|
||||
ui = tp->t_keepcnt;
|
||||
break;
|
||||
}
|
||||
INP_WUNLOCK(inp);
|
||||
error = sooptcopyout(sopt, &ui, sizeof(ui));
|
||||
break;
|
||||
default:
|
||||
INP_WUNLOCK(inp);
|
||||
error = ENOPROTOOPT;
|
||||
|
Loading…
Reference in New Issue
Block a user