{
struct bgp *bgp;
struct bgp_table *table;
+ uint16_t show_flags = 0;
+
+ if (use_json)
+ SET_FLAG(show_flags, BGP_SHOW_OPT_JSON);
bgp = bgp_get_default();
if (bgp == NULL) {
}
table = bgp->rib[afi][SAFI_MPLS_VPN];
return bgp_show_table_rd(vty, bgp, SAFI_MPLS_VPN, table, prd, type,
- output_arg, use_json);
+ output_arg, show_flags);
}
DEFUN (show_bgp_ip_vpn_all_rd,
AFI_IP, safi, use_json,
json_paths);
else {
- if (detail_routes) {
- const struct prefix_rd *prd;
+ if (detail_routes || detail_json) {
+ const struct prefix_rd *prd = NULL;
- prd = bgp_rd_from_dest(dest, safi);
+ if (dest->pdest)
+ prd = bgp_rd_from_dest(
+ dest->pdest, safi);
if (!use_json)
route_vty_out_detail_header(
NULL);
route_vty_out_detail(
- vty, bgp, dest,
- bgp_dest_get_prefix(dest), pi,
+ vty, bgp, dest, dest_p, pi,
family2afi(dest_p->family),
safi, RPKI_NOT_BEING_USED,
json_paths);
int bgp_show_table_rd(struct vty *vty, struct bgp *bgp, safi_t safi,
struct bgp_table *table, struct prefix_rd *prd_match,
- enum bgp_show_type type, void *output_arg, bool use_json)
+ enum bgp_show_type type, void *output_arg,
+ uint16_t show_flags)
{
struct bgp_dest *dest, *next;
unsigned long output_cum = 0;
unsigned long json_header_depth = 0;
struct bgp_table *itable;
bool show_msg;
- uint16_t show_flags = 0;
+ bool use_json = !!CHECK_FLAG(show_flags, BGP_SHOW_OPT_JSON);
show_msg = (!use_json && type == bgp_show_type_normal);
- if (use_json)
- SET_FLAG(show_flags, BGP_SHOW_OPT_JSON);
-
for (dest = bgp_table_top(table); dest; dest = next) {
const struct prefix *dest_p = bgp_dest_get_prefix(dest);
/* use MPLS and ENCAP specific shows until they are merged */
if (safi == SAFI_MPLS_VPN) {
return bgp_show_table_rd(vty, bgp, safi, table, NULL, type,
- output_arg, use_json);
+ output_arg, show_flags);
}
if (safi == SAFI_FLOWSPEC && type == bgp_show_type_detail) {
extern int bgp_show_table_rd(struct vty *vty, struct bgp *bgp, safi_t safi,
struct bgp_table *table, struct prefix_rd *prd,
enum bgp_show_type type, void *output_arg,
- bool use_json);
+ uint16_t show_flags);
extern void bgp_best_path_select_defer(struct bgp *bgp, afi_t afi, safi_t safi);
extern bool bgp_update_martian_nexthop(struct bgp *bgp, afi_t afi, safi_t safi,
uint8_t type, uint8_t stype,