From fbc1e044bf89992f7ad32b44ced68e625f2d5da3 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Thu, 12 Nov 2020 19:54:54 -0500 Subject: lldp: correctly increase discarded count Upstream commit: commit 32f0deeebc9172c3f5f4a4d02aab32e6904947f6 Date: Sat, 18 Feb 2017 20:11:47 +0100 lldpd: correctly increase discarded count When a frame cannot be decoded but has been guessed, increase the discarded count. Fix https://github.com/vincentbernat/lldpd/issues/223 Fixes: be53a5c447c3 ("auto-attach: Initial support for Auto-Attach standard") Co-authored-by: Fabrizio D'Angelo Signed-off-by: Fabrizio D'Angelo Acked-by: Aaron Conole Signed-off-by: Ilya Maximets --- lib/lldp/lldpd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/lldp/lldpd.c b/lib/lldp/lldpd.c index 7c64ad8c6..a537883e0 100644 --- a/lib/lldp/lldpd.c +++ b/lib/lldp/lldpd.c @@ -243,6 +243,7 @@ lldpd_decode(struct lldpd *cfg, char *frame, int s, if (s < sizeof(struct eth_header) + 4) { /* Too short, just discard it */ + hw->h_rx_discarded_cnt++; return; } @@ -283,6 +284,7 @@ lldpd_decode(struct lldpd *cfg, char *frame, int s, VLOG_DBG("function for %s protocol did not " "decode this frame", cfg->g_protocols[i].name); + hw->h_rx_discarded_cnt++; return; } chassis->c_protocol = port->p_protocol = cfg->g_protocols[i].mode; -- cgit v1.2.1