From: Christian Franke Date: Wed, 10 May 2017 20:33:51 +0000 (+0200) Subject: zebra: add 'show ipv6 fib' command X-Git-Tag: reindent-master-before~181^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F502%2Fhead;p=mirror%2Ffrr.git zebra: add 'show ipv6 fib' command Signed-off-by: Christian Franke --- diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index bfb05f61e9..41f471ad4d 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -2970,9 +2970,10 @@ DEFUN (no_ipv6_route_ifname_flags, DEFUN (show_ipv6_route, show_ipv6_route_cmd, - "show ipv6 route [vrf NAME] [json]", + "show ipv6 [vrf NAME] [json]", SHOW_STR IP_STR + "IPv6 forwarding table\n" "IPv6 routing table\n" VRF_CMD_HELP_STR "Output JSON\n") @@ -2986,6 +2987,7 @@ DEFUN (show_ipv6_route, char buf[SRCDEST2STR_BUFFER]; json_object *json = NULL; json_object *json_prefix = NULL; + bool uf = use_fib(argv[2]); int vrf = (argc > 3 && strmatch (argv[3]->text, "vrf")); int uj = vrf ? argc == 6 : argc == 4; @@ -3031,6 +3033,8 @@ DEFUN (show_ipv6_route, { RNODE_FOREACH_RIB (rn, rib) { + if (uf && !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); @@ -3054,6 +3058,8 @@ DEFUN (show_ipv6_route, { RNODE_FOREACH_RIB (rn, rib) { + if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) + continue; if (first) { vty_out (vty, SHOW_ROUTE_V6_HEADER); @@ -3069,9 +3075,10 @@ DEFUN (show_ipv6_route, DEFUN (show_ipv6_route_tag, show_ipv6_route_tag_cmd, - "show ipv6 route [vrf NAME] tag (1-4294967295)", + "show ipv6 [vrf NAME] tag (1-4294967295)", SHOW_STR IP_STR + "IPv6 forwarding table\n" "IPv6 routing table\n" VRF_CMD_HELP_STR "Show only routes with tag\n" @@ -3086,6 +3093,7 @@ DEFUN (show_ipv6_route_tag, int first = 1; route_tag_t tag = 0; vrf_id_t vrf_id = VRF_DEFAULT; + bool uf = use_fib(argv[2]); if (strmatch(argv[idx_vrf]->text, "vrf")) { @@ -3106,6 +3114,8 @@ DEFUN (show_ipv6_route_tag, for (rn = route_top (table); rn; rn = srcdest_route_next (rn)) RNODE_FOREACH_RIB (rn, rib) { + if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) + continue; if (rib->tag != tag) continue; @@ -3121,9 +3131,10 @@ DEFUN (show_ipv6_route_tag, DEFUN (show_ipv6_route_prefix_longer, show_ipv6_route_prefix_longer_cmd, - "show ipv6 route [vrf NAME] X:X::X:X/M longer-prefixes", + "show ipv6 [vrf NAME] X:X::X:X/M longer-prefixes", SHOW_STR IP_STR + "IPv6 forwarding table\n" "IPv6 routing table\n" VRF_CMD_HELP_STR "IPv6 prefix\n" @@ -3136,6 +3147,7 @@ DEFUN (show_ipv6_route_prefix_longer, int ret; int first = 1; vrf_id_t vrf_id = VRF_DEFAULT; + bool uf = use_fib(argv[2]); if (strmatch(argv[3]->text, "vrf")) { @@ -3164,6 +3176,8 @@ DEFUN (show_ipv6_route_prefix_longer, struct prefix *p, *src_p; srcdest_rnode_prefixes(rn, &p, &src_p); + if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) + continue; if (prefix_match (p, &rn->p)) { if (first) @@ -3179,10 +3193,11 @@ DEFUN (show_ipv6_route_prefix_longer, DEFUN (show_ipv6_route_protocol, show_ipv6_route_protocol_cmd, - "show ipv6 route [vrf NAME] " FRR_IP6_REDIST_STR_ZEBRA, + "show ipv6 [vrf NAME] " FRR_IP6_REDIST_STR_ZEBRA, SHOW_STR IP_STR - "IP routing table\n" + "IPv6 forwarding table\n" + "IPv6 routing table\n" VRF_CMD_HELP_STR FRR_IP6_REDIST_HELP_STR_ZEBRA) { @@ -3192,6 +3207,7 @@ DEFUN (show_ipv6_route_protocol, 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)) @@ -3215,6 +3231,8 @@ DEFUN (show_ipv6_route_protocol, 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_V6_HEADER); @@ -3417,9 +3435,10 @@ DEFUN (show_ipv6_mroute, DEFUN (show_ipv6_route_vrf_all, show_ipv6_route_vrf_all_cmd, - "show ipv6 route vrf all", + "show ipv6 vrf all", SHOW_STR IP_STR + "IPv6 forwarding table\n" "IPv6 routing table\n" VRF_ALL_CMD_HELP_STR) { @@ -3430,6 +3449,7 @@ DEFUN (show_ipv6_route_vrf_all, 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) { @@ -3441,6 +3461,8 @@ DEFUN (show_ipv6_route_vrf_all, for (rn = route_top (table); rn; rn = srcdest_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_V6_HEADER); @@ -3462,9 +3484,10 @@ DEFUN (show_ipv6_route_vrf_all, DEFUN (show_ipv6_route_vrf_all_tag, show_ipv6_route_vrf_all_tag_cmd, - "show ipv6 route vrf all tag (1-4294967295)", + "show ipv6 vrf all tag (1-4294967295)", SHOW_STR IP_STR + "IPv6 forwarding table\n" "IPv6 routing table\n" VRF_ALL_CMD_HELP_STR "Show only routes with tag\n" @@ -3479,6 +3502,7 @@ DEFUN (show_ipv6_route_vrf_all_tag, 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); @@ -3493,6 +3517,8 @@ DEFUN (show_ipv6_route_vrf_all_tag, for (rn = route_top (table); rn; rn = srcdest_route_next (rn)) RNODE_FOREACH_RIB (rn, rib) { + if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) + continue; if (rib->tag != tag) continue; @@ -3517,9 +3543,10 @@ DEFUN (show_ipv6_route_vrf_all_tag, DEFUN (show_ipv6_route_vrf_all_prefix_longer, show_ipv6_route_vrf_all_prefix_longer_cmd, - "show ipv6 route vrf all X:X::X:X/M longer-prefixes", + "show ipv6 vrf all X:X::X:X/M longer-prefixes", SHOW_STR IP_STR + "IPv6 forwarding table\n" "IPv6 routing table\n" VRF_ALL_CMD_HELP_STR "IPv6 prefix\n" @@ -3535,6 +3562,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix_longer, int ret; int first = 1; int vrf_header = 1; + bool uf = use_fib(argv[2]); ret = str2prefix (argv[idx_ipv6_prefixlen]->arg, &p); if (! ret) @@ -3555,6 +3583,8 @@ DEFUN (show_ipv6_route_vrf_all_prefix_longer, { struct prefix *p, *src_p; srcdest_rnode_prefixes(rn, &p, &src_p); + if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) + continue; if (prefix_match (p, &rn->p)) { if (first) @@ -3579,10 +3609,11 @@ DEFUN (show_ipv6_route_vrf_all_prefix_longer, DEFUN (show_ipv6_route_vrf_all_protocol, show_ipv6_route_vrf_all_protocol_cmd, - "show ipv6 route vrf all " FRR_IP6_REDIST_STR_ZEBRA, + "show ipv6 vrf all " FRR_IP6_REDIST_STR_ZEBRA, SHOW_STR IP_STR - "IP routing table\n" + "IPv6 forwarding table\n" + "IPv6 routing table\n" VRF_ALL_CMD_HELP_STR FRR_IP6_REDIST_HELP_STR_ZEBRA) { @@ -3594,6 +3625,7 @@ DEFUN (show_ipv6_route_vrf_all_protocol, 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_IP6, proto); @@ -3615,6 +3647,8 @@ DEFUN (show_ipv6_route_vrf_all_protocol, 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_V6_HEADER);