1. 01 Jul, 2020 2 commits
    • Witold Krecicki's avatar
      Fix possible race in isc__nm_tcpconnect. · 896db0f4
      Witold Krecicki authored
      There's a possibility of race in isc__nm_tcpconnect if the asynchronous
      connect operation finishes with all the callbacks before we exit the
      isc__nm_tcpconnect itself we might access an already freed memory.
      Fix it by creating an additional reference to the socket freed at the
      end of isc__nm_tcpconnect.
      896db0f4
    • Evan Hunt's avatar
      restore "blackhole" functionality · 23c7373d
      Evan Hunt authored
      the blackhole ACL was accidentally disabled with respect to client
      queries during the netmgr conversion.
      
      in order to make this work for TCP, it was necessary to add a return
      code to the accept callback functions passed to isc_nm_listentcp() and
      isc_nm_listentcpdns().
      23c7373d
  2. 26 Jun, 2020 1 commit
  3. 19 Jun, 2020 6 commits
    • Evan Hunt's avatar
      change the signature of recv callbacks to include a result code · 75c985c0
      Evan Hunt authored
      this will allow recv event handlers to distinguish between cases
      in which the region is NULL because of error, shutdown, or cancelation.
      75c985c0
    • Evan Hunt's avatar
      implement isc_nm_cancelread() · 5191ec8f
      Evan Hunt authored
      The isc_nm_cancelread() function cancels reading on a connected
      socket and calls its read callback function with a 'result'
      parameter of ISC_R_CANCELED.
      5191ec8f
    • 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.
      abbb79f9
    • 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.
      cd79b495
    • 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.
      5ea26ee1
    • 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
      handles.
      9e740cad
  4. 10 Jun, 2020 1 commit
    • Witold Krecicki's avatar
      Fix a race in TCP accepting. · 85d8e4bf
      Witold Krecicki authored
      There's a possibility of a race in TCP accepting code:
      T1 accepts a connection C1
      T2 accepts a connection C2
      T1 tries to accept a connection C3, but we hit a quota,
         isc_quota_cb_init() sets quota_accept_cb for the socket,
         we return from accept_connection
      T2 drops C2, but we race in quota_release with accepting C3 so
         we don't see quota->waiting is > 0, we don't launch the callback
      T1 accepts a connection C4, we are able to get the quota we clear
         the quota_accept_cb from sock->quotacb
      T1 drops C1, tries to call the callback which is zeroed, sigsegv.
      85d8e4bf
  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.
      60629e5b
  6. 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
        automake
      
      - 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 ...
      978c7b2e
  7. 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.
      5fedd21e
  8. 05 Mar, 2020 2 commits
  9. 21 Feb, 2020 1 commit
  10. 14 Feb, 2020 1 commit
  11. 13 Feb, 2020 1 commit
  12. 12 Feb, 2020 1 commit
  13. 20 Jan, 2020 1 commit
    • Witold Krecicki's avatar
      netmgr: fix a non-thread-safe access to libuv structures · f75a9e32
      Witold Krecicki authored
      In tcp and udp stoplistening code we accessed libuv structures
      from a different thread, which caused a shutdown crash when named
      was under load. Also added additional DbC checks making sure we're
      in a proper thread when accessing uv_ functions.
      f75a9e32
  14. 15 Jan, 2020 1 commit
    • Witold Krecicki's avatar
      netmgr: · 525c5831
      Witold Krecicki authored
       - isc__netievent_storage_t was to small to contain
         isc__netievent__socket_streaminfo_t on Windows
       - handle isc_uv_export and isc_uv_import errors properly
       - rewrite isc_uv_export and isc_uv_import on Windows
      525c5831
  15. 14 Jan, 2020 1 commit
    • Witold Krecicki's avatar
      netmgr: handle errors properly in accept_connection. · 6ee1461c
      Witold Krecicki authored
      If a connection was closed early (right after accept()) an assertion
      that assumed that the connection was still alive could be triggered
      in accept_connection. Handle those errors properly and not with
      assertions, free all the resources afterwards.
      6ee1461c
  16. 13 Jan, 2020 4 commits
    • Evan Hunt's avatar
      count statistics in netmgr TCP code · 5234a8e0
      Evan Hunt authored
      5234a8e0
    • 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.
      80a5c9f5
    • Evan Hunt's avatar
      netmgr fixes: · e3800445
      Evan Hunt authored
       - use UV_{TC,UD}P_IPV6ONLY for IPv6 sockets, keeping the pre-netmgr
         behaviour.
       - add a new listening_error bool flag which is set if the child
         listener fails to start listening. This fixes a bug where named would
         hang if, e.g.,  we failed to bind to a TCP socket.
      e3800445
    • 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
      significantly.
      67c1ca9a
  17. 10 Dec, 2019 2 commits
  18. 09 Dec, 2019 10 commits
  19. 23 Nov, 2019 2 commits