diff options
author | Donald Sharp <sharpd@nvidia.com> | 2021-01-28 02:03:03 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2021-01-29 13:54:58 +0100 |
commit | df2a41a9bf6a9c2efb72fab1df57b6654a8d55b4 (patch) | |
tree | 4b965befb172b8e0b6eeddc83f495b9ae4404969 /bgpd | |
parent | bgpd: Add bgp_nexthop_dump_bnc_flags (diff) | |
download | frr-df2a41a9bf6a9c2efb72fab1df57b6654a8d55b4.tar.xz frr-df2a41a9bf6a9c2efb72fab1df57b6654a8d55b4.zip |
bgpd: Add `bgp_nexthop_dump_bnc_change_flags` function
Allow us to read what the change flags are instead of having
to look them up.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'bgpd')
-rw-r--r-- | bgpd/bgp_nexthop.c | 22 | ||||
-rw-r--r-- | bgpd/bgp_nexthop.h | 2 | ||||
-rw-r--r-- | bgpd/bgp_nht.c | 9 |
3 files changed, 30 insertions, 3 deletions
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c index dcada0468..b7f62ec0a 100644 --- a/bgpd/bgp_nexthop.c +++ b/bgpd/bgp_nexthop.c @@ -1046,3 +1046,25 @@ char *bgp_nexthop_dump_bnc_flags(struct bgp_nexthop_cache *bnc, char *buf, return buf; } + +char *bgp_nexthop_dump_bnc_change_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", + CHECK_FLAG(bnc->change_flags, BGP_NEXTHOP_CHANGED) + ? "Changed " + : "", + CHECK_FLAG(bnc->change_flags, BGP_NEXTHOP_METRIC_CHANGED) + ? "Metric " + : "", + CHECK_FLAG(bnc->change_flags, BGP_NEXTHOP_CONNECTED_CHANGED) + ? "Connected " + : ""); + + return buf; +} diff --git a/bgpd/bgp_nexthop.h b/bgpd/bgp_nexthop.h index 27486cf47..a223ff413 100644 --- a/bgpd/bgp_nexthop.h +++ b/bgpd/bgp_nexthop.h @@ -103,6 +103,8 @@ struct attr; #define BNC_FLAG_DUMP_SIZE 180 extern char *bgp_nexthop_dump_bnc_flags(struct bgp_nexthop_cache *bnc, char *buf, size_t len); +extern char *bgp_nexthop_dump_bnc_change_flags(struct bgp_nexthop_cache *bnc, + char *buf, size_t len); extern void bgp_connected_add(struct bgp *bgp, struct connected *c); extern void bgp_connected_delete(struct bgp *bgp, struct connected *c); extern bool bgp_subgrp_multiaccess_check_v4(struct in_addr nexthop, diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index 8030f2e39..bc5da0ee2 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -708,13 +708,16 @@ static void evaluate_paths(struct bgp_nexthop_cache *bnc) if (BGP_DEBUG(nht, NHT)) { char buf[PREFIX2STR_BUFFER]; char bnc_buf[BNC_FLAG_DUMP_SIZE]; + char chg_buf[BNC_FLAG_DUMP_SIZE]; bnc_str(bnc, buf, PREFIX2STR_BUFFER); zlog_debug( - "NH update for %s(%u)(%s) - flags %s chgflags 0x%x - evaluate paths", + "NH update for %s(%u)(%s) - flags %s chgflags %s- evaluate paths", buf, bnc->srte_color, bnc->bgp->name_pretty, - bgp_nexthop_dump_bnc_flags(bnc, bnc_buf, sizeof(bnc_buf)), - bnc->change_flags); + bgp_nexthop_dump_bnc_flags(bnc, bnc_buf, + sizeof(bnc_buf)), + bgp_nexthop_dump_bnc_change_flags(bnc, chg_buf, + sizeof(bnc_buf))); } LIST_FOREACH (path, &(bnc->paths), nh_thread) { |