1. 14 Feb, 2020 1 commit
  2. 13 Feb, 2020 2 commits
    • Evan Hunt's avatar
      apply the modified style · e851ed0b
      Evan Hunt authored
    • Ondřej Surý's avatar
      Use clang-tidy to add curly braces around one-line statements · 056e133c
      Ondřej Surý authored
      The command used to reformat the files in this commit was:
      ./util/run-clang-tidy \
      	-clang-tidy-binary clang-tidy-11
      	-clang-apply-replacements-binary clang-apply-replacements-11 \
      	-checks=-*,readability-braces-around-statements \
      	-j 9 \
      	-fix \
      	-format \
      	-style=file \
      clang-format -i --style=format $(git ls-files '*.c' '*.h')
      uncrustify -c .uncrustify.cfg --replace --no-backup $(git ls-files '*.c' '*.h')
      clang-format -i --style=format $(git ls-files '*.c' '*.h')
  3. 12 Feb, 2020 1 commit
  4. 03 Feb, 2020 2 commits
  5. 03 Dec, 2019 1 commit
    • Ondřej Surý's avatar
      Refactor the dns_name API to use ISC_THREAD_LOCAL · 1a66aabd
      Ondřej Surý authored
      Previously, the dns_name API used isc_thread_key API for TLS, which is
      fairly complicated and requires initialization of memory contexts, etc.
      This part of code was refactored to use a ISC_THREAD_LOCAL pointer which
      greatly simplifies the whole code related to storing TLS variables.
  6. 07 Nov, 2019 1 commit
  7. 03 Oct, 2019 1 commit
  8. 01 Oct, 2019 4 commits
    • Ondřej Surý's avatar
      Various little fixes found by coccinelle · 288f5a4b
      Ondřej Surý authored
      The coccinellery repository provides many little semantic patches to fix common
      problems in the code.  The number of semantic patches in the coccinellery
      repository is high and most of the semantic patches apply only for Linux, so it
      doesn't make sense to run them on regular basis as the processing takes a lot of
      The list of issue found in BIND 9, by no means complete, includes:
      - double assignment to a variable
      - `continue` at the end of the loop
      - double checks for `NULL`
      - useless checks for `NULL` (cannot be `NULL`, because of earlier return)
      - using `0` instead of `NULL`
      - useless extra condition (`if (foo) return; if (!foo) { ...; }`)
      - removing & in front of static functions passed as arguments
    • Ondřej Surý's avatar
      Replace RUNTIME_CHECK(dns_name_copy(..., NULL)) with dns_name_copynf() · c2dad0dc
      Ondřej Surý authored
      Use the semantic patch from the previous commit to replace all the calls to
      dns_name_copy() with NULL as third argument with dns_name_copynf().
    • Ondřej Surý's avatar
      The final round of adding RUNTIME_CHECK() around dns_name_copy() calls · 5efa29e0
      Ondřej Surý authored
      This commit was done by hand to add the RUNTIME_CHECK() around stray
      dns_name_copy() calls with NULL as third argument.  This covers the edge cases
      that doesn't make sense to write a semantic patch since the usage pattern was
      unique or almost unique.
    • Ondřej Surý's avatar
      Add RUNTIME_CHECK() around plain dns_name_copy(..., NULL) calls using spatch · 35bd7e4d
      Ondřej Surý authored
      This commit add RUNTIME_CHECK() around all simple dns_name_copy() calls where
      the third argument is NULL using the semantic patch from the previous commit.
  9. 30 Sep, 2019 2 commits
  10. 12 Sep, 2019 1 commit
  11. 06 Sep, 2019 1 commit
  12. 03 Sep, 2019 2 commits
  13. 30 Aug, 2019 1 commit
    • Ondřej Surý's avatar
      isc_event_allocate() cannot fail, remove the fail handling blocks · 50e109d6
      Ondřej Surý authored
      isc_event_allocate() calls isc_mem_get() to allocate the event structure.  As
      isc_mem_get() cannot fail softly (e.g. it never returns NULL), the
      isc_event_allocate() cannot return NULL, hence we remove the (ret == NULL)
      handling blocks using the semantic patch from the previous commit.
  14. 28 Aug, 2019 1 commit
  15. 25 Aug, 2019 1 commit
  16. 23 Jul, 2019 1 commit
  17. 22 May, 2019 1 commit
  18. 09 May, 2019 1 commit
  19. 07 May, 2019 1 commit
  20. 08 Mar, 2019 1 commit
  21. 06 Feb, 2019 1 commit
  22. 25 Jan, 2019 1 commit
    • Michał Kępień's avatar
      dig: return a non-zero exit code for failed TCP EOF retries · 0f168a4b
      Michał Kępień authored
      dig retries a TCP query when a server closes the connection prematurely.
      However, dig's exit code remains unaffected even if the second attempt
      to get a response also fails with the same error for the same lookup,
      which should not be the case.  Ensure the exit code is updated
      appropriately when a retry triggered by a TCP EOF condition fails.
  23. 08 Jan, 2019 3 commits
    • Michał Kępień's avatar
      Fix cleanup upon an error before TCP socket creation · 13975b32
      Michał Kępień authored
      When a query times out after a socket is created and associated with a
      given dig_query_t structure, calling isc_socket_cancel() causes
      connect_done() to be run, which in turn takes care of all necessary
      cleanups.  However, certain errors (e.g. get_address() returning
      ISC_R_FAMILYNOSUPPORT) may prevent a TCP socket from being created in
      the first place.  Since force_timeout() may be used in code handling
      such errors, connect_timeout() needs to properly clean up a TCP query
      which is not associated with any socket.  Call clear_query() from
      connect_timeout() after attempting to send a TCP query to the next
      available server if the timed out query does not have a socket
      associated with it, in order to prevent dig from hanging indefinitely
      due to the dig_query_t structure not being detached from its parent
      dig_lookup_t structure.
    • Michał Kępień's avatar
      Refactor code sending a query to the next server upon a timeout · c108fc5c
      Michał Kępień authored
      When a query times out and another server is available for querying
      within the same lookup, the timeout handler - connect_timeout() - is
      responsible for sending the query to the next server.  Extract the
      relevant part of connect_timeout() to a separate function in order to
      improve code readability.
    • Michał Kępień's avatar
      Remove dead code handling address family mismatches for TCP sockets · ef1da873
      Michał Kępień authored
      Before commit c2ec022f, using the "-b"
      command line switch for dig did not disable use of the other address
      family than the one to which the address supplied to that option
      belonged to.  Thus, bind9_getaddresses() could e.g. prepare an
      isc_sockaddr_t structure for an IPv6 address when an IPv4 address has
      been passed to the "-b" command line option.  To avoid attempting the
      impossible (e.g. querying an IPv6 address from a socket bound to an IPv4
      address), a certain code block in send_tcp_connect() checked whether the
      address family of the server to be queried was the same as the address
      family of the socket set up for sending that query; if there was a
      mismatch, that particular server address was skipped.
      Commit c2ec022f made
      bind9_getaddresses() fail upon an address family mismatch between the
      address the hostname passed to it resolved to and the address supplied
      to the "-b" command line option.  Such failures were fatal to dig back
      Commit 7f658603 made
      bind9_getaddresses() failures non-fatal, but also ensured that a
      get_address() failure in send_tcp_connect() still causes the given query
      address to be skipped (and also made such failures trigger an early
      return from send_tcp_connect()).
      Summing up, the code block handling address family mismatches in
      send_tcp_connect() has been redundant since commit
      c2ec022f.  Remove it.
  24. 22 Nov, 2018 2 commits
  25. 13 Nov, 2018 2 commits
    • Michał Kępień's avatar
      Restore localhost fallback in bin/dig/dighost.c · 18758392
      Michał Kępień authored
      In BIND 9.11 and earlier, dig and similar tools used liblwres for
      parsing /etc/resolv.conf.  After getting a list of servers from
      liblwres, a tool would check the address family of each server found and
      reject those unusable.  When the resulting list of usable servers was
      empty, localhost addresses were queried as a fallback.
      When liblwres was removed in BIND 9.12, dig and similar tools were
      updated to parse /etc/resolv.conf using libirs instead.  As part of that
      process, the localhost fallback was removed from bin/dig/dighost.c since
      the localhost fallback built into libirs was deemed to be sufficient.
      However, libirs only falls back to localhost if it does not find any
      name servers at all; if it does find any valid nameserver entry in
      /etc/resolv.conf, it just returns it to the caller because it is
      oblivious to whether the caller supports IPv4 and/or IPv6 or not.  The
      code in bin/dig/dighost.c subsequently filters the returned list of
      servers in get_server_list() according to the requested address family
      restrictions.  This may result in none of the addresses returned by
      libirs being usable, in which case a tool will attempt to work with an
      empty server list, causing a hang and subsequently a crash upon user
      Restore the localhost fallback in bin/dig/dighost.c to prevent the
      aforementioned hangs and crashes and ensure recent BIND versions behave
      identically to the older ones in the circumstances described above.
    • Michał Kępień's avatar
      Fix a shutdown race in bin/dig/dighost.c · 46217565
      Michał Kępień authored
      If a tool using the routines defined in bin/dig/dighost.c is sent an
      interruption signal around the time a connection timeout is scheduled to
      fire, connect_timeout() may be executed after destroy_libs() detaches
      from the global task (setting 'global_task' to NULL), which results in a
      crash upon a UDP retry due to bringup_timer() attempting to create a
      timer with 'task' set to NULL.  Fix by preventing connect_timeout() from
      attempting a retry when shutdown is in progress.
  26. 08 Nov, 2018 2 commits
  27. 07 Nov, 2018 1 commit
  28. 06 Nov, 2018 1 commit