diff options
Diffstat (limited to 'pimd/pim_cmd.c')
| -rw-r--r-- | pimd/pim_cmd.c | 86 |
1 files changed, 75 insertions, 11 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 396b949e4f..144785a5cd 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -4451,7 +4451,8 @@ DEFUN (show_ip_multicast_vrf_all, return CMD_SUCCESS; } -static void show_mroute(struct pim_instance *pim, struct vty *vty, u_char uj) +static void show_mroute(struct pim_instance *pim, struct vty *vty, + bool fill, u_char uj) { struct listnode *node; struct channel_oil *c_oil; @@ -4704,11 +4705,9 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty, u_char uj) continue; ifp_out = pim_if_find_by_vif_index(pim, oif_vif_index); - pim_time_uptime( - oif_uptime, sizeof(oif_uptime), - now - - s_route->c_oil - .oif_creation[oif_vif_index]); + pim_time_uptime(oif_uptime, sizeof(oif_uptime), + now - + s_route->c_oil.oif_creation[oif_vif_index]); found_oif = 1; if (ifp_out) @@ -4751,7 +4750,7 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty, u_char uj) src_str, grp_str, proto, in_ifname, out_ifname, ttl, oif_uptime, pim->vrf->name); - if (first) { + if (first && !fill) { src_str[0] = '\0'; grp_str[0] = '\0'; in_ifname[0] = '\0'; @@ -4777,36 +4776,47 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty, u_char uj) DEFUN (show_ip_mroute, show_ip_mroute_cmd, - "show ip mroute [vrf NAME] [json]", + "show ip mroute [vrf NAME] [fill] [json]", SHOW_STR IP_STR MROUTE_STR VRF_CMD_HELP_STR + "Fill in Assumed data\n" JSON_STR) { u_char uj = use_json(argc, argv); + bool fill = false; int idx = 2; struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx); if (!vrf) return CMD_WARNING; - show_mroute(vrf->info, vty, uj); + if (argv_find(argv, argc, "fill", &idx)) + fill = true; + + show_mroute(vrf->info, vty, fill, uj); return CMD_SUCCESS; } DEFUN (show_ip_mroute_vrf_all, show_ip_mroute_vrf_all_cmd, - "show ip mroute vrf all [json]", + "show ip mroute vrf all [fill] [json]", SHOW_STR IP_STR MROUTE_STR VRF_CMD_HELP_STR + "Fill in Assumed data\n" JSON_STR) { u_char uj = use_json(argc, argv); + int idx = 4; struct vrf *vrf; bool first = true; + bool fill = false; + + if (argv_find(argv, argc, "fill", &idx)) + fill = true; if (uj) vty_out(vty, "{ "); @@ -4818,7 +4828,7 @@ DEFUN (show_ip_mroute_vrf_all, first = false; } else vty_out(vty, "VRF: %s\n", vrf->name); - show_mroute(vrf->info, vty, uj); + show_mroute(vrf->info, vty, fill, uj); } if (uj) vty_out(vty, "}\n"); @@ -6462,6 +6472,58 @@ DEFUN (interface_no_ip_pim_sm, return CMD_SUCCESS; } +/* boundaries */ +DEFUN(interface_ip_pim_boundary_oil, + interface_ip_pim_boundary_oil_cmd, + "ip multicast boundary oil WORD", + IP_STR + "Generic multicast configuration options\n" + "Define multicast boundary\n" + "Filter OIL by group using prefix list\n" + "Prefix list to filter OIL with") +{ + VTY_DECLVAR_CONTEXT(interface, iif); + struct pim_interface *pim_ifp; + int idx = 0; + + argv_find(argv, argc, "WORD", &idx); + + PIM_GET_PIM_INTERFACE(pim_ifp, iif); + + if (pim_ifp->boundary_oil_plist) + XFREE(MTYPE_PIM_INTERFACE, pim_ifp->boundary_oil_plist); + + pim_ifp->boundary_oil_plist = + XSTRDUP(MTYPE_PIM_INTERFACE, argv[idx]->arg); + + /* Interface will be pruned from OIL on next Join */ + return CMD_SUCCESS; +} + +DEFUN(interface_no_ip_pim_boundary_oil, + interface_no_ip_pim_boundary_oil_cmd, + "no ip multicast boundary oil [WORD]", + NO_STR + IP_STR + "Generic multicast configuration options\n" + "Define multicast boundary\n" + "Filter OIL by group using prefix list\n" + "Prefix list to filter OIL with") +{ + VTY_DECLVAR_CONTEXT(interface, iif); + struct pim_interface *pim_ifp; + int idx; + + argv_find(argv, argc, "WORD", &idx); + + PIM_GET_PIM_INTERFACE(pim_ifp, iif); + + if (pim_ifp->boundary_oil_plist) + XFREE(MTYPE_PIM_INTERFACE, pim_ifp->boundary_oil_plist); + + return CMD_SUCCESS; +} + DEFUN (interface_ip_mroute, interface_ip_mroute_cmd, "ip mroute INTERFACE A.B.C.D", @@ -8564,6 +8626,8 @@ void pim_cmd_init(void) install_element(INTERFACE_NODE, &interface_no_ip_pim_drprio_cmd); install_element(INTERFACE_NODE, &interface_ip_pim_hello_cmd); install_element(INTERFACE_NODE, &interface_no_ip_pim_hello_cmd); + install_element(INTERFACE_NODE, &interface_ip_pim_boundary_oil_cmd); + install_element(INTERFACE_NODE, &interface_no_ip_pim_boundary_oil_cmd); // Static mroutes NEB install_element(INTERFACE_NODE, &interface_ip_mroute_cmd); |
