summaryrefslogtreecommitdiffstats
path: root/lib/log.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2023-03-09 14:36:51 +0100
committerDonald Sharp <sharpd@nvidia.com>2023-03-09 14:36:51 +0100
commit115ccb9acf6e9daa47c21bb6d49c1f8cab95c1ff (patch)
treec69fac8cfc0fba8069ca2967f03114577a062d25 /lib/log.c
parentzebra: Make GR debug logs at least vrf aware (diff)
downloadfrr-115ccb9acf6e9daa47c21bb6d49c1f8cab95c1ff.tar.xz
frr-115ccb9acf6e9daa47c21bb6d49c1f8cab95c1ff.zip
lib, bgpd: Add more debugs to GR Capability exchange
a) Make it legible what type of message is being passed back and forth instead of having to guess it from the insufficient debugs b) Make it explicit which bgp instance is sending this data c) Cleanup bgp_zebra_update to have a cleaner api Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'lib/log.c')
-rw-r--r--lib/log.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/log.c b/lib/log.c
index b1a06bfb2..f7ab86fd9 100644
--- a/lib/log.c
+++ b/lib/log.c
@@ -506,6 +506,26 @@ const char *zserv_command_string(unsigned int command)
return command_types[command].string;
}
+#define DESC_ENTRY(T) [(T)] = {(T), (#T), '\0'}
+static const struct zebra_desc_table gr_client_cap_types[] = {
+ DESC_ENTRY(ZEBRA_CLIENT_GR_CAPABILITIES),
+ DESC_ENTRY(ZEBRA_CLIENT_ROUTE_UPDATE_COMPLETE),
+ DESC_ENTRY(ZEBRA_CLIENT_ROUTE_UPDATE_PENDING),
+ DESC_ENTRY(ZEBRA_CLIENT_GR_DISABLE),
+ DESC_ENTRY(ZEBRA_CLIENT_RIB_STALE_TIME),
+};
+#undef DESC_ENTRY
+
+const char *zserv_gr_client_cap_string(uint32_t zcc)
+{
+ if (zcc >= array_size(gr_client_cap_types)) {
+ flog_err(EC_LIB_DEVELOPMENT, "unknown zserv command type: %u",
+ zcc);
+ return unknown.string;
+ }
+ return gr_client_cap_types[zcc].string;
+}
+
int proto_name2num(const char *s)
{
unsigned i;