diff options
| author | Olivier Dugeon <olivier.dugeon@orange.com> | 2023-01-26 17:44:00 +0100 | 
|---|---|---|
| committer | Olivier Dugeon <olivier.dugeon@orange.com> | 2023-03-21 15:19:09 +0100 | 
| commit | 7f9ab3b0bbd8c4b81b839872b02efbd11f6c67b0 (patch) | |
| tree | 46b56885289d915393bb83d8a3628a84e7771bc7 /lib/link_state.c | |
| parent | 2e1ea892220dccb8a4c72e438cb3bbd4cac22b2b (diff) | |
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 <olivier.dugeon@orange.com>
Diffstat (limited to 'lib/link_state.c')
| -rw-r--r-- | lib/link_state.c | 11 | 
1 files changed, 4 insertions, 7 deletions
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 <lib/json.h>  #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;  | 
