if (socketFd < 0) {
throw PDNSException("Making a UDP server socket for resolver: " + stringerror());
}
- logVec.emplace_back(address.toStringWithPort());
+
if (!setSocketTimestamps(socketFd)) {
SLOG(g_log << Logger::Warning << "Unable to enable timestamp reporting for socket" << endl,
log->info(Logr::Warning, "Unable to enable timestamp reporting for socket"));
socklen_t socklen = address.getSocklen();
if (::bind(socketFd, reinterpret_cast<struct sockaddr*>(&address), socklen) < 0) { // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
- throw PDNSException("Resolver binding to server socket on " + address.toStringWithPort() + ": " + stringerror());
+ int err = errno;
+ if (address != ComboAddress{"::1", defaultLocalPort}) {
+ throw PDNSException("Resolver binding to server socket on " + address.toStringWithPort() + ": " + stringerror(err));
+ }
+ log->info(Logr::Warning, "Cannot listen on this address, skipping", "proto", Logging::Loggable("UDP"), "address", Logging::Loggable(address), "error", Logging::Loggable(stringerror(err)));
+ continue;
}
setNonBlocking(socketFd);
deferredAdds.emplace_back(socketFd, handleNewUDPQuestion);
g_listenSocketsAddresses[socketFd] = address; // this is written to only from the startup thread, not from the workers
+ logVec.emplace_back(address.toStringWithPort());
}
if (doLog) {
log->info(Logr::Info, "Listening for queries", "proto", Logging::Loggable("UDP"), "addresses", Logging::IterLoggable(logVec.cbegin(), logVec.cend()), "socketInstances", Logging::Loggable(instances), "reuseport", Logging::Loggable(g_reusePort));
'section' : 'incoming',
'oldname' : 'local-address',
'type' : LType.ListSocketAddresses,
- 'default' : '127.0.0.1',
+ 'default' : '127.0.0.1, ::1',
'help' : 'IP addresses to listen on, separated by spaces or commas. Also accepts ports.',
+ 'versionchanged': ('5.3.0', '::1 was added to the list'),
'doc' : '''
Local IP addresses to which we bind. Each address specified can
include a port number; if no port is included then the
if (socketFd < 0) {
throw PDNSException("Making a TCP server socket for resolver: " + stringerror());
}
- logVec.emplace_back(address.toStringWithPort());
setCloseOnExec(socketFd);
int tmp = 1;
socklen_t socklen = address.sin4.sin_family == AF_INET ? sizeof(address.sin4) : sizeof(address.sin6);
if (::bind(socketFd, reinterpret_cast<struct sockaddr*>(&address), socklen) < 0) { // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
- throw PDNSException("Binding TCP server socket for " + address.toStringWithPort() + ": " + stringerror());
+ int err = errno;
+ if (address != ComboAddress{"::1", defaultLocalPort}) {
+ throw PDNSException("Binding TCP server socket for " + address.toStringWithPort() + ": " + stringerror(err));
+ }
+ log->info(Logr::Warning, "Cannot listen on this address, skipping", "proto", Logging::Loggable("TCP"), "address", Logging::Loggable(address), "error", Logging::Loggable(stringerror(err)));
+ continue;
}
setNonBlocking(socketFd);
listen(socketFd, 128);
deferredAdds.emplace_back(socketFd, handleNewTCPQuestion);
tcpSockets.insert(socketFd);
+ logVec.emplace_back(address.toStringWithPort());
// we don't need to update g_listenSocketsAddresses since it doesn't work for TCP/IP:
// - fd is not that which we know here, but returned from accept()