summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2020-06-23 16:00:41 +0200
committerDonald Sharp <sharpd@nvidia.com>2020-10-17 14:52:35 +0200
commit56ca3b5b3a0036687a5487bc322126ffb7c6e9d8 (patch)
tree1651e43e8aff9fea29ef28b4aeb400289402ed7e
parentMerge pull request #7335 from opensourcerouting/fix-ti-lfa-topotest (diff)
downloadfrr-56ca3b5b3a0036687a5487bc322126ffb7c6e9d8.tar.xz
frr-56ca3b5b3a0036687a5487bc322126ffb7c6e9d8.zip
bgpd: add `%pBD` for printing `struct bgp_dest *`
`%pRN` is not appropriate anymore. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
-rw-r--r--bgpd/bgp_evpn.c4
-rw-r--r--bgpd/bgp_mplsvpn.c16
-rw-r--r--bgpd/bgp_nexthop.c4
-rw-r--r--bgpd/bgp_nht.c6
-rw-r--r--bgpd/bgp_route.c14
-rw-r--r--bgpd/bgp_table.c12
-rw-r--r--bgpd/bgp_table.h1
-rw-r--r--bgpd/rfapi/vnc_export_bgp.c2
8 files changed, 36 insertions, 23 deletions
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index 070385335..dc133e257 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -1660,7 +1660,7 @@ static void evpn_cleanup_local_non_best_route(struct bgp *bgp,
{
/* local path was not picked as the winner; kick it out */
if (bgp_debug_zebra(NULL))
- zlog_debug("evicting local evpn prefix %pRN as remote won",
+ zlog_debug("evicting local evpn prefix %pBD as remote won",
dest);
evpn_delete_old_local_route(bgp, vpn, dest, local_pi, NULL);
@@ -5209,7 +5209,7 @@ int bgp_filter_evpn_routes_upon_martian_nh_change(struct bgp *bgp)
sizeof(attr_str));
zlog_debug(
- "%u: prefix %pRN with attr %s - DENIED due to martian or self nexthop",
+ "%u: prefix %pBD with attr %s - DENIED due to martian or self nexthop",
bgp->vrf_id, dest,
attr_str);
}
diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c
index b33251635..67885cbf7 100644
--- a/bgpd/bgp_mplsvpn.c
+++ b/bgpd/bgp_mplsvpn.c
@@ -506,7 +506,7 @@ leak_update(struct bgp *bgp, /* destination bgp instance */
if (debug)
zlog_debug(
- "%s: entry: leak-to=%s, p=%pRN, type=%d, sub_type=%d",
+ "%s: entry: leak-to=%s, p=%pBD, type=%d, sub_type=%d",
__func__, bgp->name_pretty, bn, source_bpi->type,
source_bpi->sub_type);
@@ -547,7 +547,7 @@ leak_update(struct bgp *bgp, /* destination bgp instance */
bgp_attr_unintern(&new_attr);
if (debug)
zlog_debug(
- "%s: ->%s: %pRN: Found route, no change",
+ "%s: ->%s: %pBD: Found route, no change",
__func__, bgp->name_pretty, bn);
return NULL;
}
@@ -608,7 +608,7 @@ leak_update(struct bgp *bgp, /* destination bgp instance */
bgp_dest_unlock_node(bn);
if (debug)
- zlog_debug("%s: ->%s: %pRN Found route, changed attr",
+ zlog_debug("%s: ->%s: %pBD Found route, changed attr",
__func__, bgp->name_pretty, bn);
return bpi;
@@ -674,7 +674,7 @@ leak_update(struct bgp *bgp, /* destination bgp instance */
bgp_process(bgp, bn, afi, safi);
if (debug)
- zlog_debug("%s: ->%s: %pRN: Added new route", __func__,
+ zlog_debug("%s: ->%s: %pBD: Added new route", __func__,
bgp->name_pretty, bn);
return new;
@@ -929,7 +929,7 @@ void vpn_leak_from_vrf_withdraw(struct bgp *bgp_vpn, /* to */
if (debug) {
zlog_debug(
- "%s: entry: leak-from=%s, p=%pRN, type=%d, sub_type=%d",
+ "%s: entry: leak-from=%s, p=%pBD, type=%d, sub_type=%d",
__func__, bgp_vrf->name_pretty, path_vrf->net,
path_vrf->type, path_vrf->sub_type);
}
@@ -1009,7 +1009,7 @@ void vpn_leak_from_vrf_withdraw_all(struct bgp *bgp_vpn, /* to */
for (bn = bgp_table_top(table); bn; bn = bgp_route_next(bn)) {
bpi = bgp_dest_get_bgp_path_info(bn);
if (debug && bpi) {
- zlog_debug("%s: looking at prefix %pRN",
+ zlog_debug("%s: looking at prefix %pBD",
__func__, bn);
}
@@ -1262,7 +1262,7 @@ vpn_leak_to_vrf_update_onevrf(struct bgp *bgp_vrf, /* to */
}
if (debug)
- zlog_debug("%s: pfx %pRN: num_labels %d", __func__,
+ zlog_debug("%s: pfx %pBD: num_labels %d", __func__,
path_vpn->net, num_labels);
/*
@@ -1315,7 +1315,7 @@ void vpn_leak_to_vrf_withdraw(struct bgp *bgp_vpn, /* from */
int debug = BGP_DEBUG(vpn, VPN_LEAK_TO_VRF);
if (debug)
- zlog_debug("%s: entry: p=%pRN, type=%d, sub_type=%d", __func__,
+ zlog_debug("%s: entry: p=%pBD, type=%d, sub_type=%d", __func__,
path_vpn->net, path_vpn->type, path_vpn->sub_type);
if (debug)
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index 0d8214e4d..29cca99fd 100644
--- a/bgpd/bgp_nexthop.c
+++ b/bgpd/bgp_nexthop.c
@@ -757,10 +757,10 @@ static void bgp_show_nexthop_paths(struct vty *vty, struct bgp *bgp,
if (dest->pdest) {
prefix_rd2str((struct prefix_rd *)bgp_dest_get_prefix(dest->pdest),
buf1, sizeof(buf1));
- vty_out(vty, " %d/%d %pRN RD %s %s flags 0x%x\n",
+ vty_out(vty, " %d/%d %pBD RD %s %s flags 0x%x\n",
afi, safi, dest, buf1, bgp_path->name_pretty, path->flags);
} else
- vty_out(vty, " %d/%d %pRN %s flags 0x%x\n",
+ vty_out(vty, " %d/%d %pBD %s flags 0x%x\n",
afi, safi, dest, bgp_path->name_pretty, path->flags);
}
}
diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c
index e97c34bb5..6cd38ec78 100644
--- a/bgpd/bgp_nht.c
+++ b/bgpd/bgp_nht.c
@@ -757,7 +757,7 @@ static void evaluate_paths(struct bgp_nexthop_cache *bnc)
path->sub_type, path->attr, dest)) {
if (BGP_DEBUG(nht, NHT))
zlog_debug(
- "%s: prefix %pRN (vrf %s), ignoring path due to martian or self-next-hop",
+ "%s: prefix %pBD (vrf %s), ignoring path due to martian or self-next-hop",
__func__, dest, bgp_path->name);
} else
bnc_is_valid_nexthop =
@@ -771,12 +771,12 @@ static void evaluate_paths(struct bgp_nexthop_cache *bnc)
prefix_rd2str((struct prefix_rd *)bgp_dest_get_prefix(dest->pdest),
buf1, sizeof(buf1));
zlog_debug(
- "... eval path %d/%d %pRN RD %s %s flags 0x%x",
+ "... eval path %d/%d %pBD RD %s %s flags 0x%x",
afi, safi, dest, buf1,
bgp_path->name_pretty, path->flags);
} else
zlog_debug(
- "... eval path %d/%d %pRN %s flags 0x%x",
+ "... eval path %d/%d %pBD %s flags 0x%x",
afi, safi, dest, bgp_path->name_pretty,
path->flags);
}
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 8977b1651..f130d5496 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -314,8 +314,8 @@ static int bgp_dest_set_defer_flag(struct bgp_dest *dest, bool delete)
if (CHECK_FLAG(dest->flags, BGP_NODE_PROCESS_SCHEDULED)) {
if (BGP_DEBUG(update, UPDATE_OUT))
zlog_debug(
- "Route %pRN is in workqueue and being processed, not deferred.",
- bgp_dest_to_rnode(dest));
+ "Route %pBD is in workqueue and being processed, not deferred.",
+ dest);
return 0;
}
@@ -365,7 +365,7 @@ static int bgp_dest_set_defer_flag(struct bgp_dest *dest, bool delete)
bgp->gr_info[afi][safi].route_list,
dest);
if (BGP_DEBUG(update, UPDATE_OUT))
- zlog_debug("DEFER route %pRN, dest %p, node %p",
+ zlog_debug("DEFER route %pBD, dest %p, node %p",
dest, dest, dest->rt_node);
return 0;
}
@@ -2601,7 +2601,7 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_dest *dest,
debug = bgp_debug_bestpath(dest);
if (debug)
zlog_debug(
- "%s: bgp delete in progress, ignoring event, p=%pRN",
+ "%s: bgp delete in progress, ignoring event, p=%pBD",
__func__, dest);
return;
}
@@ -2625,7 +2625,7 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_dest *dest,
debug = bgp_debug_bestpath(dest);
if (debug)
- zlog_debug("%s: p=%pRN afi=%s, safi=%s start", __func__, dest,
+ zlog_debug("%s: p=%pBD afi=%s, safi=%s start", __func__, dest,
afi2str(afi), safi2str(safi));
/* The best path calculation for the route is deferred if
@@ -2686,7 +2686,7 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_dest *dest,
if (debug)
zlog_debug(
- "%s: p=%pRN afi=%s, safi=%s, old_select=%p, new_select=%p",
+ "%s: p=%pBD afi=%s, safi=%s, old_select=%p, new_select=%p",
__func__, dest, afi2str(afi), safi2str(safi),
old_select, new_select);
@@ -14001,7 +14001,7 @@ void bgp_config_write_distance(struct vty *vty, struct bgp *bgp, afi_t afi,
dest = bgp_route_next(dest)) {
bdistance = bgp_dest_get_bgp_distance_info(dest);
if (bdistance != NULL)
- vty_out(vty, " distance %d %pRN %s\n",
+ vty_out(vty, " distance %d %pBD %s\n",
bdistance->distance, dest,
bdistance->access_list ? bdistance->access_list
: "");
diff --git a/bgpd/bgp_table.c b/bgpd/bgp_table.c
index 185cb251c..70e226b01 100644
--- a/bgpd/bgp_table.c
+++ b/bgpd/bgp_table.c
@@ -26,6 +26,7 @@
#include "queue.h"
#include "filter.h"
#include "command.h"
+#include "printfrr.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_table.h"
@@ -203,3 +204,14 @@ struct bgp_node *bgp_table_subtree_lookup(const struct bgp_table *table,
bgp_dest_lock_node(matched);
return matched;
}
+
+printfrr_ext_autoreg_p("BD", printfrr_bd)
+static ssize_t printfrr_bd(char *buf, size_t bsz, const char *fmt,
+ int prec, const void *ptr)
+{
+ const struct bgp_dest *dest = ptr;
+ const struct prefix *p = bgp_dest_get_prefix(dest);
+
+ prefix2str(p, buf, bsz);
+ return 2;
+}
diff --git a/bgpd/bgp_table.h b/bgpd/bgp_table.h
index cf0086b52..31ea5554d 100644
--- a/bgpd/bgp_table.h
+++ b/bgpd/bgp_table.h
@@ -471,6 +471,7 @@ static inline const struct prefix *bgp_dest_get_prefix(const struct bgp_dest *de
#ifdef _FRR_ATTRIBUTE_PRINTFRR
#pragma FRR printfrr_ext "%pRN" (struct bgp_node *)
+#pragma FRR printfrr_ext "%pBD" (struct bgp_dest *)
#endif
#endif /* _QUAGGA_BGP_TABLE_H */
diff --git a/bgpd/rfapi/vnc_export_bgp.c b/bgpd/rfapi/vnc_export_bgp.c
index 0480704b2..b56261669 100644
--- a/bgpd/rfapi/vnc_export_bgp.c
+++ b/bgpd/rfapi/vnc_export_bgp.c
@@ -1865,7 +1865,7 @@ void vnc_direct_bgp_rh_vpn_enable(struct bgp *bgp, afi_t afi)
if (!bgp_dest_has_bgp_path_info_data(dest))
continue;
- vnc_zlog_debug_verbose("%s: checking prefix %pRN",
+ vnc_zlog_debug_verbose("%s: checking prefix %pBD",
__func__, dest);
dest_p = bgp_dest_get_prefix(dest);