}
}
-static void bgp_show_nexthops(struct vty *vty, struct bgp *bgp, int detail)
+static void bgp_show_nexthops(struct vty *vty, struct bgp *bgp, int detail,
+ bool import_table)
{
struct bgp_node *rn;
struct bgp_nexthop_cache *bnc;
char buf[PREFIX2STR_BUFFER];
time_t tbuf;
afi_t afi;
+ struct bgp_table **table;
- vty_out(vty, "Current BGP nexthop cache:\n");
+ if (import_table)
+ vty_out(vty, "Current BGP import check cache:\n");
+ else
+ vty_out(vty, "Current BGP nexthop cache:\n");
+ if (import_table)
+ table = bgp->import_check_table;
+ else
+ table = bgp->nexthop_cache_table;
for (afi = AFI_IP; afi < AFI_MAX; afi++) {
- if (!bgp->nexthop_cache_table[afi])
+ if (!table || !table[afi])
continue;
-
- for (rn = bgp_table_top(bgp->nexthop_cache_table[afi]); rn;
+ for (rn = bgp_table_top(table[afi]); rn;
rn = bgp_route_next(rn)) {
bnc = bgp_node_get_bgp_nexthop_info(rn);
if (!bnc)
}
static int show_ip_bgp_nexthop_table(struct vty *vty, const char *name,
- int detail)
+ int detail, bool import_table)
{
struct bgp *bgp;
return CMD_WARNING;
}
- bgp_show_nexthops(vty, bgp, detail);
+ bgp_show_nexthops(vty, bgp, detail, import_table);
return CMD_SUCCESS;
}
(bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
? VRF_DEFAULT_NAME
: bgp->name);
- bgp_show_nexthops(vty, bgp, 0);
+ bgp_show_nexthops(vty, bgp, 0, false);
}
}
|| argv_find(argv, argc, "vrf", &idx))
vrf = argv[++idx]->arg;
int detail = argv_find(argv, argc, "detail", &idx) ? 1 : 0;
- return show_ip_bgp_nexthop_table(vty, vrf, detail);
+
+ return show_ip_bgp_nexthop_table(vty, vrf, detail, false);
+}
+
+DEFUN (show_ip_bgp_import_check,
+ show_ip_bgp_import_check_cmd,
+ "show [ip] bgp [<view|vrf> VIEWVRFNAME] import-check-table [detail]",
+ SHOW_STR
+ IP_STR
+ BGP_STR
+ BGP_INSTANCE_HELP_STR
+ "BGP import check table\n"
+ "Show detailed information\n")
+{
+ int idx = 0;
+ char *vrf = NULL;
+
+ if (argv_find(argv, argc, "view", &idx)
+ || argv_find(argv, argc, "vrf", &idx))
+ vrf = argv[++idx]->arg;
+ int detail = argv_find(argv, argc, "detail", &idx) ? 1 : 0;
+ return show_ip_bgp_nexthop_table(vty, vrf, detail, true);
}
DEFUN (show_ip_bgp_instance_all_nexthop,
void bgp_scan_vty_init(void)
{
install_element(VIEW_NODE, &show_ip_bgp_nexthop_cmd);
+ install_element(VIEW_NODE, &show_ip_bgp_import_check_cmd);
install_element(VIEW_NODE, &show_ip_bgp_instance_all_nexthop_cmd);
}
return CMD_SUCCESS;
}
+DEFPY (show_ip_import_check,
+ show_ip_import_check_cmd,
+ "show <ip$ipv4|ipv6$ipv6> import-check [vrf NAME$vrf_name|vrf all$vrf_all]",
+ SHOW_STR
+ IP_STR
+ IP6_STR
+ "IP import check tracking table\n"
+ VRF_CMD_HELP_STR
+ VRF_ALL_CMD_HELP_STR)
+{
+ afi_t afi = ipv4 ? AFI_IP : AFI_IP6;
+ vrf_id_t vrf_id = VRF_DEFAULT;
+
+ if (vrf_all) {
+ struct vrf *vrf;
+ struct zebra_vrf *zvrf;
+
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+ if ((zvrf = vrf->info) != NULL) {
+ vty_out(vty, "\nVRF %s:\n",
+ zvrf_name(zvrf));
+ zebra_print_rnh_table(zvrf_id(zvrf),
+ afi, vty,
+ RNH_NEXTHOP_TYPE);
+ }
+ return CMD_SUCCESS;
+ }
+ if (vrf_name)
+ VRF_GET_ID(vrf_id, vrf_name, false);
+
+ zebra_print_rnh_table(vrf_id, afi, vty, RNH_IMPORT_CHECK_TYPE);
+ return CMD_SUCCESS;
+}
DEFUN (show_ip_nht_vrf_all,
show_ip_nht_vrf_all_cmd,
install_element(VIEW_NODE, &show_route_detail_cmd);
install_element(VIEW_NODE, &show_route_summary_cmd);
install_element(VIEW_NODE, &show_ip_nht_cmd);
+ install_element(VIEW_NODE, &show_ip_import_check_cmd);
install_element(VIEW_NODE, &show_ip_nht_vrf_all_cmd);
install_element(VIEW_NODE, &show_ipv6_nht_cmd);
install_element(VIEW_NODE, &show_ipv6_nht_vrf_all_cmd);