Blame SOURCES/open-lldp-v1.0.1-28-fix-oid-display.patch

c954eb
From cf3f54d1883e5bc23e4c4006a63e1dde88684013 Mon Sep 17 00:00:00 2001
c954eb
From: Aaron Conole <aconole@redhat.com>
c954eb
Date: Thu, 21 Jun 2018 13:28:48 -0400
c954eb
Subject: [PATCH] basman_clif: print the OID properly
c954eb
c954eb
When invoking the lldp tool to view the management information, the display
c954eb
for the OID is printed as the actual binary bits, rather than the
c954eb
OID dotted-notation form.
c954eb
c954eb
This change will display the OID as expected.
c954eb
c954eb
Signed-off-by: Aaron Conole <aconole@redhat.com>
c954eb
---
c954eb
 lldp_basman_clif.c | 18 ++++++++++++++++--
c954eb
 1 file changed, 16 insertions(+), 2 deletions(-)
c954eb
c954eb
diff --git a/lldp_basman_clif.c b/lldp_basman_clif.c
c954eb
index 7dba9d2..abd152d 100644
c954eb
--- a/lldp_basman_clif.c
c954eb
+++ b/lldp_basman_clif.c
c954eb
@@ -272,8 +272,15 @@ void print_mng_addr(u16 len, char *info)
c954eb
 		memset(buf, 0, sizeof(buf));
c954eb
 		if (hexstr2bin(info+offset, (u8 *)&buf, oidlen))
c954eb
 			printf("\tOID: Error parsing OID\n");
c954eb
-		else
c954eb
-			printf("\tOID: %s\n", buf);
c954eb
+		else {
c954eb
+			printf("\tOID: 0.");
c954eb
+			for (i = 0; i < oidlen; ++i) {
c954eb
+				printf("%d", buf[i]);
c954eb
+				if (i != (oidlen - 1))
c954eb
+					printf(".");
c954eb
+			}
c954eb
+			printf("\n");
c954eb
+		}
c954eb
 	} else if (oidlen > 128) {
c954eb
 		printf("\tOID: Invalid length = %d\n", oidlen);
c954eb
 	}
c954eb
@@ -310,3 +317,10 @@ u32 basman_lookup_tlv_name(char *tlvid_str)
c954eb
 	}
c954eb
 	return INVALID_TLVID;
c954eb
 }
c954eb
+
c954eb
+/* Local Variables:    */
c954eb
+/* c-indent-level: 8   */
c954eb
+/* c-basic-offset: 8   */
c954eb
+/* tab-width: 8        */
c954eb
+/* indent-tabs-mode: t */
c954eb
+/* End:                */
c954eb
-- 
c954eb
2.14.3