From 099fb56a076bc69183f234ee78a432796c78a669 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Thu, 16 Jan 2014 12:57:22 -0700 Subject: [PATCH 154/225] Ticket #47516 replication stops with excessive clock skew https://fedorahosted.org/389/ticket/47516 Reviewed by: nhosoi (Thanks!) Branch: 389-ds-base-1.2.11 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 b51a57b20386e506a7eb484b62d39bf249ef995f) (cherry picked from commit d128dbde4bff3d9c523d58b5ff485d052edbaf92) --- 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 cccebb4..92207df 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", 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 7e0bdb6..3ec7620 100644 --- a/ldap/servers/slapd/csngen.c +++ b/ldap/servers/slapd/csngen.c @@ -315,6 +315,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; @@ -369,7 +371,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; } @@ -640,6 +642,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) { @@ -703,7 +707,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