From: Vincent Bernat Date: Sat, 18 Feb 2017 19:11:47 +0000 (+0100) Subject: lldpd: correctly increase discarded count X-Git-Tag: 0.9.7~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=32f0deeebc9172c3f5f4a4d02aab32e6904947f6;p=thirdparty%2Flldpd.git lldpd: correctly increase discarded count When a frame cannot be decoded but has been guessed, increase the discarded count. Fix #223. --- diff --git a/src/daemon/lldpd.c b/src/daemon/lldpd.c index 0db44693..9d56daea 100644 --- a/src/daemon/lldpd.c +++ b/src/daemon/lldpd.c @@ -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 =