Enthusiastic logging when interface goes away

Wouter Wijngaards wouter at nlnetlabs.nl
Fri Oct 5 06:28:43 UTC 2018


Hi,


On 05/10/18 08:25, Wouter Wijngaards wrote:
> Hi,
>
>
> On 05/10/18 01:26, Eric Luehrsen via Unbound-users wrote:
>> On 10/04/2018 07:22 PM, Eric Luehrsen wrote:
>>>> On Thu, Oct 4, 2018, 11:09 AM Mike via Unbound-users
>>>> <unbound-users at nlnetlabs.nl <mailto:unbound-users at nlnetlabs.nl>> wrote:
>>>>
>>>>     On 10/4/2018 10:59 AM, Mark Deneen wrote:
>>>>      > I'm guessing that your supervisor process, whether it be
>>>> systemd,
>>>>     runit,
>>>>      > etc, is repeatedly starting unbound.  Unbound prints this error
>>>>     message,
>>>>      > exits, and then is launched again.
>>>>      >
>>>>
>>>>     Unbound is running continuously.  I do not see the usual unbound
>>>>     start-up messages in the logs, just that one log message repeated.
>>>>
>>>>     Maybe something within unbound is restarting an unbound process?  I
>>>>     don't know, which is why I'm asking.  :)
>>>>
>>>>
>>>>     I should have added this initially:
>>>>
>>>>     Unbound Version 1.6.8, running on OpenBSD 6.3 (amd64)
>>>>
>>> The problem is Unbound logs for each outbound connection it cannot
>>> make. This is not a restart issue. The solutuon should be in Unbound
>>> where this message has a burn down timer. When a message is sent, the
>>> time is recorded and messages are not sent until (config) time later.
>>> Pretty simple if() gating the syslog call. Default should be 5
>>> minutes as many outages are hour or more.
>> I may have been ambiguous. I mean a burn down timer on log messages,
>> rather than UPD query messages.
>> - Eric
>
> 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);
>          }
>
>
> Best regards, Wouter
>

Typo in patch, here is a better one.  It is also in the code repository.

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

Best regards, Wouter




More information about the Unbound-users mailing list