The warning messages for out-of-order mandatory TLVs had two issues:

 - They printed tlv_type (the type of the current TLV) instead of
   tlv_count (the position where the TLV appeared).

 - The wording "first TLV should be X, not %d" was confusing because
   it could imply the wrong TLV type was found, when the actual
   problem is that the correct TLV type appeared at the wrong
   position.

Upstream: https://github.com/lldpd/lldpd/commit/8317658

Signed-off-by: Timothy Redaelli <[email protected]>
---
 lib/lldp/lldp.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/lib/lldp/lldp.c b/lib/lldp/lldp.c
index bd0032496..95aa130d5 100644
--- a/lib/lldp/lldp.c
+++ b/lib/lldp/lldp.c
@@ -424,22 +424,25 @@ lldp_decode(struct lldpd *cfg OVS_UNUSED, char *frame, 
int s,
         switch (tlv_type) {
         case LLDP_TLV_CHASSIS_ID:
             if (tlv_count != 1) {
-                VLOG_WARN("first TLV should be a chassis ID on %s, not %d",
-                          hardware->h_ifname, tlv_type);
+                VLOG_WARN("Chassis ID TLV should be first on %s,"
+                          " but it is on position %d",
+                          hardware->h_ifname, tlv_count);
                 goto malformed;
             }
             break;
         case LLDP_TLV_PORT_ID:
             if (tlv_count != 2) {
-                VLOG_WARN("second TLV should be a port ID on %s, not %d",
-                          hardware->h_ifname, tlv_type);
+                VLOG_WARN("Port ID TLV should be second on %s,"
+                          " but it is on position %d",
+                          hardware->h_ifname, tlv_count);
                 goto malformed;
             }
             break;
         case LLDP_TLV_TTL:
             if (tlv_count != 3) {
-                VLOG_WARN("third TLV should be a TTL on %s, not %d",
-                          hardware->h_ifname, tlv_type);
+                VLOG_WARN("TTL TLV should be third on %s,"
+                          " but it is on position %d",
+                          hardware->h_ifname, tlv_count);
                 goto malformed;
             }
             break;
-- 
2.54.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to