]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
lldpd: correctly increase discarded count
authorVincent Bernat <vincent@bernat.im>
Sat, 18 Feb 2017 19:11:47 +0000 (20:11 +0100)
committerVincent Bernat <vincent@bernat.im>
Sat, 18 Feb 2017 19:11:47 +0000 (20:11 +0100)
When a frame cannot be decoded but has been guessed, increase the
discarded count.

Fix #223.

src/daemon/lldpd.c

index 0db446935c6ff5204ae51e87b9223147a027c979..9d56daea21f3dbb29c92295ffb7d15693528a164 100644 (file)
@@ -517,9 +517,11 @@ lldpd_decode(struct lldpd *cfg, char *frame, int s,
        log_debug("decode", "decode a received frame on %s",
            hardware->h_ifname);
 
-       if (s < sizeof(struct ether_header) + 4)
+       if (s < sizeof(struct ether_header) + 4) {
                /* Too short, just discard it */
+               hardware->h_rx_discarded_cnt++;
                return;
+       }
 
        /* Decapsulate VLAN frames */
        struct ether_header eheader;
@@ -553,6 +555,7 @@ lldpd_decode(struct lldpd *cfg, char *frame, int s,
                                s, hardware, &chassis, &port) == -1) {
                                log_debug("decode", "function for %s protocol did not decode this frame",
                                    cfg->g_protocols[i].name);
+                               hardware->h_rx_discarded_cnt++;
                                return;
                        }
                        chassis->c_protocol = port->p_protocol =