diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2019-04-23 01:51:20 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2019-04-23 01:51:20 +0200 |
commit | c23c1d3957090daed15555961975a7465395a210 (patch) | |
tree | 935025f336205d1070e3084da76a7fd5873b66e4 /pimd | |
parent | Merge pull request #4173 from mjstapp/fix_linklist_warning (diff) | |
download | frr-c23c1d3957090daed15555961975a7465395a210.tar.xz frr-c23c1d3957090daed15555961975a7465395a210.zip |
pimd: Add ability to select on S or G for `show ip mroute`
Add the ability to select on a S or G for a `show ip mroute`
command.
show ip mroute 225.1.1.111
show ip mroute 4.5.6.7 225.1.1.111
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd')
-rw-r--r-- | pimd/pim_cmd.c | 49 |
1 files changed, 36 insertions, 13 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index e1dfb0006..77ea314d5 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -4557,8 +4557,8 @@ DEFUN (show_ip_multicast_vrf_all, return CMD_SUCCESS; } -static void show_mroute(struct pim_instance *pim, struct vty *vty, bool fill, - bool uj) +static void show_mroute(struct pim_instance *pim, struct vty *vty, + struct prefix_sg *sg, bool fill, bool uj) { struct listnode *node; struct channel_oil *c_oil; @@ -4595,6 +4595,13 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty, bool fill, if (!c_oil->installed && !uj) continue; + if (sg->grp.s_addr != 0 && + sg->grp.s_addr != c_oil->oil.mfcc_mcastgrp.s_addr) + continue; + if (sg->src.s_addr != 0 && + sg->src.s_addr != c_oil->oil.mfcc_origin.s_addr) + continue; + pim_inet4_dump("<group?>", c_oil->oil.mfcc_mcastgrp, grp_str, sizeof(grp_str)); pim_inet4_dump("<source?>", c_oil->oil.mfcc_origin, src_str, @@ -4892,28 +4899,43 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty, bool fill, } } -DEFUN (show_ip_mroute, +DEFPY (show_ip_mroute, show_ip_mroute_cmd, - "show ip mroute [vrf NAME] [fill] [json]", + "show ip mroute [vrf NAME] [A.B.C.D$s_or_g [A.B.C.D$g]] [fill$fill] [json$json]", SHOW_STR IP_STR MROUTE_STR VRF_CMD_HELP_STR + "The Source or Group\n" + "The Group\n" "Fill in Assumed data\n" JSON_STR) { - bool uj = use_json(argc, argv); - bool fill = false; - int idx = 2; - struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx); + struct prefix_sg sg = {0}; + struct pim_instance *pim; + struct vrf *v; - if (!vrf) + v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME); + + if (!v) { + vty_out(vty, "%% Vrf specified: %s does not exist\n", vrf); return CMD_WARNING; + } + pim = pim_get_pim_instance(v->vrf_id); - if (argv_find(argv, argc, "fill", &idx)) - fill = true; + if (!pim) { + vty_out(vty, "%% Unable to find pim instance\n"); + return CMD_WARNING; + } - show_mroute(vrf->info, vty, fill, uj); + if (s_or_g.s_addr != 0) { + if (g.s_addr != 0) { + sg.src = s_or_g; + sg.grp = g; + } else + sg.grp = s_or_g; + } + show_mroute(pim, vty, &sg, !!fill, !!json); return CMD_SUCCESS; } @@ -4927,6 +4949,7 @@ DEFUN (show_ip_mroute_vrf_all, "Fill in Assumed data\n" JSON_STR) { + struct prefix_sg sg = {0}; bool uj = use_json(argc, argv); int idx = 4; struct vrf *vrf; @@ -4946,7 +4969,7 @@ DEFUN (show_ip_mroute_vrf_all, first = false; } else vty_out(vty, "VRF: %s\n", vrf->name); - show_mroute(vrf->info, vty, fill, uj); + show_mroute(vrf->info, vty, &sg, fill, uj); } if (uj) vty_out(vty, "}\n"); |