]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: `show ip nht mrib`
authorDavid Lamparter <equinox@opensourcerouting.org>
Thu, 21 Oct 2021 13:17:41 +0000 (15:17 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Sun, 27 Mar 2022 12:57:18 +0000 (14:57 +0200)
Prints the SAFI_MULTICAST NHT state in zebra.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
zebra/zebra_rnh.c
zebra/zebra_rnh.h
zebra/zebra_vty.c

index 9a2b81bc27c5a6130c50b18135b74ea0bd72fa5d..d439b1dbc519722f512b8e25b70ff120cb8efd77 100644 (file)
@@ -802,13 +802,13 @@ void zebra_evaluate_rnh(struct zebra_vrf *zvrf, afi_t afi, int force,
        }
 }
 
-void zebra_print_rnh_table(vrf_id_t vrfid, afi_t afi, struct vty *vty,
-                          struct prefix *p)
+void zebra_print_rnh_table(vrf_id_t vrfid, afi_t afi, safi_t safi,
+                          struct vty *vty, struct prefix *p)
 {
        struct route_table *table;
        struct route_node *rn;
 
-       table = get_rnh_table(vrfid, afi, SAFI_UNICAST);
+       table = get_rnh_table(vrfid, afi, safi);
        if (!table) {
                if (IS_ZEBRA_DEBUG_NHT)
                        zlog_debug("print_rnhs: rnh table not found");
index c8e7dda4374a41434123d5517e6808df15b1df68..3991066d1b27f9d5dcb8e273f5d2ad3d50abac9d 100644 (file)
@@ -45,8 +45,8 @@ extern void zebra_deregister_rnh_pseudowire(vrf_id_t, struct zebra_pw *);
 extern void zebra_remove_rnh_client(struct rnh *rnh, struct zserv *client);
 extern void zebra_evaluate_rnh(struct zebra_vrf *zvrf, afi_t afi, int force,
                               struct prefix *p, safi_t safi);
-extern void zebra_print_rnh_table(vrf_id_t vrfid, afi_t afi, struct vty *vty,
-                                 struct prefix *p);
+extern void zebra_print_rnh_table(vrf_id_t vrfid, afi_t afi, safi_t safi,
+                                 struct vty *vty, struct prefix *p);
 
 extern int rnh_resolve_via_default(struct zebra_vrf *zvrf, int family);
 
index 32bbfd6654610d047932809032306e1957de0fca..22c65e3c0ca761bcaadfa915149e248bab59e00e 100644 (file)
@@ -1361,7 +1361,7 @@ static int do_show_ip_route(struct vty *vty, const char *vrf_name, afi_t afi,
 
 DEFPY (show_ip_nht,
        show_ip_nht_cmd,
-       "show <ip$ipv4|ipv6$ipv6> <nht|import-check>$type [<A.B.C.D|X:X::X:X>$addr|vrf NAME$vrf_name [<A.B.C.D|X:X::X:X>$addr]|vrf all$vrf_all]",
+       "show <ip$ipv4|ipv6$ipv6> <nht|import-check>$type [<A.B.C.D|X:X::X:X>$addr|vrf NAME$vrf_name [<A.B.C.D|X:X::X:X>$addr]|vrf all$vrf_all] [mrib$mrib]",
        SHOW_STR
        IP_STR
        IP6_STR
@@ -1372,11 +1372,13 @@ DEFPY (show_ip_nht,
        VRF_CMD_HELP_STR
        "IPv4 Address\n"
        "IPv6 Address\n"
-       VRF_ALL_CMD_HELP_STR)
+       VRF_ALL_CMD_HELP_STR
+       "Show Multicast (MRIB) NHT state\n")
 {
        afi_t afi = ipv4 ? AFI_IP : AFI_IP6;
        vrf_id_t vrf_id = VRF_DEFAULT;
        struct prefix prefix, *p = NULL;
+       safi_t safi = mrib ? SAFI_MULTICAST : SAFI_UNICAST;
 
        if (vrf_all) {
                struct vrf *vrf;
@@ -1385,8 +1387,8 @@ DEFPY (show_ip_nht,
                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,
-                                                     NULL);
+                               zebra_print_rnh_table(zvrf_id(zvrf), afi, safi,
+                                                     vty, NULL);
                        }
                return CMD_SUCCESS;
        }
@@ -1400,7 +1402,7 @@ DEFPY (show_ip_nht,
                        return CMD_WARNING;
        }
 
-       zebra_print_rnh_table(vrf_id, afi, vty, p);
+       zebra_print_rnh_table(vrf_id, afi, safi, vty, p);
        return CMD_SUCCESS;
 }