ITS#7513 added TCP keepalive support to back-meta

This commit is contained in:
Ted C. Cheng 2013-01-30 11:58:14 -08:00 committed by Howard Chu
parent 1e68029078
commit d3633632e1
3 changed files with 53 additions and 0 deletions

View File

@ -546,6 +546,25 @@ minutes and seconds.
If set before any target specification, it affects all targets, unless
overridden by any per-target directive.
.TP
.B keepalive <idle>:<probes>:<interval>
The
.B keepalive
parameter sets the values of \fIidle\fP, \fIprobes\fP, and \fIinterval\fP
used to check whether a socket is alive;
.I idle
is the number of seconds a connection needs to remain idle before TCP
starts sending keepalive probes;
.I probes
is the maximum number of keepalive probes TCP should send before dropping
the connection;
.I interval
is interval in seconds between individual keepalive probes.
Only some systems support the customization of these values;
the
.B keepalive
parameter is ignored otherwise, and system-wide settings are used.
.TP
.B map "{attribute|objectclass} [<local name>|*] {<foreign name>|*}"
This maps object classes and attributes as in the LDAP backend.

View File

@ -100,6 +100,7 @@ enum {
LDAP_BACK_CFG_SUBTREE_IN,
LDAP_BACK_CFG_PSEUDOROOTDN,
LDAP_BACK_CFG_PSEUDOROOTPW,
LDAP_BACK_CFG_KEEPALIVE,
LDAP_BACK_CFG_LAST
};
@ -407,6 +408,15 @@ static ConfigTable metacfg[] = {
"SYNTAX OMsDirectoryString "
"SINGLE-VALUE X-ORDERED 'SIBLINGS' )", NULL, NULL },
{ "keepalive", "keepalive", 2, 2, 0,
ARG_MAGIC|LDAP_BACK_CFG_KEEPALIVE,
meta_back_cf_gen, "( OLcfgDbAt:3.29 "
"NAME 'olcDbKeepalive' "
"DESC 'TCP keepalive' "
"SYNTAX OMsDirectoryString "
"SINGLE-VALUE )",
NULL, NULL },
{ NULL, NULL, 0, 0, 0, ARG_IGNORED,
NULL, NULL, NULL, NULL }
};
@ -466,6 +476,7 @@ static ConfigOCs metaocs[] = {
"$ olcDbSubtreeExclude "
"$ olcDbSubtreeInclude "
"$ olcDbTimeout "
"$ olcDbKeepalive "
/* defaults may be inherited */
COMMON_ATTRS
@ -1589,6 +1600,16 @@ meta_back_cf_gen( ConfigArgs *c )
rc = 1;
break;
case LDAP_BACK_CFG_KEEPALIVE: {
struct berval bv;
char buf[AC_LINE_MAX];
bv.bv_len = AC_LINE_MAX;
bv.bv_val = &buf[0];
slap_keepalive_parse(&bv, &mt->mt_tls.sb_keepalive, 0, 0, 1);
value_add_one( &c->rvalue_vals, &bv );
break;
}
default:
rc = 1;
}
@ -1803,6 +1824,12 @@ meta_back_cf_gen( ConfigArgs *c )
}
break;
case LDAP_BACK_CFG_KEEPALIVE:
mt->mt_tls.sb_keepalive.sk_idle = 0;
mt->mt_tls.sb_keepalive.sk_probes = 0;
mt->mt_tls.sb_keepalive.sk_interval = 0;
break;
default:
rc = 1;
break;
@ -2809,6 +2836,11 @@ map_fail:;
break;
#endif /* SLAPD_META_CLIENT_PR */
case LDAP_BACK_CFG_KEEPALIVE:
slap_keepalive_parse( ber_bvstrdup(c->argv[1]),
&mt->mt_tls.sb_keepalive, 0, 0, 0);
break;
/* anything else */
default:
return SLAP_CONF_UNKNOWN;

View File

@ -421,6 +421,8 @@ retry_lock:;
ldap_set_option( msc->msc_ld, LDAP_OPT_REFERRALS,
META_BACK_TGT_CHASE_REFERRALS( mt ) ? LDAP_OPT_ON : LDAP_OPT_OFF );
slap_client_keepalive(msc->msc_ld, &mt->mt_tls.sb_keepalive);
#ifdef HAVE_TLS
if ( !is_ldaps ) {
slap_bindconf *sb = NULL;