Skip to content

Draft: Fix local address extraction for dispatch sockets

When dispatch code was migrated to netmgr, the isc_socket_getsockname() function, previously used i.a. for determining the local address of a dispatch socket, was replaced with dns_dispentry_getlocaladdress(), which uses isc_nmhandle_localaddr() behind the scenes. The latter is simply a getter for the 'local' field of a given isc_nmhandle_t. This works as expected for listening sockets as their handles are initialized with a specific local address. However, that is not the case for dispatch sockets unless the "query-source(-v6)" option is set to an explicit IP address. This issue results in local addresses missing from dnstap captures of resolver traffic produced by named in the default configuration.

Extend isc_nmhandle_localaddr() so that it extracts the local address a given dispatch socket is bound to using uv_{tcp,udp}_getsockname(). Only do this for TCPDNS and UDP sockets, falling back to returning the 'local' field for other types of sockets (because dispatch sockets can currently only be TCPDNS or UDP sockets).

Closes #3143 (closed)

Merge request reports