]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#9502 TCP_USER_TIMEOUT for lloadd
authorOndřej Kuzník <ondra@mistotebe.net>
Tue, 16 Mar 2021 09:07:16 +0000 (09:07 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Thu, 22 Apr 2021 21:52:12 +0000 (21:52 +0000)
doc/man/man5/lloadd.conf.5
servers/lloadd/backend.c
servers/lloadd/config.c

index 649156c90620f9dd8d7fc31995ebea95f4973681..d6e5ade0300afc36c4678d1ddee6535992ca8a83 100644 (file)
@@ -598,6 +598,7 @@ option. The authentication configuration is shared between them.
 .B [secprops=<properties>]
 .B [timeout=<seconds>]
 .B [network\-timeout=<seconds>]
+.B [tcp\-user\-timeout=<milliseconds>]
 
 Specifies the bind credentials
 .B lloadd
@@ -656,6 +657,14 @@ Bind request to complete.
 Timeout set to 0 means no timeout is in effect and by default, no timeouts are
 in effect.
 
+The
+.B tcp\-user\-timeout
+parameter, if non-zero, corresponds to the
+.B TCP_USER_TIMEOUT
+set on the upstream connections, overriding the operating system setting.
+Only some systems support the customization of this parameter, it is
+ignored otherwise and system-wide settings are used.
+
 .SH BACKEND OPTIONS
 
 .TP
@@ -830,6 +839,7 @@ default lloadd configuration file
 .BR ldap (3),
 .BR gnutls\-cli (1),
 .BR slapd.conf (5),
+.BR tcp (7),
 .BR lloadd (8),
 .BR slapd (8).
 .LP
index 5050548d4ba749019a4466c40e5c7aee6bc05512..4df22ac14d36cf2afbba09366ec18e2f6a34679f 100644 (file)
@@ -192,6 +192,22 @@ upstream_name_cb( int result, struct evutil_addrinfo *res, void *arg )
 #endif /* TCP_KEEPINTVL */
         }
 #endif /* SO_KEEPALIVE */
+        if ( bindconf.sb_tcp_user_timeout > 0 ) {
+#ifdef TCP_USER_TIMEOUT
+            if ( setsockopt( s, IPPROTO_TCP, TCP_USER_TIMEOUT,
+                         (void *)&bindconf.sb_tcp_user_timeout,
+                         sizeof(bindconf.sb_tcp_user_timeout) ) ==
+                    AC_SOCKET_ERROR ) {
+                Debug( LDAP_DEBUG_TRACE, "upstream_name_cb: "
+                        "setsockopt(%d, TCP_USER_TIMEOUT) failed (ignored).\n",
+                        s );
+            }
+#else
+            Debug( LDAP_DEBUG_TRACE, "upstream_name_cb: "
+                    "sockopt TCP_USER_TIMEOUT not supported on this "
+                    "system.\n" );
+#endif /* TCP_USER_TIMEOUT */
+        }
 #ifdef TCP_NODELAY
         if ( setsockopt( s, IPPROTO_TCP, TCP_NODELAY, (char *)&dummy,
                      sizeof(dummy) ) == AC_SOCKET_ERROR ) {
index ba827bfe2bec000005de9a2347c200cb13426930..dad2670b5e85b07e582dd93c6228f4f7dcc9dd79 100644 (file)
@@ -2774,10 +2774,11 @@ static slap_cf_aux_table bindkey[] = {
     { BER_BVC("authcID="), offsetof(slap_bindconf, sb_authcId), 'b', 1, NULL },
     { BER_BVC("authzID="), offsetof(slap_bindconf, sb_authzId), 'b', 1, NULL },
     { BER_BVC("keepalive="), offsetof(slap_bindconf, sb_keepalive), 'x', 0, (slap_verbmasks *)lload_keepalive_parse },
+    { BER_BVC("tcp-user-timeout="), offsetof(slap_bindconf, sb_tcp_user_timeout), 'u', 0, NULL },
 #ifdef HAVE_TLS
-    /* NOTE: replace "11" with the actual index
+    /* NOTE: replace "12" with the actual index
      * of the first TLS-related line */
-#define aux_TLS (bindkey+11) /* beginning of TLS keywords */
+#define aux_TLS (bindkey+12) /* beginning of TLS keywords */
 
     { BER_BVC("tls_cert="), offsetof(slap_bindconf, sb_tls_cert), 's', 1, NULL },
     { BER_BVC("tls_key="), offsetof(slap_bindconf, sb_tls_key), 's', 1, NULL },