]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: Fix 'show ip mroute vrf all count' crash
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 7 Jul 2017 21:55:10 +0000 (17:55 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 24 Jul 2017 17:52:57 +0000 (13:52 -0400)
'show ip mroute vrf all count' crashes currently

This commit fixes that issue

Ticket: CM-17052
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pimd/pim_cmd.c

index 0156e1548e4d2c05b66f08862b7d3da35b7b4746..5b3e8ed6b3a46e5fdb84d88fbb8cf50ab6ee2e3a 100644 (file)
@@ -4826,6 +4826,38 @@ DEFUN (show_ip_mroute_count,
        return CMD_SUCCESS;
 }
 
+DEFUN (show_ip_mroute_count_vrf_all,
+       show_ip_mroute_count_vrf_all_cmd,
+       "show ip mroute vrf all count",
+       SHOW_STR
+       IP_STR
+       MROUTE_STR
+       VRF_CMD_HELP_STR
+       "Route and packet count data\n")
+{
+       u_char uj = use_json(argc, argv);
+       struct vrf *vrf;
+       bool first = true;
+
+       if (uj)
+               vty_out(vty, "{ ");
+       RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
+       {
+               if (uj) {
+                       if (!first)
+                               vty_out(vty, ", ");
+                       vty_out(vty, " \"%s\": ", vrf->name);
+                       first = false;
+               } else
+                       vty_out(vty, "VRF: %s\n", vrf->name);
+               show_mroute_count(vrf->info, vty);
+       }
+       if (uj)
+               vty_out(vty, "}\n");
+
+       return CMD_SUCCESS;
+}
+
 DEFUN (show_ip_rib,
        show_ip_rib_cmd,
        "show ip rib [vrf NAME] A.B.C.D",
@@ -8380,6 +8412,7 @@ void pim_cmd_init(void)
        install_element(VIEW_NODE, &show_ip_mroute_cmd);
        install_element(VIEW_NODE, &show_ip_mroute_vrf_all_cmd);
        install_element(VIEW_NODE, &show_ip_mroute_count_cmd);
+       install_element(VIEW_NODE, &show_ip_mroute_count_vrf_all_cmd);
        install_element(VIEW_NODE, &show_ip_rib_cmd);
        install_element(VIEW_NODE, &show_ip_ssmpingd_cmd);
        install_element(VIEW_NODE, &show_debugging_pim_cmd);