1. 19 Jun, 2020 5 commits
    • Evan Hunt's avatar
      shorten the sleep in isc_nm_destroy() · 870204fe
      Evan Hunt authored
      when isc_nm_destroy() is called, there's a loop that waits for
      other references to be detached, pausing and unpausing the netmgr
      to ensure that all the workers' events are run, followed by a
      1-second sleep. this caused a delay on shutdown which will be
      noticeable when netmgr is used in tools other than named itself,
      so the delay has now been reduced to a hundredth of a second.
    • Evan Hunt's avatar
      implement isc_nm_tcpconnect() · abbb79f9
      Evan Hunt authored
      the isc_nm_tcpconnect() function establishes a client connection via
      TCP.  once the connection is esablished, a callback function will be
      called with a newly created network manager handle.
    • Witold Krecicki's avatar
      allow tcpdns sockets to self-reference while connected · cd79b495
      Witold Krecicki authored
      A TCPDNS socket creates a handle for each complete DNS message.
      Previously, when all the handles were disconnected, the socket
      would be closed, but the wrapped TCP socket might still have
      more to read.
      Now, when a connection is established, the TCPDNS socket creates
      a reference to itself by attaching itself to sock->self. This
      reference isn't cleared until the connection is closed via
      EOF, timeout, or server shutdown. This allows the socket to remain
      open even when there are no active handles for it.
    • Evan Hunt's avatar
      modify reference counting within netmgr · 5ea26ee1
      Evan Hunt authored
      - isc__nmhandle_get() now attaches to the sock in the nmhandle object.
        the caller is responsible for dereferencing the original socket
        pointer when necessary.
      - tcpdns listener sockets attach sock->outer to the outer tcp listener
        socket. tcpdns connected sockets attach sock->outerhandle to the handle
        for the tcp connected socket.
      - only listener sockets need to be attached/detached directly. connected
        sockets should only be accessed and reference-counted via their
        associated handles.
    • Evan Hunt's avatar
      make isc_nmsocket_{attach,detach}{} functions private · 9e740cad
      Evan Hunt authored
      there is no need for a caller to reference-count socket objects.
      they need tto be able tto close listener sockets (i.e., those
      returned by isc_nm_listen{udp,tcp,tcpdns}), and an isc_nmsocket_close()
      function has been added for that. other sockets are only accessed via
  2. 11 Jun, 2020 1 commit
  3. 29 May, 2020 2 commits
  4. 25 May, 2020 1 commit
  5. 13 May, 2020 1 commit
    • Witold Krecicki's avatar
      Redesigned TCP accepting: one listen/accept loop, passing the connected socket. · 60629e5b
      Witold Krecicki authored
      Instead of using bind() and passing the listening socket to the children
      threads using uv_export/uv_import use one thread that does the accepting,
      and then passes the connected socket using uv_export/uv_import to a random
      worker. The previous solution had thundering herd problems (all workers
      waking up on one connection and trying to accept()), this one avoids this
      and is simpler.
      The tcp clients quota is simplified with isc_quota_attach_cb - a callback
      is issued when the quota is available.
  6. 30 Apr, 2020 1 commit
  7. 21 Apr, 2020 1 commit
    • Ondřej Surý's avatar
      Complete rewrite the BIND 9 build system · 978c7b2e
      Ondřej Surý authored
      The rewrite of BIND 9 build system is a large work and cannot be reasonable
      split into separate merge requests.  Addition of the automake has a positive
      effect on the readability and maintainability of the build system as it is more
      declarative, it allows conditional and we are able to drop all of the custom
      make code that BIND 9 developed over the years to overcome the deficiencies of
      autoconf + custom Makefile.in files.
      This squashed commit contains following changes:
      - conversion (or rather fresh rewrite) of all Makefile.in files to Makefile.am
        by using automake
      - the libtool is now properly integrated with automake (the way we used it
        was rather hackish as the only official way how to use libtool is via
      - the dynamic module loading was rewritten from a custom patchwork to libtool's
        libltdl (which includes the patchwork to support module loading on different
        systems internally)
      - conversion of the unit test executor from kyua to automake ...
  8. 03 Apr, 2020 1 commit
  9. 30 Mar, 2020 1 commit
  10. 24 Mar, 2020 1 commit
    • Witold Krecicki's avatar
      netmgr refactoring: use generic functions when operating on sockets. · 5fedd21e
      Witold Krecicki authored
      tcpdns used transport-specific functions to operate on the outer socket.
      Use generic ones instead, and select the proper call in netmgr.c.
      Make the missing functions (e.g. isc_nm_read) generic and add type-specific
      calls (isc__nm_tcp_read). This is the preparation for netmgr TLS layer.
  11. 05 Mar, 2020 2 commits
  12. 28 Feb, 2020 1 commit
  13. 18 Feb, 2020 1 commit
  14. 14 Feb, 2020 1 commit
  15. 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')
  16. 12 Feb, 2020 1 commit
  17. 11 Feb, 2020 1 commit
  18. 10 Feb, 2020 1 commit
  19. 08 Feb, 2020 1 commit
  20. 05 Feb, 2020 1 commit
    • Mark Andrews's avatar
      break was on wrong line. · 0be2dc9f
      Mark Andrews authored
       959                break;
      	CID 1457872 (#1 of 1): Structurally dead code (UNREACHABLE)
      	unreachable: This code cannot be reached:
       960                isc__nm_incstats(sock->mgr, sock->statsindex[STATID_ACTIVE]);
       961        default:
  21. 20 Jan, 2020 2 commits
    • Witold Krecicki's avatar
      Fix possible race in socket destruction. · fd8788eb
      Witold Krecicki authored
      When two threads unreferenced handles coming from one socket while
      the socket was being destructed we could get a use-after-free:
      Having handle H1 coming from socket S1, H2 coming from socket S2,
      S0 being a parent socket to S1 and S2:
      Thread A                             Thread B
      Unref handle H1                      Unref handle H2
      Remove H1 from S1 active handles     Remove H2 from S2 active handles
      nmsocket_maybe_destroy(S1)           nmsocket_maybe_destroy(S2)
      nmsocket_maybe_destroy(S0)           nmsocket_maybe_destroy(S0)
      Go through all children, figure
      out that we have no more active
      sum of S0->children[i]->ah == 0
                                            - but S0 is already gone
    • Witold Krecicki's avatar
      netmgr: don't send to an inactive (closing) udp socket · 16908ec3
      Witold Krecicki authored
      We had a race in which n UDP socket could have been already closing
      by libuv but we still sent data to it. Mark socket as not-active
      when stopping listening and verify that socket is not active when
      trying to send data to it.
  22. 15 Jan, 2020 1 commit
  23. 14 Jan, 2020 1 commit
  24. 13 Jan, 2020 4 commits
    • Evan Hunt's avatar
      count statistics in netmgr UDP code · 90a1dabe
      Evan Hunt authored
      - also restored a test in the statistics test which was changed when
        the netmgr was introduced because active sockets were not being
    • Evan Hunt's avatar
      associate socket stats counters with netmgr socket objects · 80a5c9f5
      Evan Hunt authored
      - the socket stat counters have been moved from socket.h to stats.h.
      - isc_nm_t now attaches to the same stats counter group as
        isc_socketmgr_t, so that both managers can increment the same
        set of statistics
      - isc__nmsocket_init() now takes an interface as a paramter so that
        the address family can be determined when initializing the socket.
      - based on the address family and socket type, a group of statistics
        counters will be associated with the socket - for example, UDP4Active
        with IPv4 UDP sockets and TCP6Active with IPv6 TCP sockets.  note
        that no counters are currently associated with TCPDNS sockets; those
        stats will be handled by the underlying TCP socket.
      - the counters are not actually used by netmgr sockets yet; counter
        increment and decrement calls will be added in a later commit.
    • Witold Krecicki's avatar
      Use isc_uv_export() to pass bound TCP listening socket to child listeners. · 67c1ca9a
      Witold Krecicki authored
      For multithreaded TCP listening we need to pass a bound socket to all
      listening threads. Instead of using uv_pipe handle passing method which
      is quite complex (lots of callbacks, each of them with its own error
      handling) we now use isc_uv_export() to export the socket, pass it as a
      member of the isc__netievent_tcpchildlisten_t structure, and then
      isc_uv_import() it in the child thread, simplifying the process
    • Ondřej Surý's avatar
      Use isc_threadresult_t instead of pthread specific void * return type · 4f7d1298
      Ondřej Surý authored
      The ISC thread API already defines isc_threadresult_t type,
      but we are using a pthread specific return type (void *).
  25. 12 Dec, 2019 1 commit
  26. 10 Dec, 2019 2 commits
  27. 09 Dec, 2019 2 commits
    • Evan Hunt's avatar
      shorten some names · 31b3980e
      Evan Hunt authored
      reduce line breaks and general unwieldiness by changing some
      function, type, and parameter names.
    • Evan Hunt's avatar
      style nits · 8c079272
      Evan Hunt authored