]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospf6d: Use appropriate integer size and more context for reason strings
authorDonald Sharp <sharpd@nvidia.com>
Tue, 21 Sep 2021 11:52:54 +0000 (07:52 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Tue, 21 Sep 2021 11:53:30 +0000 (07:53 -0400)
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 <sharpd@nvidia.com>
ospf6d/ospf6_spf.c

index e4de6ccf910b1125f71b7e2dcab6e4bfaa814038..0e7a2f8fa81835fff55ae8c85f382b7e4cfdcbde 100644 (file)
@@ -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"};
-
-void ospf6_spf_reason_string(unsigned int reason, char *buf, int size)
+       "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(uint32_t reason, char *buf, int size)
 {
-       unsigned int bit;
+       uint32_t bit;
        int len = 0;
 
        if (!buf)