if (detail)
route_vty_out_detail(vty, bgp, bd, bgp_dest_get_prefix(bd), pi,
AFI_L2VPN, SAFI_EVPN, RPKI_NOT_BEING_USED,
- json_path, NULL);
+ json_path, NULL, 0);
else
route_vty_out(vty, &bd->rn->p, pi, 0, SAFI_EVPN,
json_path, false);
if (detail)
route_vty_out_detail(vty, bgp, dest, &tmp_p, pi, AFI_L2VPN,
SAFI_EVPN, RPKI_NOT_BEING_USED, json_path,
- NULL);
+ NULL, 0);
else
route_vty_out(vty, &tmp_p, pi, 0, SAFI_EVPN,
json_path = json_object_new_array();
route_vty_out_detail(vty, bgp, dest, bgp_dest_get_prefix(dest), pi, afi, safi,
- RPKI_NOT_BEING_USED, json_path, NULL);
+ RPKI_NOT_BEING_USED, json_path, NULL, 0);
if (json)
json_object_array_add(json_paths, json_path);
}
route_vty_out_detail(vty, bgp, dest, (struct prefix *)&tmp_p, pi, afi, safi,
- RPKI_NOT_BEING_USED, json_path, NULL);
+ RPKI_NOT_BEING_USED, json_path, NULL, 0);
if (json)
json_object_array_add(json_paths, json_path);
json_path = json_object_new_array();
route_vty_out_detail(vty, bgp, dest, bgp_dest_get_prefix(dest), pi, afi, safi,
- RPKI_NOT_BEING_USED, json_path, NULL);
+ RPKI_NOT_BEING_USED, json_path, NULL, 0);
if (json)
json_object_array_add(json_paths, json_path);
json_path = json_object_new_array();
route_vty_out_detail(vty, bgp, dest, bgp_dest_get_prefix(dest), pi, afi,
- safi, RPKI_NOT_BEING_USED, json_path, NULL);
+ safi, RPKI_NOT_BEING_USED, json_path, NULL, 0);
if (json)
json_object_array_add(json_paths, json_path);
json_path = json_object_new_array();
route_vty_out_detail(vty, bgp, dest, p, pi, AFI_L2VPN, SAFI_EVPN,
- RPKI_NOT_BEING_USED, json_path, NULL);
+ RPKI_NOT_BEING_USED, json_path, NULL, 0);
if (json)
json_object_array_add(json_paths, json_path);
route_vty_out_detail(vty, bgp, dest,
bgp_dest_get_prefix(dest), pi,
AFI_L2VPN, SAFI_EVPN,
- RPKI_NOT_BEING_USED, json_path, NULL);
+ RPKI_NOT_BEING_USED, json_path, NULL,
+ 0);
} else
route_vty_out(vty, p, pi, 0, SAFI_EVPN,
json_path, false);
void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
const struct prefix *p, struct bgp_path_info *path, afi_t afi,
safi_t safi, enum rpki_states rpki_curr_state, json_object *json_paths,
- struct attr *pattr)
+ struct attr *pattr, uint16_t show_opts)
{
char buf[INET6_ADDRSTRLEN];
char vni_buf[30] = {};
llgr_remaining);
}
+ /* Display internal data if asked */
+ if (CHECK_FLAG(show_opts, BGP_SHOW_OPT_INTERNAL_DATA)) {
+ if (!json_paths) {
+ vty_out(vty, " net: %p, path: %p, pathext: %p, attr: %p\n", path->net,
+ path, path->extra, attr);
+ vty_out(vty, " flags net: 0x%u, path: 0x%u, attr: 0x%" PRIu64 "\n",
+ path->net->flags, path->flags, attr->flag);
+ }
+ }
+
/* Output some debug about internal state of the dest flags */
if (json_paths) {
if (CHECK_FLAG(bn->flags, BGP_NODE_PROCESS_SCHEDULED))
route_vty_out_detail(vty, bgp, dest, dest_p, pi,
family2afi(dest_p->family), safi,
- rpki_curr_state, json_paths, NULL);
+ rpki_curr_state, json_paths, NULL,
+ show_flags);
} else {
route_vty_out(vty, dest_p, pi, display,
safi, json_paths, wide);
static void bgp_show_path_info(const struct prefix_rd *pfx_rd, struct bgp_dest *bgp_node,
struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
json_object *json, enum bgp_path_type pathtype, int *display,
- enum rpki_states rpki_target_state, struct attr *attr)
+ enum rpki_states rpki_target_state, struct attr *attr,
+ uint16_t show_opts)
{
struct bgp_path_info *pi;
int header = 1;
&& (CHECK_FLAG(pi->flags, BGP_PATH_MULTIPATH)
|| CHECK_FLAG(pi->flags, BGP_PATH_SELECTED))))
route_vty_out_detail(vty, bgp, bgp_node, bgp_dest_get_prefix(bgp_node), pi,
- afi, safi, rpki_curr_state, json_paths, attr);
+ afi, safi, rpki_curr_state, json_paths, attr,
+ show_opts);
}
if (json && json_paths) {
}
/* Display specified route of BGP table. */
-static int bgp_show_route_in_table(struct vty *vty, struct bgp *bgp,
- struct bgp_table *rib, const char *ip_str,
- afi_t afi, safi_t safi,
- enum rpki_states rpki_target_state,
- struct prefix_rd *prd, int prefix_check,
- enum bgp_path_type pathtype, bool use_json)
+static int bgp_show_route_in_table(struct vty *vty, struct bgp *bgp, struct bgp_table *rib,
+ const char *ip_str, afi_t afi, safi_t safi,
+ enum rpki_states rpki_target_state, struct prefix_rd *prd,
+ int prefix_check, enum bgp_path_type pathtype, bool use_json,
+ uint16_t show_opts)
{
int ret;
int display = 0;
continue;
}
- bgp_show_path_info((struct prefix_rd *)dest_p, rm, vty, bgp, afi, safi,
- json, pathtype, &display, rpki_target_state, NULL);
+ bgp_show_path_info((struct prefix_rd *)dest_p, rm, vty, bgp, afi, safi, json,
+ pathtype, &display, rpki_target_state, NULL, show_opts);
bgp_dest_unlock_node(rm);
}
rm = longest_pfx;
bgp_dest_lock_node(rm);
- bgp_show_path_info((struct prefix_rd *)dest_p, rm, vty, bgp, afi, safi,
- json, pathtype, &display, rpki_target_state, NULL);
+ bgp_show_path_info((struct prefix_rd *)dest_p, rm, vty, bgp, afi, safi, json,
+ pathtype, &display, rpki_target_state, NULL, show_opts);
bgp_dest_unlock_node(rm);
}
if (!prefix_check
|| dest_p->prefixlen == match.prefixlen) {
bgp_show_path_info(NULL, dest, vty, bgp, afi, safi, json, pathtype,
- &display, rpki_target_state, NULL);
+ &display, rpki_target_state, NULL, show_opts);
}
bgp_dest_unlock_node(dest);
}
/* Display specified route of Main RIB */
-static int bgp_show_route(struct vty *vty, struct bgp *bgp, const char *ip_str,
- afi_t afi, safi_t safi, struct prefix_rd *prd,
- int prefix_check, enum bgp_path_type pathtype,
- enum rpki_states rpki_target_state, bool use_json)
+static int bgp_show_route(struct vty *vty, struct bgp *bgp, const char *ip_str, afi_t afi,
+ safi_t safi, struct prefix_rd *prd, int prefix_check,
+ enum bgp_path_type pathtype, enum rpki_states rpki_target_state,
+ bool use_json, uint16_t show_opts)
{
if (!bgp) {
bgp = bgp_get_default();
if (safi == SAFI_LABELED_UNICAST)
safi = SAFI_UNICAST;
- return bgp_show_route_in_table(vty, bgp, bgp->rib[afi][safi], ip_str,
- afi, safi, rpki_target_state, prd,
- prefix_check, pathtype, use_json);
+ return bgp_show_route_in_table(vty, bgp, bgp->rib[afi][safi], ip_str, afi, safi,
+ rpki_target_state, prd, prefix_check, pathtype, use_json,
+ show_opts);
}
static int bgp_show_lcommunity(struct vty *vty, struct bgp *bgp, int argc,
|A.B.C.D/M longer-prefixes\
|X:X::X:X/M longer-prefixes\
|"BGP_SELF_ORIG_CMD_STR"\
- |detail-routes$detail_routes\
+ |detail-routes$detail_routes [internal$internal]\
] [json$uj [detail$detail_json] | wide$wide]",
SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR BGP_AFI_HELP_STR
BGP_SAFI_WITH_LABEL_HELP_STR
"Display route and more specific routes\n"
BGP_SELF_ORIG_HELP_STR
"Display detailed version of all routes\n"
+ "Display detailed version of all routes including internal data\n"
JSON_STR
"Display detailed version of JSON output\n"
"Increase table width for longer prefixes\n")
if (detail_routes)
SET_FLAG(show_flags, BGP_SHOW_OPT_ROUTES_DETAIL);
+ if (internal)
+ SET_FLAG(show_flags, BGP_SHOW_OPT_INTERNAL_DATA);
+
/* [<ipv4|ipv6> [all]] */
if (all) {
SET_FLAG(show_flags, BGP_SHOW_OPT_AFI_ALL);
DEFUN (show_ip_bgp_route,
show_ip_bgp_route_cmd,
- "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_WITH_LABEL_CMD_STR"]]<A.B.C.D|A.B.C.D/M|X:X::X:X|X:X::X:X/M> [<bestpath|multipath>] [rpki <valid|invalid|notfound>] [json]",
+ "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_WITH_LABEL_CMD_STR"]]<A.B.C.D|A.B.C.D/M|X:X::X:X|X:X::X:X/M> [internal] [<bestpath|multipath>] [rpki <valid|invalid|notfound>] [json]",
SHOW_STR
IP_STR
BGP_STR
"IPv4 prefix\n"
"Network in the BGP routing table to display\n"
"IPv6 prefix\n"
+ "Display internal data additionally\n"
"Display only the bestpath\n"
"Display only multipaths\n"
"Display only paths that match the specified rpki state\n"
struct bgp *bgp = NULL;
enum bgp_path_type path_type;
bool uj = use_json(argc, argv);
+ uint16_t show_opts = 0;
int idx = 0;
prefix = argv[idx]->arg;
+ /* Display internal data also */
+ if (argv_find(argv, argc, "internal", &idx))
+ SET_FLAG(show_opts, BGP_SHOW_OPT_INTERNAL_DATA);
+
/* [<bestpath|multipath>] */
if (argv_find(argv, argc, "bestpath", &idx))
path_type = BGP_PATH_SHOW_BESTPATH;
else
path_type = BGP_PATH_SHOW_ALL;
- return bgp_show_route(vty, bgp, prefix, afi, safi, NULL, prefix_check,
- path_type, RPKI_NOT_BEING_USED, uj);
+ return bgp_show_route(vty, bgp, prefix, afi, safi, NULL, prefix_check, path_type,
+ RPKI_NOT_BEING_USED, uj, show_opts);
}
DEFUN (show_ip_bgp_regexp,
return CMD_WARNING;
}
- return bgp_show_route(vty, bgp, network, AFI_IP, SAFI_MPLS_VPN, NULL, 0,
- BGP_PATH_SHOW_ALL, RPKI_NOT_BEING_USED,
- use_json(argc, argv));
+ return bgp_show_route(vty, bgp, network, AFI_IP, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_SHOW_ALL,
+ RPKI_NOT_BEING_USED, use_json(argc, argv), 0);
}
#endif /* KEEP_OLD_VPN_COMMANDS */
vty_out(vty, "Unable to figure out Network\n");
return CMD_WARNING;
}
- return bgp_show_route(vty, NULL, network, AFI_L2VPN, SAFI_EVPN, NULL,
- prefix_check, BGP_PATH_SHOW_ALL,
- RPKI_NOT_BEING_USED, use_json(argc, argv));
+ return bgp_show_route(vty, NULL, network, AFI_L2VPN, SAFI_EVPN, NULL, prefix_check,
+ BGP_PATH_SHOW_ALL, RPKI_NOT_BEING_USED, use_json(argc, argv), 0);
}
static void show_adj_route_header(struct vty *vty, struct peer *peer,
if (use_json)
json_net = json_object_new_object();
- bgp_show_path_info(NULL /* prefix_rd */, dest, vty, bgp, afi, safi, json_net,
- BGP_PATH_SHOW_ALL, &display, RPKI_NOT_BEING_USED, NULL);
+ bgp_show_path_info(NULL /* prefix_rd */, dest, vty, bgp, afi, safi,
+ json_net, BGP_PATH_SHOW_ALL, &display,
+ RPKI_NOT_BEING_USED, NULL, show_flags);
if (use_json)
json_object_object_addf(json_ar, json_net,
"%pFX", rn_p);
pass_in = dest;
bgp_show_path_info(NULL, pass_in, vty, bgp, afi, safi,
json_net, BGP_PATH_SHOW_ALL, &display,
- RPKI_NOT_BEING_USED, NULL);
+ RPKI_NOT_BEING_USED, NULL, show_flags);
if (use_json)
json_object_object_addf(
json_ar, json_net,
bgp_show_path_info(NULL, dest, vty, bgp, afi, safi,
json_net, BGP_PATH_SHOW_ALL,
&display, RPKI_NOT_BEING_USED,
- adj->attr);
+ adj->attr, show_flags);
if (use_json)
json_object_object_addf(json_ar, json_net,
"%pFX", rn_p);
if (use_json)
json_net =
json_object_new_object();
- bgp_show_path_info(NULL /* prefix_rd */, dest, vty, bgp, afi,
- safi, json_net, BGP_PATH_SHOW_BESTPATH,
- &display, RPKI_NOT_BEING_USED, NULL);
+ bgp_show_path_info(NULL /* prefix_rd */, dest, vty, bgp,
+ afi, safi, json_net,
+ BGP_PATH_SHOW_BESTPATH, &display,
+ RPKI_NOT_BEING_USED, NULL, show_flags);
if (use_json)
json_object_object_addf(
json_ar, json_net,
}
if (!strcmp(argv[5]->arg, "all"))
- return bgp_show_route(vty, NULL, argv[6]->arg, afi,
- SAFI_MPLS_VPN, NULL, 0, BGP_PATH_SHOW_ALL,
- RPKI_NOT_BEING_USED,
- use_json(argc, argv));
+ return bgp_show_route(vty, NULL, argv[6]->arg, afi, SAFI_MPLS_VPN, NULL, 0,
+ BGP_PATH_SHOW_ALL, RPKI_NOT_BEING_USED, use_json(argc, argv),
+ 0);
ret = str2prefix_rd(argv[5]->arg, &prd);
if (!ret) {
return CMD_WARNING;
}
- return bgp_show_route(vty, NULL, argv[6]->arg, afi, SAFI_MPLS_VPN, &prd,
- 0, BGP_PATH_SHOW_ALL, RPKI_NOT_BEING_USED,
- use_json(argc, argv));
+ return bgp_show_route(vty, NULL, argv[6]->arg, afi, SAFI_MPLS_VPN, &prd, 0,
+ BGP_PATH_SHOW_ALL, RPKI_NOT_BEING_USED, use_json(argc, argv), 0);
}
static struct bgp_distance *bgp_distance_new(void)