]> git.sur5r.net Git - openldap/commitdiff
ITS#7513 added TCP keepalive support to back-meta
authorTed C. Cheng <tedcheng@symas.com>
Wed, 30 Jan 2013 19:58:14 +0000 (11:58 -0800)
committerHoward Chu <hyc@openldap.org>
Wed, 24 Apr 2013 08:22:17 +0000 (01:22 -0700)
doc/man/man5/slapd-meta.5
servers/slapd/back-meta/config.c
servers/slapd/back-meta/conn.c

index 4f3c1c6f634f53a646421aa36885c247536b4a60..30d6b63d60f7cf948032b4b7117dc4f333bf6e8e 100644 (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.
index 231c583c93fbaf9d3cdc1a87483e35d54f9051df..06027a5adb2725b7fd875d8c69aac3a8da01a22d 100644 (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;
index da8e0a13e3cf536694dcf1ec22b62db1b1eaa138..7e63fae89604e8b031dd868addb8bf5378b96c71 100644 (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;