]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
interfaces: don't log an hard error when interface is down
authorVincent Bernat <vincent@bernat.im>
Sun, 19 Feb 2017 13:03:18 +0000 (14:03 +0100)
committerVincent Bernat <vincent@bernat.im>
Sun, 19 Feb 2017 13:03:18 +0000 (14:03 +0100)
When an interface transitions to the down state, we may be woken up. We
don't want to pollute the logs with errors in this case.

src/daemon/interfaces-bpf.c
src/daemon/interfaces-linux.c

index efee50874a98c768ff693b89680032c14e63f97a..d9d193ba1edb4b4e284f276c631ae59704b7af61 100644 (file)
@@ -88,9 +88,14 @@ ifbpf_eth_recv(struct lldpd *cfg,
        /* We assume we have only receive one packet (unbuffered mode). Dunno if
         * this is correct. */
        if (read(fd, bpfbuf->data, bpfbuf->len) == -1) {
-               log_warn("interfaces", "error while receiving frame on %s",
-                   hardware->h_ifname);
-               hardware->h_rx_discarded_cnt++;
+               if (errno == ENETDOWN) {
+                       log_debug("interfaces", "error while receiving frame on %s (network down)",
+                           hardware->h_ifname);
+               } else {
+                       log_warn("interfaces", "error while receiving frame on %s",
+                           hardware->h_ifname);
+                       hardware->h_rx_discarded_cnt++;
+               }
                return -1;
        }
        bh = (struct bpf_hdr*)bpfbuf->data;
index fb48b699d9676c071698e1e0c4cfc0c036fe08c3..6b571f7f60730670d2ee8b1006740623d992ac56 100644 (file)
@@ -113,9 +113,14 @@ retry:
                        retry++;
                        goto retry;
                }
-               log_warn("interfaces", "error while receiving frame on %s (retry: %d)",
-                   hardware->h_ifname, retry);
-               hardware->h_rx_discarded_cnt++;
+               if (errno == ENETDOWN) {
+                       log_debug("interfaces", "error while receiving frame on %s (network down)",
+                           hardware->h_ifname);
+               } else {
+                       log_warn("interfaces", "error while receiving frame on %s (retry: %d)",
+                           hardware->h_ifname, retry);
+                       hardware->h_rx_discarded_cnt++;
+               }
                return -1;
        }
        if (from->sll_pkttype == PACKET_OUTGOING)