From 7f9ab3b0bbd8c4b81b839872b02efbd11f6c67b0 Mon Sep 17 00:00:00 2001 From: Olivier Dugeon Date: Thu, 26 Jan 2023 17:44:00 +0100 Subject: lib: Add ISO System & Network format to printfrr Like for IP addresses, this patch add a new format for printfrr collection to print ISO System ID and Network address a.k.a IS-IS system ID & Network. This new format is added to the library instead of isisd because other daemons and tools need to print ISO System ID & Network Address. Signed-off-by: Olivier Dugeon --- lib/link_state.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'lib/link_state.c') diff --git a/lib/link_state.c b/lib/link_state.c index 589c0ae704..420290c03b 100644 --- a/lib/link_state.c +++ b/lib/link_state.c @@ -26,6 +26,7 @@ #include "printfrr.h" #include #include "link_state.h" +#include "iso.h" /* Link State Memory allocation */ DEFINE_MTYPE_STATIC(LIB, LS_DB, "Link State Database"); @@ -1965,13 +1966,9 @@ static const char *const status2txt[] = { static const char *ls_node_id_to_text(struct ls_node_id lnid, char *str, size_t size) { - if (lnid.origin == ISIS_L1 || lnid.origin == ISIS_L2) { - uint8_t *id; - - id = lnid.id.iso.sys_id; - snprintfrr(str, size, "%02x%02x.%02x%02x.%02x%02x", id[0], - id[1], id[2], id[3], id[4], id[5]); - } else + if (lnid.origin == ISIS_L1 || lnid.origin == ISIS_L2) + snprintfrr(str, size, "%pSY", lnid.id.iso.sys_id); + else snprintfrr(str, size, "%pI4", &lnid.id.ip.addr); return str; -- cgit v1.2.3