From 380ba47329ee71643d76ff9fefa2fa7c59713c94 Mon Sep 17 00:00:00 2001 From: Matthijs Mekking Date: Thu, 21 Oct 2021 16:46:15 +0200 Subject: [PATCH 1/2] Update rndc serve-stale status output Explicitly show if cache is enabled or disabled, and if answering stale data is enabled or disabled. --- bin/named/server.c | 28 +++++++++++++++++------ bin/rndc/rndc.rst | 16 ++++++-------- bin/tests/system/serve-stale/tests.sh | 32 +++++++++++++-------------- doc/man/rndc.8in | 16 ++++++-------- 4 files changed, 51 insertions(+), 41 deletions(-) diff --git a/bin/named/server.c b/bin/named/server.c index f50f4db850..638703e8c2 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -16513,21 +16513,35 @@ named_server_servestale(named_server_t *server, isc_lex_t *lex, switch (view->staleanswersok) { case dns_stale_answer_yes: if (stale_ttl > 0) { - CHECK(putstr(text, "on (rndc)")); + CHECK(putstr(text, "stale cache enabled; stale " + "answers enabled")); } else { - CHECK(putstr(text, "off (not-cached)")); + CHECK(putstr(text, + "stale cache disabled; stale " + "answers unavailable")); } break; case dns_stale_answer_no: - CHECK(putstr(text, "off (rndc)")); + if (stale_ttl > 0) { + CHECK(putstr(text, "stale cache enabled; stale " + "answers disabled")); + } else { + CHECK(putstr(text, + "stale cache disabled; stale " + "answers unavailable")); + } break; case dns_stale_answer_conf: if (view->staleanswersenable && stale_ttl > 0) { - CHECK(putstr(text, "on")); - } else if (view->staleanswersenable) { - CHECK(putstr(text, "off (not-cached)")); + CHECK(putstr(text, "stale cache enabled; stale " + "answers enabled")); + } else if (stale_ttl > 0) { + CHECK(putstr(text, "stale cache enabled; stale " + "answers disabled")); } else { - CHECK(putstr(text, "off")); + CHECK(putstr(text, + "stale cache disabled; stale " + "answers unavailable")); } break; } diff --git a/bin/rndc/rndc.rst b/bin/rndc/rndc.rst index 1e4625c659..b8f0cfe43a 100644 --- a/bin/rndc/rndc.rst +++ b/bin/rndc/rndc.rst @@ -416,17 +416,15 @@ Currently supported commands are: See also ``rndc managed-keys``. ``serve-stale`` (**on** | **off** | **reset** | **status**) [*class* [*view*]] - This command enables, disables, resets, or reports the current status of the serving - of stale answers as configured in ``named.conf``. + This command enables, disables, resets, or reports the current status of + the serving of stale answers as configured in ``named.conf``. - If serving of stale answers is disabled by ``rndc-serve-stale off``, - then it remains disabled even if ``named`` is reloaded or - reconfigured. ``rndc serve-stale reset`` restores the setting as - configured in ``named.conf``. + If serving of stale answers is disabled by ``rndc-serve-stale off``, then it + remains disabled even if ``named`` is reloaded or reconfigured. ``rndc + serve-stale reset`` restores the setting as configured in ``named.conf``. - ``rndc serve-stale status`` reports whether serving of stale - answers is currently enabled, disabled by the configuration, or - disabled by ``rndc``. It also reports the values of + ``rndc serve-stale status`` reports whether caching and serving of stale + answers is currently enabled or disabled. It also reports the values of ``stale-answer-ttl`` and ``max-stale-ttl``. ``showzone`` *zone* [*class* [*view*]] diff --git a/bin/tests/system/serve-stale/tests.sh b/bin/tests/system/serve-stale/tests.sh index b524630d9e..c8b6c99606 100755 --- a/bin/tests/system/serve-stale/tests.sh +++ b/bin/tests/system/serve-stale/tests.sh @@ -100,7 +100,7 @@ n=$((n+1)) echo_i "check 'rndc serve-stale status' ($n)" ret=0 $RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1 -grep '_default: on (stale-answer-ttl=4 max-stale-ttl=3600 stale-refresh-time=30)' rndc.out.test$n > /dev/null || ret=1 +grep '_default: stale cache enabled; stale answers enabled (stale-answer-ttl=4 max-stale-ttl=3600 stale-refresh-time=30)' rndc.out.test$n > /dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) @@ -207,7 +207,7 @@ n=$((n+1)) echo_i "check 'rndc serve-stale status' ($n)" ret=0 $RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1 -grep '_default: on (stale-answer-ttl=4 max-stale-ttl=3600 stale-refresh-time=30)' rndc.out.test$n > /dev/null || ret=1 +grep '_default: stale cache enabled; stale answers enabled (stale-answer-ttl=4 max-stale-ttl=3600 stale-refresh-time=30)' rndc.out.test$n > /dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) @@ -274,7 +274,7 @@ n=$((n+1)) echo_i "check 'rndc serve-stale status' ($n)" ret=0 $RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1 -grep '_default: off (rndc) (stale-answer-ttl=4 max-stale-ttl=3600 stale-refresh-time=30)' rndc.out.test$n > /dev/null || ret=1 +grep '_default: stale cache enabled; stale answers disabled (stale-answer-ttl=4 max-stale-ttl=3600 stale-refresh-time=30)' rndc.out.test$n > /dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) @@ -328,7 +328,7 @@ n=$((n+1)) echo_i "check 'rndc serve-stale status' ($n)" ret=0 $RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1 -grep '_default: on (rndc) (stale-answer-ttl=4 max-stale-ttl=3600 stale-refresh-time=30)' rndc.out.test$n > /dev/null || ret=1 +grep '_default: stale cache enabled; stale answers enabled (stale-answer-ttl=4 max-stale-ttl=3600 stale-refresh-time=30)' rndc.out.test$n > /dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) @@ -394,7 +394,7 @@ n=$((n+1)) echo_i "check 'rndc serve-stale status' ($n)" ret=0 $RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1 -grep '_default: on (stale-answer-ttl=4 max-stale-ttl=3600 stale-refresh-time=30)' rndc.out.test$n > /dev/null || ret=1 +grep '_default: stale cache enabled; stale answers enabled (stale-answer-ttl=4 max-stale-ttl=3600 stale-refresh-time=30)' rndc.out.test$n > /dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) @@ -453,7 +453,7 @@ n=$((n+1)) echo_i "check 'rndc serve-stale status' ($n)" ret=0 $RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1 -grep '_default: off (rndc) (stale-answer-ttl=4 max-stale-ttl=3600 stale-refresh-time=30)' rndc.out.test$n > /dev/null || ret=1 +grep '_default: stale cache enabled; stale answers disabled (stale-answer-ttl=4 max-stale-ttl=3600 stale-refresh-time=30)' rndc.out.test$n > /dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) @@ -481,7 +481,7 @@ n=$((n+1)) echo_i "check 'rndc serve-stale status' ($n)" ret=0 $RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1 -grep '_default: off (rndc) (stale-answer-ttl=3 max-stale-ttl=20 stale-refresh-time=30)' rndc.out.test$n > /dev/null || ret=1 +grep '_default: stale cache enabled; stale answers disabled (stale-answer-ttl=3 max-stale-ttl=20 stale-refresh-time=30)' rndc.out.test$n > /dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) @@ -500,7 +500,7 @@ n=$((n+1)) echo_i "check 'rndc serve-stale status' ($n)" ret=0 $RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1 -grep '_default: on (rndc) (stale-answer-ttl=3 max-stale-ttl=20 stale-refresh-time=30)' rndc.out.test$n > /dev/null || ret=1 +grep '_default: stale cache enabled; stale answers enabled (stale-answer-ttl=3 max-stale-ttl=20 stale-refresh-time=30)' rndc.out.test$n > /dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) @@ -733,7 +733,7 @@ n=$((n+1)) echo_i "check 'rndc serve-stale status' ($n)" ret=0 $RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1 -grep '_default: on (rndc) (stale-answer-ttl=3 max-stale-ttl=20 stale-refresh-time=30)' rndc.out.test$n > /dev/null || ret=1 +grep '_default: stale cache enabled; stale answers enabled (stale-answer-ttl=3 max-stale-ttl=20 stale-refresh-time=30)' rndc.out.test$n > /dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) @@ -827,7 +827,7 @@ n=$((n+1)) echo_i "check 'rndc serve-stale status' ($n)" ret=0 $RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1 -grep '_default: on (rndc) (stale-answer-ttl=3 max-stale-ttl=20 stale-refresh-time=0)' rndc.out.test$n > /dev/null || ret=1 +grep '_default: stale cache enabled; stale answers enabled (stale-answer-ttl=3 max-stale-ttl=20 stale-refresh-time=0)' rndc.out.test$n > /dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) @@ -996,7 +996,7 @@ n=$((n+1)) echo_i "check 'rndc serve-stale status' ($n)" ret=0 $RNDCCMD 10.53.0.3 serve-stale status > rndc.out.test$n 2>&1 || ret=1 -grep "_default: off (stale-answer-ttl=$stale_answer_ttl max-stale-ttl=$max_stale_ttl stale-refresh-time=30)" rndc.out.test$n > /dev/null || ret=1 +grep "_default: stale cache enabled; stale answers disabled (stale-answer-ttl=$stale_answer_ttl max-stale-ttl=$max_stale_ttl stale-refresh-time=30)" rndc.out.test$n > /dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) @@ -1073,7 +1073,7 @@ n=$((n+1)) echo_i "check 'rndc serve-stale status' ($n)" ret=0 $RNDCCMD 10.53.0.3 serve-stale status > rndc.out.test$n 2>&1 || ret=1 -grep "_default: on (rndc) (stale-answer-ttl=$stale_answer_ttl max-stale-ttl=$max_stale_ttl stale-refresh-time=30)" rndc.out.test$n > /dev/null || ret=1 +grep "_default: stale cache enabled; stale answers enabled (stale-answer-ttl=$stale_answer_ttl max-stale-ttl=$max_stale_ttl stale-refresh-time=30)" rndc.out.test$n > /dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) @@ -1237,7 +1237,7 @@ n=$((n+1)) echo_i "check 'rndc serve-stale status' ($n)" ret=0 $RNDCCMD 10.53.0.4 serve-stale status > rndc.out.test$n 2>&1 || ret=1 -grep "_default: off (stale-answer-ttl=$stale_answer_ttl max-stale-ttl=$max_stale_ttl stale-refresh-time=30)" rndc.out.test$n > /dev/null || ret=1 +grep "_default: stale cache enabled; stale answers disabled (stale-answer-ttl=$stale_answer_ttl max-stale-ttl=$max_stale_ttl stale-refresh-time=30)" rndc.out.test$n > /dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) @@ -1443,7 +1443,7 @@ n=$((n+1)) echo_i "check 'rndc serve-stale status' ($n)" ret=0 $RNDCCMD 10.53.0.5 serve-stale status > rndc.out.test$n 2>&1 || ret=1 -grep "_default: off (not-cached)" rndc.out.test$n > /dev/null || ret=1 +grep "_default: stale cache disabled; stale answers unavailable" rndc.out.test$n > /dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) @@ -1604,7 +1604,7 @@ n=$((n+1)) echo_i "check 'rndc serve-stale status' ($n)" ret=0 $RNDCCMD 10.53.0.3 serve-stale status > rndc.out.test$n 2>&1 || ret=1 -grep '_default: on (stale-answer-ttl=3 max-stale-ttl=3600 stale-refresh-time=0)' rndc.out.test$n > /dev/null || ret=1 +grep '_default: stale cache enabled; stale answers enabled (stale-answer-ttl=3 max-stale-ttl=3600 stale-refresh-time=0)' rndc.out.test$n > /dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) @@ -2107,7 +2107,7 @@ n=$((n+1)) echo_i "check 'rndc serve-stale status' ($n)" ret=0 $RNDCCMD 10.53.0.3 serve-stale status > rndc.out.test$n 2>&1 || ret=1 -grep '_default: on (rndc) (stale-answer-ttl=3 max-stale-ttl=3600 stale-refresh-time=4)' rndc.out.test$n > /dev/null || ret=1 +grep '_default: stale cache enabled; stale answers enabled (stale-answer-ttl=3 max-stale-ttl=3600 stale-refresh-time=4)' rndc.out.test$n > /dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) diff --git a/doc/man/rndc.8in b/doc/man/rndc.8in index 25543d5892..e6dd0f140f 100644 --- a/doc/man/rndc.8in +++ b/doc/man/rndc.8in @@ -418,17 +418,15 @@ option in \fBnamed.conf\fP\&. See also \fBrndc managed\-keys\fP\&. .TP \fBserve\-stale\fP (\fBon\fP | \fBoff\fP | \fBreset\fP | \fBstatus\fP) [\fIclass\fP [\fIview\fP]] -This command enables, disables, resets, or reports the current status of the serving -of stale answers as configured in \fBnamed.conf\fP\&. +This command enables, disables, resets, or reports the current status of +the serving of stale answers as configured in \fBnamed.conf\fP\&. .sp -If serving of stale answers is disabled by \fBrndc\-serve\-stale off\fP, -then it remains disabled even if \fBnamed\fP is reloaded or -reconfigured. \fBrndc serve\-stale reset\fP restores the setting as -configured in \fBnamed.conf\fP\&. +If serving of stale answers is disabled by \fBrndc\-serve\-stale off\fP, then it +remains disabled even if \fBnamed\fP is reloaded or reconfigured. \fBrndc +serve\-stale reset\fP restores the setting as configured in \fBnamed.conf\fP\&. .sp -\fBrndc serve\-stale status\fP reports whether serving of stale -answers is currently enabled, disabled by the configuration, or -disabled by \fBrndc\fP\&. It also reports the values of +\fBrndc serve\-stale status\fP reports whether caching and serving of stale +answers is currently enabled or disabled. It also reports the values of \fBstale\-answer\-ttl\fP and \fBmax\-stale\-ttl\fP\&. .TP .B \fBshowzone\fP \fIzone\fP [\fIclass\fP [\fIview\fP]] From b3507207d410ee1d4eed130ac2c6250cc865ee20 Mon Sep 17 00:00:00 2001 From: Matthijs Mekking Date: Thu, 21 Oct 2021 16:48:38 +0200 Subject: [PATCH 2/2] Add release note and CHANGES for #2742 Feature change. --- CHANGES | 3 +++ doc/notes/notes-current.rst | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/CHANGES b/CHANGES index d76f0d8c69..335b035f51 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +5747. [func] Update rndc serve-stale status output to be less + confusing. [GL #2742] + 5746. [bug] A lame server delegation could lead to a loop in which a resolver fetch depends on an ADB find which depends on the same resolver fetch. Previously, this would diff --git a/doc/notes/notes-current.rst b/doc/notes/notes-current.rst index 28127fb2e7..d6ff6c133d 100644 --- a/doc/notes/notes-current.rst +++ b/doc/notes/notes-current.rst @@ -96,6 +96,11 @@ Feature Changes is set to ``no`` add to the DNS response payload without offering added value. :gl:`#1316` +- The output of ``rndc serve-stale status`` has been clarified. It now + explicitly reports whether retention of stale data in the cache is enabled + (``stale-cache-enable``), and whether returning of such data in responses is + enabled (``stale-answer-enable``). :gl:`#2742` + Bug Fixes ~~~~~~~~~