From d0606e0a8595f93bafe4d897dfd819d3de2c0ca8 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 21 Sep 2021 07:52:54 -0400 Subject: [PATCH] ospf6d: Use appropriate integer size and more context for reason strings The ospfv3 spf reason strings are just presented internally in the code without any real context. Give a tiny bit more useful information for the developer and convert the integer to a uint32_t Signed-off-by: Donald Sharp --- ospf6d/ospf6_spf.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index e4de6ccf91..0e7a2f8fa8 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -440,11 +440,22 @@ void ospf6_spf_table_finish(struct ospf6_route_table *result_table) } static const char *const ospf6_spf_reason_str[] = { - "R+", "R-", "N+", "N-", "L+", "L-", "R*", "N*", "C", "A", "GR"}; + "R+", /* OSPF6_SPF_FLAGS_ROUTER_LSA_ADDED */ + "R-", /* OSPF6_SPF_FLAGS_ROUTER_LSA_REMOVED */ + "N+", /* OSPF6_SPF_FLAGS_NETWORK_LSA_ADDED */ + "N-", /* OSPF6_SPF_FLAGS_NETWORK_LSA_REMOVED */ + "L+", /* OSPF6_SPF_FLAGS_NETWORK_LINK_LSA_ADDED */ + "L-", /* OSPF6_SPF_FLAGS_NETWORK_LINK_LSA_REMOVED */ + "R*", /* OSPF6_SPF_FLAGS_ROUTER_LSA_ORIGINATED */ + "N*", /* OSPF6_SPF_FLAGS_NETWORK_LSA_ORIGINATED */ + "C", /* OSPF6_SPF_FLAGS_CONFIG_CHANGE */ + "A", /* OSPF6_SPF_FLAGS_ASBR_STATUS_CHANGE */ + "GR", /* OSPF6_SPF_FLAGS_GR_FINISH */ +}; -void ospf6_spf_reason_string(unsigned int reason, char *buf, int size) +void ospf6_spf_reason_string(uint32_t reason, char *buf, int size) { - unsigned int bit; + uint32_t bit; int len = 0; if (!buf)