summaryrefslogtreecommitdiff
path: root/pimd/pim_cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'pimd/pim_cmd.c')
-rw-r--r--pimd/pim_cmd.c139
1 files changed, 92 insertions, 47 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 4066614f4b..1ebe9c9aba 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -228,7 +228,7 @@ static void pim_show_assert(struct pim_instance *pim, struct vty *vty)
if (!pim_ifp)
continue;
- RB_FOREACH(ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
+ RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
pim_show_assert_helper(vty, pim_ifp, ch, now);
} /* scan interface channels */
}
@@ -280,7 +280,7 @@ static void pim_show_assert_internal(struct pim_instance *pim, struct vty *vty)
if (!pim_ifp)
continue;
- RB_FOREACH(ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
+ RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
pim_show_assert_internal_helper(vty, pim_ifp, ch);
} /* scan interface channels */
}
@@ -329,7 +329,7 @@ static void pim_show_assert_metric(struct pim_instance *pim, struct vty *vty)
if (!pim_ifp)
continue;
- RB_FOREACH(ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
+ RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
pim_show_assert_metric_helper(vty, pim_ifp, ch);
} /* scan interface channels */
}
@@ -392,7 +392,7 @@ static void pim_show_assert_winner_metric(struct pim_instance *pim,
if (!pim_ifp)
continue;
- RB_FOREACH(ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
+ RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
pim_show_assert_winner_metric_helper(vty, pim_ifp, ch);
} /* scan interface channels */
}
@@ -482,7 +482,7 @@ static void pim_show_membership(struct pim_instance *pim, struct vty *vty,
if (!pim_ifp)
continue;
- RB_FOREACH(ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
+ RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
pim_show_membership_helper(vty, pim_ifp, ch, json);
} /* scan interface channels */
}
@@ -1698,9 +1698,8 @@ static void pim_show_join(struct pim_instance *pim, struct vty *vty, u_char uj)
if (!pim_ifp)
continue;
- RB_FOREACH(ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
- pim_show_join_helper(vty, pim_ifp,
- ch, json, now, uj);
+ RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
+ pim_show_join_helper(vty, pim_ifp, ch, json, now, uj);
} /* scan interface channels */
}
@@ -2528,7 +2527,7 @@ static void pim_show_join_desired(struct pim_instance *pim, struct vty *vty,
continue;
- RB_FOREACH(ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
+ RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
/* scan all interfaces */
pim_show_join_desired_helper(pim, vty,
pim_ifp, ch,
@@ -3161,6 +3160,14 @@ static void clear_interfaces(struct pim_instance *pim)
clear_pim_interfaces(pim);
}
+#define PIM_GET_PIM_INTERFACE(pim_ifp, ifp) \
+ pim_ifp = ifp->info; \
+ if (!pim_ifp) { \
+ vty_out(vty, \
+ "%% Enable PIM and/or IGMP on this interface first\n"); \
+ return CMD_WARNING_CONFIG_FAILED; \
+ }
+
DEFUN (clear_ip_interfaces,
clear_ip_interfaces_cmd,
"clear ip interfaces [vrf NAME]",
@@ -3393,8 +3400,7 @@ DEFUN (show_ip_igmp_interface_vrf_all,
if (uj)
vty_out(vty, "{ ");
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if (uj) {
if (!first)
vty_out(vty, ", ");
@@ -3450,8 +3456,7 @@ DEFUN (show_ip_igmp_join_vrf_all,
if (uj)
vty_out(vty, "{ ");
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if (uj) {
if (!first)
vty_out(vty, ", ");
@@ -3505,8 +3510,7 @@ DEFUN (show_ip_igmp_groups_vrf_all,
if (uj)
vty_out(vty, "{ ");
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if (uj) {
if (!first)
vty_out(vty, ", ");
@@ -3711,8 +3715,7 @@ DEFUN (show_ip_pim_interface_vrf_all,
if (uj)
vty_out(vty, "{ ");
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if (uj) {
if (!first)
vty_out(vty, ", ");
@@ -3771,8 +3774,7 @@ DEFUN (show_ip_pim_join_vrf_all,
if (uj)
vty_out(vty, "{ ");
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if (uj) {
if (!first)
vty_out(vty, ", ");
@@ -3857,8 +3859,7 @@ DEFUN (show_ip_pim_neighbor_vrf_all,
if (uj)
vty_out(vty, "{ ");
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if (uj) {
if (!first)
vty_out(vty, ", ");
@@ -3964,8 +3965,7 @@ DEFUN (show_ip_pim_state_vrf_all,
group = argv[idx + 1]->arg;
}
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if (uj) {
if (!first)
vty_out(vty, ", ");
@@ -4019,8 +4019,7 @@ DEFUN (show_ip_pim_upstream_vrf_all,
if (uj)
vty_out(vty, "{ ");
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if (uj) {
if (!first)
vty_out(vty, ", ");
@@ -4116,8 +4115,7 @@ DEFUN (show_ip_pim_rp_vrf_all,
if (uj)
vty_out(vty, "{ ");
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if (uj) {
if (!first)
vty_out(vty, ", ");
@@ -4171,8 +4169,7 @@ DEFUN (show_ip_pim_rpf_vrf_all,
if (uj)
vty_out(vty, "{ ");
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if (uj) {
if (!first)
vty_out(vty, ", ");
@@ -4438,8 +4435,7 @@ DEFUN (show_ip_multicast_vrf_all,
if (uj)
vty_out(vty, "{ ");
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if (uj) {
if (!first)
vty_out(vty, ", ");
@@ -4814,8 +4810,7 @@ DEFUN (show_ip_mroute_vrf_all,
if (uj)
vty_out(vty, "{ ");
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if (uj) {
if (!first)
vty_out(vty, ", ");
@@ -4918,8 +4913,7 @@ DEFUN (show_ip_mroute_count_vrf_all,
if (uj)
vty_out(vty, "{ ");
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if (uj) {
if (!first)
vty_out(vty, ", ");
@@ -5074,7 +5068,7 @@ static int pim_rp_cmd_worker(struct pim_instance *pim, struct vty *vty,
}
if (result == PIM_GROUP_OVERLAP) {
- vty_out(vty, "%% Group range specified cannot overlap\n");
+ vty_out(vty, "%% Group range specified cannot exact match another\n");
return CMD_WARNING_CONFIG_FAILED;
}
@@ -6468,6 +6462,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",
@@ -6488,7 +6534,7 @@ DEFUN (interface_ip_mroute,
struct in_addr src_addr;
int result;
- pim_ifp = iif->info;
+ PIM_GET_PIM_INTERFACE(pim_ifp, iif);
pim = pim_ifp->pim;
oifname = argv[idx_interface]->arg;
@@ -6539,7 +6585,7 @@ DEFUN (interface_ip_mroute_source,
struct in_addr src_addr;
int result;
- pim_ifp = iif->info;
+ PIM_GET_PIM_INTERFACE(pim_ifp, iif);
pim = pim_ifp->pim;
oifname = argv[idx_interface]->arg;
@@ -6594,7 +6640,7 @@ DEFUN (interface_no_ip_mroute,
struct in_addr src_addr;
int result;
- pim_ifp = iif->info;
+ PIM_GET_PIM_INTERFACE(pim_ifp, iif);
pim = pim_ifp->pim;
oifname = argv[idx_interface]->arg;
@@ -6646,7 +6692,7 @@ DEFUN (interface_no_ip_mroute_source,
struct in_addr src_addr;
int result;
- pim_ifp = iif->info;
+ PIM_GET_PIM_INTERFACE(pim_ifp, iif);
pim = pim_ifp->pim;
oifname = argv[idx_interface]->arg;
@@ -7854,8 +7900,7 @@ DEFUN (show_ip_msdp_mesh_group_vrf_all,
if (uj)
vty_out(vty, "{ ");
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if (uj) {
if (!first)
vty_out(vty, ", ");
@@ -8083,8 +8128,7 @@ DEFUN (show_ip_msdp_peer_detail_vrf_all,
if (uj)
vty_out(vty, "{ ");
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if (uj) {
if (!first)
vty_out(vty, ", ");
@@ -8313,8 +8357,7 @@ DEFUN (show_ip_msdp_sa_detail_vrf_all,
if (uj)
vty_out(vty, "{ ");
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if (uj) {
if (!first)
vty_out(vty, ", ");
@@ -8450,7 +8493,7 @@ DEFUN (show_ip_msdp_sa_sg_vrf_all,
if (uj)
vty_out(vty, "{ ");
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if (uj) {
if (!first)
vty_out(vty, ", ");
@@ -8573,6 +8616,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);