12018 Commits
Author SHA1 Message Date
Tinderbox User 43046e10fb prep 9.14.12 2020-05-06 06:38:18 +00:00
Mark AndrewsandMichał Kępień 034b7e3452 Count queries to the root and TLD servers as well 2020-05-05 23:47:21 +02:00
Mark AndrewsandMichał Kępień 27f868f34c Reduce the number of fetches we make when looking up addresses
If there are more that 5 NS record for a zone only perform a
maximum of 4 address lookups for all the name servers.  This
limits the amount of remote lookup performed for server
addresses at each level for a given query.
2020-05-05 23:47:16 +02:00
Mark AndrewsandMichał Kępień 58199e954a Only look at tsig.error in responses 2020-05-05 23:45:57 +02:00
Diego FronzaandOndřej Surý 6da142ff7f Fixed rebinding protection bug when using forwarder setups
BIND wasn't honoring option "deny-answer-aliases" when configured to
forward queries.

Before the fix it was possible for nameservers listed in "forwarders"
option to return CNAME answers pointing to unrelated domains of the
original query, which could be used as a vector for rebinding attacks.

The fix ensures that BIND apply filters even if configured as a forwarder
instance.
2020-04-08 09:00:16 +02:00
Ondřej Surý 969cb06e15 Fix missing <inttypes.h> include 2020-03-26 13:42:35 +01:00
Ondřej Surý 2beca48289 Fix 'Dead nested assignment's from scan-build-10
The 3 warnings reported are:

os.c:872:7: warning: Although the value stored to 'ptr' is used in the enclosing expression, the value is never actually read from 'ptr'
        if ((ptr = strtok_r(command, " \t", &last)) == NULL) {
             ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

--

rpz.c:1117:10: warning: Although the value stored to 'zbits' is used in the enclosing expression, the value is never actually read from 'zbits'
        return (zbits &= x);
                ^        ~
1 warning generated.

--

openssleddsa_link.c:532:10: warning: Although the value stored to 'err' is used in the enclosing expression, the value is never actually read from 'err'
        while ((err = ERR_get_error()) != 0) {
                ^     ~~~~~~~~~~~~~~~
1 warning generated.

(cherry picked from commit 262f087bcf)
(cherry picked from commit 138dded9d9)
2020-03-25 18:27:08 +01:00
Evan HuntandOndřej Surý 4e0ebd2e75 fix a pointer-to-int cast error
(cherry picked from commit 6b76646037)
2020-03-20 16:08:35 +01:00
Mark Andrews 08b625787b Restart zone maintenance if it had been stalled.
(cherry picked from commit f171347b5f)
2020-03-04 09:12:15 +11:00
Ondřej SurýandMark Andrews da0faf334d Adjust lock/unlock in zone_rekey()
(cherry picked from commit aaaa7e67fa)
2020-03-03 16:43:16 +11:00
Mark Andrews 0c861a7ba1 Ensure that resigintime and the zone timer are set
(cherry picked from commit a6626594aa)
2020-03-03 16:43:16 +11:00
Matthijs MekkingandMark Andrews 0a20b7de1b Add more zone locks
Add more zone locks around code that touches zone timer setting
in failure modes.

(cherry picked from commit 143d1c9767)
2020-03-03 16:43:08 +11:00
Mark Andrews c787f10d2e Always call set_resigntime with the zone lock held
(cherry picked from commit 7212961849)
2020-03-03 16:41:08 +11:00
Mark Andrews f65514579c Always call zone_settimer()
zone_needdump() could potentially not call zone_settimer() so
explitly call zone_settimer() as zone->resigntime could have
gone backward.

(cherry picked from commit 5ec57f31b0)
2020-03-03 16:41:05 +11:00
Mark Andrews 1103f41fa0 Call set_resigntime() in receive_secure_serial()
With RRSIG records no longer being signed with the full
sig-validity-interval we need to ensure the zone->resigntime
as it may need to be set to a earlier time.

(cherry picked from commit 5d1611afdc)
2020-03-03 16:38:55 +11:00
Mark Andrews 5bf41b8133 Fix code to generate the test signatues.
* ctx needs to be destroyed before it is regenerated.
* emit the name of the signature to be replaced.
* cleanup memory before asserting so post longjump doesn't detect a
  memory leak.
* comment code.

(cherry picked from commit 3a8c8a2a31)
2020-02-21 17:41:52 +11:00
Ondřej SurýandOndřej Surý a377780049 Stop requiring same memory ordering in win32 atomic_compare_exchange functions 2020-02-13 15:16:06 +01:00
Tinderbox User d271d444aa prep v9.14.11 2020-02-12 20:07:41 +00:00
Ondřej Surý 3c8a441a0e Convert all atomic operations in isc_rwlock to release-acquire memory ordering
The memory ordering in the rwlock was all wrong, I am copying excerpts
from the https://en.cppreference.com/w/c/atomic/memory_order#Relaxed_ordering
for the convenience of the reader:

  Relaxed ordering

  Atomic operations tagged memory_order_relaxed are not synchronization
  operations; they do not impose an order among concurrent memory
  accesses. They only guarantee atomicity and modification order
  consistency.

  Release-Acquire ordering

  If an atomic store in thread A is tagged memory_order_release and an
  atomic load in thread B from the same variable is tagged
  memory_order_acquire, all memory writes (non-atomic and relaxed atomic)
  that happened-before the atomic store from the point of view of thread
  A, become visible side-effects in thread B. That is, once the atomic
  load is completed, thread B is guaranteed to see everything thread A
  wrote to memory.

  The synchronization is established only between the threads releasing
  and acquiring the same atomic variable. Other threads can see different
  order of memory accesses than either or both of the synchronized
  threads.

Which basically means that we had no or weak synchronization between
threads using the same variables in the rwlock structure.  There should
not be a significant performance drop because the critical sections were
already protected by:

  while(1) {
    if (relaxed_atomic_operation) {
      break;
    }
    LOCK(lock);
    if (!relaxed_atomic_operation) {
      WAIT(sem, lock);
    }
    UNLOCK(lock)l
  }

I would add one more thing to "Don't do your own crypto, folks.":

  - Also don't do your own locking, folks.
2020-02-11 11:50:04 +01:00
Ondřej SurýandOndřej Surý 1da0994ea4 Make isc_rwlock.c thread-safe
The ThreadSanitizer found several possible data races in our rwlock
implementation.  This commit changes all the unprotected variables to atomic and
also changes the explicit memory ordering (atomic_<foo>_explicit(..., <order>)
functions to use our convenience macros (atomic_<foo>_<order>).
2020-02-11 11:49:01 +01:00
Ondřej SurýandMichał Kępień 95130a379c Cleanup support for specifying PKCS#11 engine as part of the label
The code for specifying OpenSSL PKCS#11 engine as part of the label
(e.g. -l "pkcs11:token=..." instead of -E pkcs11 -l "token=...")
was non-functional.  This commit just cleans the related code.

(cherry picked from commit a5c87d9d18)
2020-02-11 10:32:11 +01:00
Ondřej Surý bffdf9c58d Fix comparison between type uint16_t and wider type size_t in a loop
Found by LGTM.com (see below for description), and while it should not
happen as EDNS OPT RDLEN is uint16_t, the fix is easy.  A little bit
of cleanup is included too.

> In a loop condition, comparison of a value of a narrow type with a value
> of a wide type may result in unexpected behavior if the wider value is
> sufficiently large (or small). This is because the narrower value may
> overflow. This can lead to an infinite loop.

(cherry picked from commit a9bd6f6ea6)
2020-02-10 02:42:50 -08:00
Ondřej Surý 3828d4e3e9 Clean the ENTER/EXIT/NOTICE debugging from production code
(cherry picked from commit 5b448996e5)
2020-02-08 11:37:42 -08:00
Ondřej Surý 5391187fd4 Refactor parts of isc_httpd and isc_httpd for better readability and safety
(cherry picked from commit 9643a62dd5)
2020-02-08 11:37:42 -08:00
Mark AndrewsandOndřej Surý f5be6c8877 add ISC_MAGIC and reference counting to httpd and httpdmgr
(cherry picked from commit 7c3f419d66)
2020-02-08 11:37:42 -08:00
Mark Andrews 76df419b27 Silence unchecked return of dns_db_find()
190        dns_rdataset_init(&rdataset);
   	3. Condition r == 0, taking true branch.
   	4. Condition result, taking false branch.

	CID 1452691 (#1 of 1): Unchecked return value (CHECKED_RETURN)
	5. check_return: Calling dns_db_find without checking return
	value (as is done elsewhere 39 out of 45 times).

191        check_assertion(dns_db_find(db1, dns_rootname, v2,
192                                    dns_rdatatype_soa, 0, 0, NULL,
193                                    name, &rdataset, NULL));

(cherry picked from commit e8bf82efc6)
2020-02-07 21:43:26 +11:00
Mark Andrews a6f09283cd Fix indenting.
(cherry picked from commit 98d5109e82)
2020-02-07 21:43:26 +11:00
Michal Nowak 8a47de5110 Windows: Prevent tools from clashing with named in system tests
In system tests on Windows tool's local port can sometimes clash with
'named'. On Unix the system is poked for the minimal local port,
otherwise is set to 32768 as a sane minimum. For Windows we don't
poke but set a hardcoded limit; this change aligns the limit with
Unix and changes it to 32768.

(cherry picked from commit ed7fe5fae3b22d136f0a5a92ea3b67536b10a5ce)
2020-02-05 11:07:18 +00:00
Matthijs Mekking 6799f2208f more_frags: check for basic blocks != NULL 2020-02-05 09:08:35 +01:00
Matthijs Mekking 076585e611 Fix build
Restore cleanup: label in dns_client_startrequest because it still has one
goto for it.
2020-02-05 09:08:35 +01:00
Matthijs Mekking 6b9f9a0b52 Add a note on memory allocation
isc__memalloc_t must deal with memory allocation failure
and must never return NULL.

(cherry picked from commit b8be29fee6)
2020-02-05 09:08:35 +01:00
Ondřej SurýandMatthijs Mekking 49edf175fe Suppress cppcheck false positive nullPointerArithmeticRedundantCheck
(cherry picked from commit c00def343f)
2020-02-05 09:08:35 +01:00
Ondřej SurýandMatthijs Mekking 5f4ca46d50 Change pk11_mem_get() so it cannot soft-fail
(cherry picked from commit 05ae2e48ab)
2020-02-05 09:08:35 +01:00
Ondřej SurýandMatthijs Mekking 1b9a7a17d9 Make the DbC checks to be consistent and cppcheck clean
(cherry picked from commit 478e4ac201)
2020-02-05 09:08:35 +01:00
Mark AndrewsandMatthijs Mekking da02ff9d08 isc_mem_get cannot fail
(cherry picked from commit bb65e57297)
2020-02-05 09:08:35 +01:00
Mark AndrewsandMatthijs Mekking c2ce468734 delay assignment until after REQUIRE
(cherry picked from commit d6de520bd1)
2020-02-05 09:08:35 +01:00
Mark AndrewsandMatthijs Mekking e515ac325e skip if first is NULL
(cherry picked from commit 704b9ee9d0)
2020-02-05 09:08:35 +01:00
Mark AndrewsandMatthijs Mekking 71a55892eb delay assignment until after REQUIRE
(cherry picked from commit c65c06301c)
2020-02-05 09:08:35 +01:00
Mark AndrewsandMatthijs Mekking 8251141baa remove brackets
(cherry picked from commit 7b948c7335)
2020-02-05 09:08:35 +01:00
Mark AndrewsandMatthijs Mekking 123371e1e7 simplify ISC_LIKELY/ISC_UNLIKELY for CPPCHECK
(cherry picked from commit 6c2e138d7a)
2020-02-05 09:08:35 +01:00
Mark AndrewsandMatthijs Mekking 30492c2d40 simplify RUNTIME_CHECK for cppcheck
(cherry picked from commit 668a972d1e)
2020-02-05 09:08:35 +01:00
Evan Hunt 68eb6c1bb9 Correctly handle catalog zone entries containing slashes
- Add quotes before and after zone name when generating "addzone"
  input so avoid "unexpected token" errors.
- Use a hex digest for zone filenames when the zone or view name
  contains a slash.
- Test with a domain name containing a slash.
- Incidentally added 'catzhash.py' to contrib/scripts to generate
  hash labels for catalog zones, as it was needed to write the test.

(cherry picked from commit dba0163dac)
2020-02-03 19:19:45 -08:00
Mark Andrews e79a87566d use anonomous constants
(cherry picked from commit 02c2fc5ad3)
2020-01-31 00:15:16 +11:00
Mark Andrews 5432e365d5 use enum
(cherry picked from commit 7c0d9dac9f)
2020-01-31 00:15:16 +11:00
Mark Andrews 3a87b02b1a style
(cherry picked from commit 279f6b01de)
2020-01-31 00:15:16 +11:00
Mark Andrews c2a2e1f454 return the correct error code for the type being checked
(cherry picked from commit a09c464a20)
2020-01-31 00:15:16 +11:00
Mark Andrews 735dfc1ab8 check that a CDNSKEY deletion record is accepted
(cherry picked from commit f91b3a69ce)
2020-01-31 00:15:16 +11:00
Mark Andrews 103cd665e1 handle CDS deletion record in consistancy checks
(cherry picked from commit 0adb4b25d3)
2020-01-31 00:15:15 +11:00
Tinderbox UserandEvan Hunt 0ec9ae77a8 prep 9.14.10
Update the API files.
- lib/dns:
  - struct resolver has added elements, this is an interface change
    and thus LIBINTERFACE is incremented, and LIBREVISION is reset.
  - Since this also means an interface change since the last public
    release, also reset LIBAGE.
- lib/isccfg:
  - The library source code changed, so increment LIBREVISION.
- lib/ns:
  - The library source code changed, so increment LIBREVISION.

Update other files:
- No changes needed to the README, this is a small bugfix release.
2020-01-27 11:06:04 -08:00
Tony FinchandMark Andrews bee4599f90 Send NOFITY messages after deleting private-type records.
The `rndc signing -clear` command cleans up the private-type records
that keep track of zone signing activity, but before this change it
did not tell the secondary servers that the zone has changed.

(cherry picked from commit f3f7b7df5d)
2020-01-24 00:02:44 +11:00