unwind/libunbound always tries to connect to nameservers using both
address families, even if only one is configured on the local machine.
So on IPv6 only boxes for example syslog gets spammed with these
Jan 24 12:23:06 eru unwind[38261]: [38261:0] error: udp connect failed: Can't
assign requested address for 195.54.164.36 port 53
grep -c 'unwind.*udp connect failed' /var/log/daemon
1278
Diff below makes unwind not log this iff connect(2) yielded
EADDRNOTAVAIL.
This diff wouldn't make sense for libunbound upstream or say a router
running unbound where addresses are configured statically and admins do
want to see such connect failures.
But with unwind on roaming clients I don't see much value in logging it,
especially not if unwind eventually answers the query successfully.
Feedback? Objections? OK?
Index: libunbound/services/outside_network.c
===================================================================
RCS file: /cvs/src/sbin/unwind/libunbound/services/outside_network.c,v
retrieving revision 1.9
diff -u -p -r1.9 outside_network.c
--- libunbound/services/outside_network.c 11 Dec 2020 12:21:40 -0000
1.9
+++ libunbound/services/outside_network.c 24 Jan 2021 11:27:04 -0000
@@ -1803,7 +1803,8 @@ select_ifport(struct outside_network* ou
if(outnet->udp_connect) {
/* connect() to the destination */
if(connect(fd, (struct sockaddr*)&pend->addr,
- pend->addrlen) < 0) {
+ pend->addrlen) < 0 &&
+ errno != EADDRNOTAVAIL) {
log_err_addr("udp connect failed",
strerror(errno), &pend->addr,
pend->addrlen);