From 029e230581a4b8e955db01dd0735f1ad9db521ac Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Thu, 16 Jan 2014 12:57:22 -0700 Subject: [PATCH 82/83] Ticket #47516 replication stops with excessive clock skew https://fedorahosted.org/389/ticket/47516 Reviewed by: nhosoi (Thanks!) Branch: 389-ds-base-1.3.1 Fix Description: The previous fix was not adequate. Instead, the determination of whether or not to ignore time skew should be determined in csngen_adjust_time(). Platforms tested: RHEL6 x86_64 Flag Day: no Doc impact: yes - document new config param (cherry picked from commit 9f2b104b0938b21d7c9fe37c736d0e6328843aeb) (cherry picked from commit a6ec074c6295a59938f313b4fe09430e8f601fab) (cherry picked from commit 51c1b2a0e4245b90f418f9f909c1d17c564f77f3) --- ldap/servers/plugins/replication/repl_extop.c | 11 ++--------- ldap/servers/slapd/csngen.c | 8 ++++++-- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/ldap/servers/plugins/replication/repl_extop.c b/ldap/servers/plugins/replication/repl_extop.c index 57249a6..35014a9 100644 --- a/ldap/servers/plugins/replication/repl_extop.c +++ b/ldap/servers/plugins/replication/repl_extop.c @@ -835,19 +835,12 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb) rc = replica_update_csngen_state_ext (replica, supplier_ruv, replicacsn); /* too much skew */ if (rc == CSN_LIMIT_EXCEEDED) { - extern int config_get_ignore_time_skew(); - slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "conn=%" NSPRIu64 " op=%d repl=\"%s\": " "Excessive clock skew from supplier RUV\n", (long long unsigned int)connid, opid, repl_root); - if (!config_get_ignore_time_skew()) { - response = NSDS50_REPL_EXCESSIVE_CLOCK_SKEW; - goto send_response; - } else { - /* else just continue */ - rc = 0; - } + response = NSDS50_REPL_EXCESSIVE_CLOCK_SKEW; + goto send_response; } else if (rc != 0) { diff --git a/ldap/servers/slapd/csngen.c b/ldap/servers/slapd/csngen.c index 464a59e..f87f2d1 100644 --- a/ldap/servers/slapd/csngen.c +++ b/ldap/servers/slapd/csngen.c @@ -326,6 +326,8 @@ int csngen_adjust_time(CSNGen *gen, const CSN* csn) time_t remote_time, remote_offset, cur_time; PRUint16 remote_seqnum; int rc; + extern int config_get_ignore_time_skew(); + int ignore_time_skew = config_get_ignore_time_skew(); if (gen == NULL || csn == NULL) return CSN_INVALID_PARAMETER; @@ -380,7 +382,7 @@ int csngen_adjust_time(CSNGen *gen, const CSN* csn) remote_offset = remote_time - cur_time; if (remote_offset > gen->state.remote_offset) { - if (remote_offset <= CSN_MAX_TIME_ADJUST) + if (ignore_time_skew || (remote_offset <= CSN_MAX_TIME_ADJUST)) { gen->state.remote_offset = remote_offset; } @@ -651,6 +653,8 @@ _csngen_cmp_callbacks (const void *el1, const void *el2) static int _csngen_adjust_local_time (CSNGen *gen, time_t cur_time) { + extern int config_get_ignore_time_skew(); + int ignore_time_skew = config_get_ignore_time_skew(); time_t time_diff = cur_time - gen->state.sampled_time; if (time_diff == 0) { @@ -714,7 +718,7 @@ _csngen_adjust_local_time (CSNGen *gen, time_t cur_time) gen->state.remote_offset); } - if (abs (time_diff) > CSN_MAX_TIME_ADJUST) + if (!ignore_time_skew && (abs (time_diff) > CSN_MAX_TIME_ADJUST)) { slapi_log_error (SLAPI_LOG_FATAL, NULL, "_csngen_adjust_local_time: " "adjustment limit exceeded; value - %d, limit - %d\n", -- 1.8.1.4