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