From e6174ae2cb3c39dc66fdcd94b6f8aa7dee19de12 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 13 Feb 2023 12:29:17 -0500 Subject: [PATCH] doc: Add `show ipv6 rpf X:X::X:X` command to docs Signed-off-by: Donald Sharp --- doc/user/zebra.rst | 5 ++--- zebra/zebra_vty.c | 34 +++++++++++++++++++++++++++++----- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/doc/user/zebra.rst b/doc/user/zebra.rst index e7e2e5d2ed..d7e768b710 100644 --- a/doc/user/zebra.rst +++ b/doc/user/zebra.rst @@ -974,7 +974,7 @@ unicast topology! Unreachable routes do not receive special treatment and do not cause fallback to a second lookup. -.. clicmd:: show ip rpf ADDR +.. clicmd:: show [ip|ipv6] rpf ADDR Performs a Multicast RPF lookup, as configured with ``ip multicast rpf-lookup-mode MODE``. ADDR specifies the multicast source address to look @@ -984,7 +984,6 @@ unicast topology! > show ip rpf 192.0.2.1 Routing entry for 192.0.2.0/24 using Unicast RIB - Known via "kernel", distance 0, metric 0, best * 198.51.100.1, via eth0 @@ -992,7 +991,7 @@ unicast topology! Indicates that a multicast source lookup for 192.0.2.1 would use an Unicast RIB entry for 192.0.2.0/24 with a gateway of 198.51.100.1. -.. clicmd:: show ip rpf +.. clicmd:: show [ip|ipv6] rpf Prints the entire Multicast RIB. Note that this is independent of the configured RPF lookup mode, the Multicast RIB may be printed yet not diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index d6009db0c6..e12d01a612 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -146,11 +146,12 @@ DEFUN (no_ip_multicast_mode, } -DEFUN (show_ip_rpf, +DEFPY (show_ip_rpf, show_ip_rpf_cmd, - "show ip rpf [json]", + "show [ip$ip|ipv6$ipv6] rpf [json]", SHOW_STR IP_STR + IPV6_STR "Display RPF information for multicast source\n" JSON_STR) { @@ -159,9 +160,9 @@ DEFUN (show_ip_rpf, .multi = false, }; - return do_show_ip_route(vty, VRF_DEFAULT_NAME, AFI_IP, SAFI_MULTICAST, - false, uj, 0, NULL, false, 0, 0, 0, false, - &ctx); + return do_show_ip_route(vty, VRF_DEFAULT_NAME, ip ? AFI_IP : AFI_IP6, + SAFI_MULTICAST, false, uj, 0, NULL, false, 0, 0, + 0, false, &ctx); } DEFPY (show_ip_rpf_addr, @@ -186,6 +187,28 @@ DEFPY (show_ip_rpf_addr, return CMD_SUCCESS; } +DEFPY (show_ipv6_rpf_addr, + show_ipv6_rpf_addr_cmd, + "show ipv6 rpf X:X::X:X$address", + SHOW_STR + IPV6_STR + "Display RPF information for multicast source\n" + "IPv6 multicast source address\n") +{ + struct route_node *rn; + struct route_entry *re; + + re = rib_match_multicast(AFI_IP6, VRF_DEFAULT, (union g_addr *)&address, + &rn); + + if (re) + vty_show_ip_route_detail(vty, rn, 1, false, false); + else + vty_out(vty, "%% No match for RPF lookup\n"); + + return CMD_SUCCESS; +} + static char re_status_output_char(const struct route_entry *re, const struct nexthop *nhop, bool is_fib) @@ -4583,6 +4606,7 @@ void zebra_vty_init(void) install_element(VIEW_NODE, &show_ip_rpf_cmd); install_element(VIEW_NODE, &show_ip_rpf_addr_cmd); + install_element(VIEW_NODE, &show_ipv6_rpf_addr_cmd); install_element(CONFIG_NODE, &ip_nht_default_route_cmd); install_element(CONFIG_NODE, &no_ip_nht_default_route_cmd); -- 2.39.5