ITS#9502 TCP_USER_TIMEOUT for lloadd

This commit is contained in:
Ondřej Kuzník 2021-03-16 09:07:16 +00:00 committed by Quanah Gibson-Mount
parent 6e3f6639b9
commit 9bbbbf5f6a
3 changed files with 29 additions and 2 deletions

View 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

View 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 ) {

View 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 },