[stunnel-users] patch: TCP keep-alive socket options

Ludolf Holzheid lholzheid at bihl-wiedemann.de
Fri May 8 10:28:16 CEST 2009


Dear list,

the attached patch allows for tweaking the TCP keep-alive socket
options on Linux 2.4 and later. Thanks to the groundwork laid by
Michal, this got fairly trivial.

We use this to keep NAT table entries alive for connections that are
expected to have idle periods longer than the NAT time-outs of the
routers in involved.

Ludolf

-- 

---------------------------------------------------------------
Ludolf Holzheid             Tel:    +49 621 339960
Bihl+Wiedemann GmbH         Fax:    +49 621 3392239
Floßwörthstraße 41          e-mail: lholzheid at bihl-wiedemann.de
D-68199 Mannheim, Germany
---------------------------------------------------------------
-------------- next part --------------
diff -ur stunnel-4.27-org/src/options.c stunnel-4.27/src/options.c
--- stunnel-4.27-org/src/options.c      2009-04-16 10:49:20.000000000 +0200
+++ stunnel-4.27/src/options.c  2009-04-30 16:35:41.000000000 +0200
@@ -1718,6 +1718,15 @@
     {"SO_DEBUG",        SOL_SOCKET,  SO_DEBUG,        TYPE_FLAG,    DEF_VALS},
     {"SO_DONTROUTE",    SOL_SOCKET,  SO_DONTROUTE,    TYPE_FLAG,    DEF_VALS},
     {"SO_KEEPALIVE",    SOL_SOCKET,  SO_KEEPALIVE,    TYPE_FLAG,    DEF_VALS},
+#ifdef TCP_KEEPCNT
+    {"TCP_KEEPCNT",     SOL_TCP,     TCP_KEEPCNT,     TYPE_INT,     DEF_VALS},
+#endif
+#ifdef TCP_KEEPIDLE
+    {"TCP_KEEPIDLE",    SOL_TCP,     TCP_KEEPIDLE,    TYPE_INT,     DEF_VALS},
+#endif
+#ifdef TCP_KEEPINTVL
+    {"TCP_KEEPINTVL",   SOL_TCP,     TCP_KEEPINTVL,   TYPE_INT,     DEF_VALS},
+#endif
     {"SO_LINGER",       SOL_SOCKET,  SO_LINGER,       TYPE_LINGER,  DEF_VALS},
     {"SO_OOBINLINE",    SOL_SOCKET,  SO_OOBINLINE,    TYPE_FLAG,    DEF_VALS},
     {"SO_RCVBUF",       SOL_SOCKET,  SO_RCVBUF,       TYPE_INT,     DEF_VALS},


More information about the stunnel-users mailing list