Author: glebius
Date: Fri Nov  8 13:04:14 2013
New Revision: 257846
URL: http://svnweb.freebsd.org/changeset/base/257846

Log:
  Make TCP_KEEP* socket options readable. At least PostgreSQL wants
  to read the values.
  
  Reported by:  sobomax

Modified:
  head/share/man/man4/tcp.4
  head/sys/netinet/tcp_usrreq.c

Modified: head/share/man/man4/tcp.4
==============================================================================
--- head/share/man/man4/tcp.4   Fri Nov  8 10:19:48 2013        (r257845)
+++ head/share/man/man4/tcp.4   Fri Nov  8 13:04:14 2013        (r257846)
@@ -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"

Modified: head/sys/netinet/tcp_usrreq.c
==============================================================================
--- head/sys/netinet/tcp_usrreq.c       Fri Nov  8 10:19:48 2013        
(r257845)
+++ head/sys/netinet/tcp_usrreq.c       Fri Nov  8 13:04:14 2013        
(r257846)
@@ -1585,6 +1585,27 @@ unlock_and_done:
                        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;
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to