Enthusiastic logging when interface goes away

Wouter Wijngaards wouter at nlnetlabs.nl
Sun Oct 7 05:39:11 UTC 2018


Hi Mike,

On 10/06/2018 06:32 PM, Mike via Unbound-users wrote:
> 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  ?
> 

It should be &&   That is also in the code repository and in a second
fixed patch I emailed after that.  Sorry for the typing error there.

Best regards, Wouter



More information about the Unbound-users mailing list