]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Serve-stale nit fixes
authorMatthijs Mekking <matthijs@isc.org>
Mon, 26 Apr 2021 07:19:25 +0000 (09:19 +0200)
committerMatthijs Mekking <matthijs@isc.org>
Wed, 28 Apr 2021 11:53:52 +0000 (13:53 +0200)
While working on the serve-stale backports, I noticed the following
oddities:

1. In the serve-stale system test, in one case we keep track of the
   time how long it took for dig to complete. In commit
   aaed7f9d8c2465790d769221dfe8378c7147f5eb, the code removed the
   exception to check for result == ISC_R_SUCCESS on stale found
   answers, and adjusted the test accordingly. This failed to update
   the time tracking accordingly. Move the t1/t2 time track variables
   back around the two dig commands to ensure the lookups resolved
   faster than the resolver-query-timeout.

2. We can remove the setting of NS_QUERYATTR_STALEOK and
   DNS_RDATASETATTR_STALE_ADDED on the "else if (stale_timeout)"
   code path, because they are added later when we know we have
   actually found a stale answer on a stale timeout lookup.

3. We should clear the NS_QUERYATTR_STALEOK flag from the client
   query attributes instead of DNS_RDATASETATTR_STALE_ADDED (that
   flag is set on the rdataset attributes).

4. In 'bin/named/config.c' we should set the configuration options
   in alpabetical order.

5. In the ARM, in the backports we have added "(stale)" between
   "cached" and "RRset" to make more clear a stale RRset may be
   returned in this scenario.

(cherry picked from commit 104b67623541c94744e0bd4ab6e2c554f1e1dccf)

bin/named/config.c
bin/tests/system/serve-stale/tests.sh
doc/arm/reference.rst
lib/ns/query.c

index 73441c4ef6525b72c98bdb843d010732d432b27c..f019cd96d01cb4c7713e6088c26ff25011ee6844 100644 (file)
@@ -194,8 +194,8 @@ options {\n\
        root-key-sentinel yes;\n\
        servfail-ttl 1;\n\
 #      sortlist <none>\n\
-       stale-answer-enable false;\n\
        stale-answer-client-timeout off;\n\
+       stale-answer-enable false;\n\
        stale-answer-ttl 30; /* 30 seconds */\n\
        stale-cache-enable true;\n\
        stale-refresh-time 30; /* 30 seconds */\n\
index 3c1ce67d9a81ed99dff9a886c8dc5ec1b2521016..d092b4b278a2d12037538bce8597bdf15214c53e 100755 (executable)
@@ -1648,9 +1648,11 @@ status=$((status+ret))
 sleep 2
 
 echo_i "sending queries for tests $((n+1))-$((n+2))..."
+t1=`$PERL -e 'print time()'`
 $DIG -p ${PORT} +tries=1 +timeout=10  @10.53.0.3 data.example TXT > dig.out.test$((n+1)) &
 $DIG -p ${PORT} +tries=1 +timeout=10  @10.53.0.3 nodata.example TXT > dig.out.test$((n+2))
 wait
+t2=`$PERL -e 'print time()'`
 
 # We configured a long value of 30 seconds for resolver-query-timeout.
 # That should give us enough time to receive an stale answer from cache
@@ -1658,8 +1660,6 @@ wait
 n=$((n+1))
 echo_i "check stale data.example comes from cache (default stale-answer-client-timeout) ($n)"
 nextpart ns3/named.run > /dev/null
-t1=`$PERL -e 'print time()'`
-t2=`$PERL -e 'print time()'`
 wait_for_log 5 "data.example client timeout, stale answer used" ns3/named.run || ret=1
 ret=0
 grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
index 26deb9bff993315931ae6789130fc9c1293266d5..02824dafd8da43113451758fa2fe14f9b417b6c5 100644 (file)
@@ -1858,7 +1858,7 @@ Boolean Options
    is disabled.
 
    The maximum value for this option is ``resolver-query-timeout`` minus
-   one second. The minimum value, ``0``, causes a cached RRset to be
+   one second. The minimum value, ``0``, causes a cached (stale) RRset to be
    immediately returned if it is available while still attempting to
    refresh the data in cache. :rfc:`8767` recommends a value of ``1800``
    (milliseconds).
index e77a27185056ccf8a92591fcf807f38bb482be91..48e2184b44d2f3912803add17b6bfb844743aba0 100644 (file)
@@ -5852,9 +5852,6 @@ query_lookup(query_ctx_t *qctx) {
                        return (ns_query_done(qctx));
                }
        } else if (stale_timeout) {
-               qctx->client->query.attributes |= NS_QUERYATTR_STALEOK;
-               qctx->rdataset->attributes |= DNS_RDATASETATTR_STALE_ADDED;
-
                if ((qctx->options & DNS_GETDB_STALEFIRST) != 0) {
                        if (!stale_found) {
                                /*
@@ -7742,7 +7739,7 @@ query_addanswer(query_ctx_t *qctx) {
                 * We can clear the attribute to prevent redundant clearing
                 * in subsequent lookups.
                 */
-               qctx->client->query.attributes &= ~DNS_RDATASETATTR_STALE_ADDED;
+               qctx->client->query.attributes &= ~NS_QUERYATTR_STALEOK;
        }
 
        if (qctx->dns64) {