extern int allow_delete;
static int do_show_ip_route(struct vty *vty, const char *vrf_name,
- safi_t safi, u_char use_json);
+ safi_t safi, bool use_fib, u_char use_json);
static void vty_show_ip_route_detail (struct vty *vty, struct route_node *rn,
int mcast);
IP_STR
"Display RPF information for multicast source\n")
{
- return do_show_ip_route(vty, VRF_DEFAULT_NAME, SAFI_MULTICAST, 0);
+ return do_show_ip_route(vty, VRF_DEFAULT_NAME, SAFI_MULTICAST, false, 0);
}
DEFUN (show_ip_rpf_addr,
}
}
+static bool
+use_fib (struct cmd_token *token)
+{
+ return strncmp(token->arg, "route", strlen(token->arg));
+}
+
DEFUN (show_ip_route,
show_ip_route_cmd,
- "show ip route [json]",
+ "show ip <fib|route> [json]",
SHOW_STR
IP_STR
+ "IP forwarding table\n"
"IP routing table\n"
JSON_STR)
{
- return do_show_ip_route (vty, VRF_DEFAULT_NAME, SAFI_UNICAST, use_json(argc, argv));
+ return do_show_ip_route (vty, VRF_DEFAULT_NAME, SAFI_UNICAST,
+ use_fib(argv[2]), use_json(argc, argv));
}
static int
do_show_ip_route (struct vty *vty, const char *vrf_name, safi_t safi,
- u_char use_json)
+ bool use_fib, u_char use_json)
{
struct route_table *table;
struct route_node *rn;
{
RNODE_FOREACH_RIB (rn, rib)
{
+ if (use_fib && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (!json_prefix)
json_prefix = json_object_new_array();
vty_show_ip_route (vty, rn, rib, json_prefix);
{
RNODE_FOREACH_RIB (rn, rib)
{
+ if (use_fib && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (first)
{
vty_out (vty, SHOW_ROUTE_V4_HEADER);
DEFUN (show_ip_route_vrf,
show_ip_route_vrf_cmd,
- "show ip route vrf NAME [json]",
+ "show ip <fib|route> vrf NAME [json]",
SHOW_STR
IP_STR
+ "IP forwarding table\n"
"IP routing table\n"
VRF_CMD_HELP_STR
JSON_STR)
{
int idx_vrf = 4;
+ bool uf = use_fib(argv[2]);
u_char uj = use_json(argc, argv);
- return do_show_ip_route (vty, argv[idx_vrf]->arg, SAFI_UNICAST, uj);
+ return do_show_ip_route (vty, argv[idx_vrf]->arg, SAFI_UNICAST, uf, uj);
}
DEFUN (show_ip_nht,
DEFUN (show_ip_route_tag,
show_ip_route_tag_cmd,
- "show ip route [vrf NAME] tag (1-4294967295)",
+ "show ip <fib|route> [vrf NAME] tag (1-4294967295)",
SHOW_STR
IP_STR
+ "IP forwarding table\n"
"IP routing table\n"
VRF_CMD_HELP_STR
"Show only routes with tag\n"
"Tag value\n")
{
+ bool uf = use_fib(argv[2]);
int idx_vrf = 3;
int idx_name = 4;
int idx_tag = 6;
for (rn = route_top (table); rn; rn = route_next (rn))
RNODE_FOREACH_RIB (rn, rib)
{
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (rib->tag != tag)
continue;
DEFUN (show_ip_route_prefix_longer,
show_ip_route_prefix_longer_cmd,
- "show ip route [vrf NAME] A.B.C.D/M longer-prefixes",
+ "show ip <fib|route> [vrf NAME] A.B.C.D/M longer-prefixes",
SHOW_STR
IP_STR
+ "IP forwarding table\n"
"IP routing table\n"
VRF_CMD_HELP_STR
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
struct prefix p;
int ret;
int first = 1;
+ bool uf = use_fib(argv[2]);
vrf_id_t vrf_id = VRF_DEFAULT;
if (strmatch(argv[3]->text, "vrf"))
RNODE_FOREACH_RIB (rn, rib)
if (prefix_match (&p, &rn->p))
{
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (first)
{
vty_out (vty, SHOW_ROUTE_V4_HEADER);
DEFUN (show_ip_route_supernets,
show_ip_route_supernets_cmd,
- "show ip route [vrf NAME] supernets-only",
+ "show ip <fib|route> [vrf NAME] supernets-only",
SHOW_STR
IP_STR
+ "IP forwarding table\n"
"IP routing table\n"
VRF_CMD_HELP_STR
"Show supernet entries only\n")
u_int32_t addr;
int first = 1;
vrf_id_t vrf_id = VRF_DEFAULT;
+ bool uf = use_fib(argv[2]);
if (strmatch(argv[3]->text, "vrf"))
VRF_GET_ID (vrf_id, argv[4]->arg);
for (rn = route_top (table); rn; rn = route_next (rn))
RNODE_FOREACH_RIB (rn, rib)
{
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
addr = ntohl (rn->p.u.prefix4.s_addr);
if ((IN_CLASSC (addr) && rn->p.prefixlen < 24)
DEFUN (show_ip_route_protocol,
show_ip_route_protocol_cmd,
- "show ip route [vrf NAME] " FRR_IP_REDIST_STR_ZEBRA,
+ "show ip <fib|route> [vrf NAME] " FRR_IP_REDIST_STR_ZEBRA,
SHOW_STR
IP_STR
+ "IP forwarding table\n"
"IP routing table\n"
VRF_CMD_HELP_STR
FRR_IP_REDIST_HELP_STR_ZEBRA)
struct rib *rib;
int first = 1;
vrf_id_t vrf_id = VRF_DEFAULT;
+ bool uf = use_fib(argv[2]);
int idx = 0;
if (argv_find (argv, argc, "NAME", &idx))
RNODE_FOREACH_RIB (rn, rib)
if (rib->type == type)
{
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (first)
{
vty_out (vty, SHOW_ROUTE_V4_HEADER);
DEFUN (show_ip_route_ospf_instance,
show_ip_route_ospf_instance_cmd,
- "show ip route ospf (1-65535)",
+ "show ip <fib|route> ospf (1-65535)",
SHOW_STR
IP_STR
+ "IP forwarding table\n"
"IP routing table\n"
"Open Shortest Path First (OSPFv2)\n"
"Instance ID\n")
struct rib *rib;
int first = 1;
u_short instance = 0;
+ bool uf = use_fib(argv[2]);
VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
RNODE_FOREACH_RIB (rn, rib)
if (rib->type == ZEBRA_ROUTE_OSPF && rib->instance == instance)
{
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (first)
{
vty_out (vty, SHOW_ROUTE_V4_HEADER);
DEFUN (show_ip_route_vrf_all,
show_ip_route_vrf_all_cmd,
- "show ip route vrf all",
+ "show ip <fib|route> vrf all",
SHOW_STR
IP_STR
+ "IP forwarding table\n"
"IP routing table\n"
VRF_ALL_CMD_HELP_STR)
{
struct zebra_vrf *zvrf;
int first = 1;
int vrf_header = 1;
+ bool uf = use_fib(argv[2]);
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
{
for (rn = route_top (table); rn; rn = route_next (rn))
RNODE_FOREACH_RIB (rn, rib)
{
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (first)
{
vty_out (vty, SHOW_ROUTE_V4_HEADER);
DEFUN (show_ip_route_vrf_all_tag,
show_ip_route_vrf_all_tag_cmd,
- "show ip route vrf all tag (1-4294967295)",
+ "show ip <fib|route> vrf all tag (1-4294967295)",
SHOW_STR
IP_STR
+ "IP forwarding table\n"
"IP routing table\n"
VRF_ALL_CMD_HELP_STR
"Show only routes with tag\n"
int first = 1;
int vrf_header = 1;
route_tag_t tag = 0;
+ bool uf = use_fib(argv[2]);
if (argv[idx_number]->arg)
VTY_GET_INTEGER_RANGE("tag", tag, argv[idx_number]->arg, 0, 4294967295);
for (rn = route_top (table); rn; rn = route_next (rn))
RNODE_FOREACH_RIB (rn, rib)
{
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (rib->tag != tag)
continue;
DEFUN (show_ip_route_vrf_all_prefix_longer,
show_ip_route_vrf_all_prefix_longer_cmd,
- "show ip route vrf all A.B.C.D/M longer-prefixes",
+ "show ip <fib|route> vrf all A.B.C.D/M longer-prefixes",
SHOW_STR
IP_STR
+ "IP forwarding table\n"
"IP routing table\n"
VRF_ALL_CMD_HELP_STR
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
int ret;
int first = 1;
int vrf_header = 1;
+ bool uf = use_fib(argv[2]);
ret = str2prefix (argv[idx_ipv4_prefixlen]->arg, &p);
if (! ret)
RNODE_FOREACH_RIB (rn, rib)
if (prefix_match (&p, &rn->p))
{
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (first)
{
vty_out (vty, SHOW_ROUTE_V4_HEADER);
DEFUN (show_ip_route_vrf_all_supernets,
show_ip_route_vrf_all_supernets_cmd,
- "show ip route vrf all supernets-only",
+ "show ip <fib|route> vrf all supernets-only",
SHOW_STR
IP_STR
+ "IP forwarding table\n"
"IP routing table\n"
VRF_ALL_CMD_HELP_STR
"Show supernet entries only\n")
u_int32_t addr;
int first = 1;
int vrf_header = 1;
+ bool uf = use_fib(argv[2]);
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
{
for (rn = route_top (table); rn; rn = route_next (rn))
RNODE_FOREACH_RIB (rn, rib)
{
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
+
addr = ntohl (rn->p.u.prefix4.s_addr);
if ((IN_CLASSC (addr) && rn->p.prefixlen < 24)
DEFUN (show_ip_route_vrf_all_protocol,
show_ip_route_vrf_all_protocol_cmd,
- "show ip route vrf all " FRR_IP_REDIST_STR_ZEBRA,
+ "show ip <fib|route> vrf all " FRR_IP_REDIST_STR_ZEBRA,
SHOW_STR
IP_STR
+ "IP forwarding table\n"
"IP routing table\n"
VRF_ALL_CMD_HELP_STR
FRR_IP_REDIST_HELP_STR_ZEBRA"\n")
struct zebra_vrf *zvrf;
int first = 1;
int vrf_header = 1;
+ bool uf = use_fib(argv[2]);
char *proto = argv[argc - 1]->text;
type = proto_redistnum (AFI_IP, proto);
RNODE_FOREACH_RIB (rn, rib)
if (rib->type == type)
{
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (first)
{
vty_out (vty, SHOW_ROUTE_V4_HEADER);