From 941001b5b8561343f7ac5e91baad3b638ce8da30 Mon Sep 17 00:00:00 2001 From: John Rushford Date: Thu, 28 Apr 2022 18:44:08 +0000 Subject: [PATCH 1/3] Fixes issue #8807 nexthop failure threshold. This was originally fixed in ATS 9.2.x with PR #8365 but #8365 was big and not backported to 9.1.x as it was a late PR and zwoop did not want to bring it into 9.1.x at that time. Anyway, this fixes the issue where the failure count on a parent is not incremented properly. --- proxy/http/remap/NextHopHealthStatus.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/proxy/http/remap/NextHopHealthStatus.cc b/proxy/http/remap/NextHopHealthStatus.cc index afb43c7222c..2412171b52d 100644 --- a/proxy/http/remap/NextHopHealthStatus.cc +++ b/proxy/http/remap/NextHopHealthStatus.cc @@ -119,22 +119,21 @@ NextHopHealthStatus::markNextHop(TSHttpTxn txn, const char *hostname, const int new_fail_count = h->failCount = 1; } } else if (result.retry == true) { - h->failedAt = _now; + h->failedAt = _now; + new_fail_count = h->failCount = 1; } } // end lock guard NH_Note("[%" PRId64 "] NextHop %s marked as down %s", sm_id, (result.retry) ? "retry" : "initially", h->hostname.c_str()); } else { - int old_count = 0; // if the last failure was outside the retry window, set the failcount to 1 and failedAt to now. { // lock guard std::lock_guard lock(h->_mutex); if ((h->failedAt + retry_time) < static_cast(_now)) { - h->failCount = 1; - h->failedAt = _now; + new_fail_count = h->failCount = 1; + h->failedAt = _now; } else { - old_count = h->failCount = 1; + new_fail_count = h->failCount += 1; } - new_fail_count = old_count + 1; } // end of lock_guard NH_Debug(NH_DEBUG_TAG, "[%" PRId64 "] Parent fail count increased to %d for %s", sm_id, new_fail_count, h->hostname.c_str()); } From 9b03b3aa8ad1f32571f3613ffdf0d2b4401db57a Mon Sep 17 00:00:00 2001 From: Walt Karas Date: Thu, 2 Jun 2022 11:32:09 -0500 Subject: [PATCH 2/3] Suppress deprecated declaration warnings for gcc compiles on linux. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 77ee01ccf38..6900cfadeb6 100644 --- a/configure.ac +++ b/configure.ac @@ -863,7 +863,7 @@ case $host_os_def in AS_IF([test "x$ax_cv_c_compiler_vendor" = "xgnu"], [ # This is useful for finding odd conversions # common_opt="-pipe -Wall -Wconversion -Wno-sign-conversion -Wno-format-truncation" - common_opt="-pipe -Wall -Wextra -Wno-ignored-qualifiers -Wno-unused-parameter -Wno-format-truncation -Wno-cast-function-type -Wno-stringop-overflow" + common_opt="-pipe -Wall -Wextra -Wno-ignored-qualifiers -Wno-unused-parameter -Wno-format-truncation -Wno-cast-function-type -Wno-stringop-overflow -Wno-deprecated-declarations" debug_opt="-ggdb3 $common_opt" release_opt="-g $common_opt $optimizing_flags -feliminate-unused-debug-symbols -fno-strict-aliasing" cxx_opt="-Wno-invalid-offsetof -Wno-noexcept-type" From 11e5cdd3f88c733e903a74f317285d1f94dd7cb8 Mon Sep 17 00:00:00 2001 From: Brian Neradt Date: Thu, 13 Jan 2022 15:03:39 -0600 Subject: [PATCH 3/3] LogFilter: fix NULL termination check (#8603) gcc-12 generated the following warning: proxy/logging/LogFilter.h: In function 'void wipeField(char**, char*, const char*)': proxy/logging/LogFilter.h:477:35: error: comparing the result of pointer addition '(new_param + 1)' and NULL [-Werror=address] 477 | if (new_param && (new_param + 1)) { | ~~~~~~~~~~~^~~~ That is indeed a bug. `new_param + 1` will always be non-NULL even if new_param is NULL because 1 will be added to it. The intention was to check for the string's null terminator at the offset, which is done via a dereference. --- proxy/logging/LogFilter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxy/logging/LogFilter.h b/proxy/logging/LogFilter.h index 083dc08e6f0..749c044e5ac 100644 --- a/proxy/logging/LogFilter.h +++ b/proxy/logging/LogFilter.h @@ -474,7 +474,7 @@ wipeField(char **field, char *pattern, const char *uppercase_field) // search new param again const char *new_param = strchr(lookup_query_param + field_pos, '&'); - if (new_param && (new_param + 1)) { + if (new_param && *(new_param + 1)) { pattern_in_param_name = findPatternFromParamName(new_param + 1, pattern); } else { break;