From 32f0deeebc9172c3f5f4a4d02aab32e6904947f6 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sat, 18 Feb 2017 20:11:47 +0100 Subject: [PATCH] lldpd: correctly increase discarded count When a frame cannot be decoded but has been guessed, increase the discarded count. Fix #223. --- src/daemon/lldpd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 = -- 2.39.5