On Sun, Jan 24, 2021 at 12:44:39PM +0100, Klemens Nanni wrote:
> 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?

Probably better to sync first with the corresponding unbound commit
https://cvsweb.openbsd.org/src/usr.sbin/unbound/services/outside_network.c#rev1.21
then adjust udp_connect_needs_log() as needed.

> 
> 
> 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);
> 

Reply via email to