summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_nexthop.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2021-01-28 01:56:13 +0100
committerDonald Sharp <sharpd@nvidia.com>2021-01-29 13:54:58 +0100
commit987a720a11e897b764ed40cd779d80661c76ae16 (patch)
tree2c91cfa01302c7156f5c46575e418e4d982f64dd /bgpd/bgp_nexthop.c
parentMerge pull request #7953 from mjstapp/fix_more_ntoa (diff)
downloadfrr-987a720a11e897b764ed40cd779d80661c76ae16.tar.xz
frr-987a720a11e897b764ed40cd779d80661c76ae16.zip
bgpd: Add bgp_nexthop_dump_bnc_flags
Add a function that allows us to see a string version of the bnc->flags bit fields. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'bgpd/bgp_nexthop.c')
-rw-r--r--bgpd/bgp_nexthop.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index 1a9f59db6..dcada0468 100644
--- a/bgpd/bgp_nexthop.c
+++ b/bgpd/bgp_nexthop.c
@@ -33,6 +33,7 @@
#include "nexthop.h"
#include "queue.h"
#include "filter.h"
+#include "printfrr.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_route.h"
@@ -1020,3 +1021,28 @@ void bgp_scan_finish(struct bgp *bgp)
bgp->connected_table[afi] = NULL;
}
}
+
+char *bgp_nexthop_dump_bnc_flags(struct bgp_nexthop_cache *bnc, char *buf,
+ size_t len)
+{
+ if (bnc->flags == 0) {
+ snprintfrr(buf, len, "None ");
+ return buf;
+ }
+
+ snprintfrr(buf, len, "%s%s%s%s%s%s%s",
+ CHECK_FLAG(bnc->flags, BGP_NEXTHOP_VALID) ? "Valid " : "",
+ CHECK_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED) ? "Reg " : "",
+ CHECK_FLAG(bnc->flags, BGP_NEXTHOP_CONNECTED) ? "Conn " : "",
+ CHECK_FLAG(bnc->flags, BGP_NEXTHOP_PEER_NOTIFIED) ? "Notify "
+ : "",
+ CHECK_FLAG(bnc->flags, BGP_STATIC_ROUTE) ? "Static " : "",
+ CHECK_FLAG(bnc->flags, BGP_STATIC_ROUTE_EXACT_MATCH)
+ ? "Static Exact "
+ : "",
+ CHECK_FLAG(bnc->flags, BGP_NEXTHOP_LABELED_VALID)
+ ? "Label Valid "
+ : "");
+
+ return buf;
+}