Enthusiastic logging when interface goes away

Mike the.lists at mgm51.com
Sat Oct 6 16:32:10 UTC 2018


On 10/5/2018 2:25 AM, Wouter Wijngaards via Unbound-users wrote:
> Hi,
> 
> [snip]

> 
> How about this patch, no timers involved.  It works based on verbosity. 
> You either want debug style logs or you don't.  There is already a bunch
> of code in unbound to stop repeated logs from error messages from the
> network system.  This stops this particular one, it was simply not
> reported before.
> 
> Index: services/listen_dnsport.c
> ===================================================================
> --- services/listen_dnsport.c    (revision 4930)
> +++ services/listen_dnsport.c    (working copy)
> @@ -565,7 +565,11 @@
>          if(family==AF_INET6 && errno==EINVAL)
>              *noproto = 1;
>          else if(errno != EADDRINUSE &&
> -            !(errno == EACCES && verbosity < 4 && !listen)) {
> +            !(errno == EACCES && verbosity < 4 && !listen)
> +#ifdef EADDRNOTAVAIL
> +            !(errno == EADDRNOTAVAIL && verbosity < 4 && !listen)
> +#endif
> +            ) {
>              log_err_addr("can't bind socket", strerror(errno),
>                  (struct sockaddr_storage*)addr, addrlen);
>          }
> 


For me, the patch results in something along these lines:

#ifdef EADDRINUSE
	*inuse = (errno == EADDRINUSE);
	/* detect freebsd jail with no ipv6 permission */

	if(family==AF_INET6 && errno==EINVAL)
	   *noproto = 1;
	else if(errno != EADDRINUSE &&
	   !(errno == EACCES && verbosity < 4 && !listen)
#ifdef EADDRNOTAVAIL
	   !(errno == EADDRNOTAVAIL && verbosity < 4 && !listen)
#endif
	   ) {
		log_err_addr("can't bind socket", strerror(errno),
		   (struct sockaddr_storage*)addr, addrlen);
	   }

#endif /* EADDRINUSE */



Inside the #ifdef EADDRNOTAVAIL block, should there be a && or a ||
preceding the !(errno  ?





More information about the Unbound-users mailing list