Skip to content

Commit d363363

Browse files
Ted C. Chenghyc
Ted C. Cheng
authored andcommitted
ITS#7513 added TCP keepalive support to back-meta
1 parent 1e68029 commit d363363

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

doc/man/man5/slapd-meta.5

+19
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,25 @@ minutes and seconds.
546546
If set before any target specification, it affects all targets, unless
547547
overridden by any per-target directive.
548548

549+
.TP
550+
.B keepalive <idle>:<probes>:<interval>
551+
The
552+
.B keepalive
553+
parameter sets the values of \fIidle\fP, \fIprobes\fP, and \fIinterval\fP
554+
used to check whether a socket is alive;
555+
.I idle
556+
is the number of seconds a connection needs to remain idle before TCP
557+
starts sending keepalive probes;
558+
.I probes
559+
is the maximum number of keepalive probes TCP should send before dropping
560+
the connection;
561+
.I interval
562+
is interval in seconds between individual keepalive probes.
563+
Only some systems support the customization of these values;
564+
the
565+
.B keepalive
566+
parameter is ignored otherwise, and system-wide settings are used.
567+
549568
.TP
550569
.B map "{attribute|objectclass} [<local name>|*] {<foreign name>|*}"
551570
This maps object classes and attributes as in the LDAP backend.

servers/slapd/back-meta/config.c

+32
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ enum {
100100
LDAP_BACK_CFG_SUBTREE_IN,
101101
LDAP_BACK_CFG_PSEUDOROOTDN,
102102
LDAP_BACK_CFG_PSEUDOROOTPW,
103+
LDAP_BACK_CFG_KEEPALIVE,
103104

104105
LDAP_BACK_CFG_LAST
105106
};
@@ -407,6 +408,15 @@ static ConfigTable metacfg[] = {
407408
"SYNTAX OMsDirectoryString "
408409
"SINGLE-VALUE X-ORDERED 'SIBLINGS' )", NULL, NULL },
409410

411+
{ "keepalive", "keepalive", 2, 2, 0,
412+
ARG_MAGIC|LDAP_BACK_CFG_KEEPALIVE,
413+
meta_back_cf_gen, "( OLcfgDbAt:3.29 "
414+
"NAME 'olcDbKeepalive' "
415+
"DESC 'TCP keepalive' "
416+
"SYNTAX OMsDirectoryString "
417+
"SINGLE-VALUE )",
418+
NULL, NULL },
419+
410420
{ NULL, NULL, 0, 0, 0, ARG_IGNORED,
411421
NULL, NULL, NULL, NULL }
412422
};
@@ -466,6 +476,7 @@ static ConfigOCs metaocs[] = {
466476
"$ olcDbSubtreeExclude "
467477
"$ olcDbSubtreeInclude "
468478
"$ olcDbTimeout "
479+
"$ olcDbKeepalive "
469480

470481
/* defaults may be inherited */
471482
COMMON_ATTRS
@@ -1589,6 +1600,16 @@ meta_back_cf_gen( ConfigArgs *c )
15891600
rc = 1;
15901601
break;
15911602

1603+
case LDAP_BACK_CFG_KEEPALIVE: {
1604+
struct berval bv;
1605+
char buf[AC_LINE_MAX];
1606+
bv.bv_len = AC_LINE_MAX;
1607+
bv.bv_val = &buf[0];
1608+
slap_keepalive_parse(&bv, &mt->mt_tls.sb_keepalive, 0, 0, 1);
1609+
value_add_one( &c->rvalue_vals, &bv );
1610+
break;
1611+
}
1612+
15921613
default:
15931614
rc = 1;
15941615
}
@@ -1803,6 +1824,12 @@ meta_back_cf_gen( ConfigArgs *c )
18031824
}
18041825
break;
18051826

1827+
case LDAP_BACK_CFG_KEEPALIVE:
1828+
mt->mt_tls.sb_keepalive.sk_idle = 0;
1829+
mt->mt_tls.sb_keepalive.sk_probes = 0;
1830+
mt->mt_tls.sb_keepalive.sk_interval = 0;
1831+
break;
1832+
18061833
default:
18071834
rc = 1;
18081835
break;
@@ -2809,6 +2836,11 @@ map_fail:;
28092836
break;
28102837
#endif /* SLAPD_META_CLIENT_PR */
28112838

2839+
case LDAP_BACK_CFG_KEEPALIVE:
2840+
slap_keepalive_parse( ber_bvstrdup(c->argv[1]),
2841+
&mt->mt_tls.sb_keepalive, 0, 0, 0);
2842+
break;
2843+
28122844
/* anything else */
28132845
default:
28142846
return SLAP_CONF_UNKNOWN;

servers/slapd/back-meta/conn.c

+2
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,8 @@ retry_lock:;
421421
ldap_set_option( msc->msc_ld, LDAP_OPT_REFERRALS,
422422
META_BACK_TGT_CHASE_REFERRALS( mt ) ? LDAP_OPT_ON : LDAP_OPT_OFF );
423423

424+
slap_client_keepalive(msc->msc_ld, &mt->mt_tls.sb_keepalive);
425+
424426
#ifdef HAVE_TLS
425427
if ( !is_ldaps ) {
426428
slap_bindconf *sb = NULL;

0 commit comments

Comments
 (0)