summaryrefslogtreecommitdiff
path: root/pimd/pim_cmd.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2020-03-23 11:28:45 -0400
committerGitHub <noreply@github.com>2020-03-23 11:28:45 -0400
commita01f317b0fafd5ab3ea2a874a6e6889fa7bd1d28 (patch)
tree88284e0235adc9bf428cfc48cd81e3714a883060 /pimd/pim_cmd.c
parent6ced257f012e5a87d0dce7e5f2b4a8f05838c093 (diff)
parentccf696e85ff182fa01a9f92bc17506b6ef1e5910 (diff)
Merge pull request #6008 from sarav511/max_vif
pimd: Do not allow to configure multicast on more than MAXVIF interfaces
Diffstat (limited to 'pimd/pim_cmd.c')
-rw-r--r--pimd/pim_cmd.c75
1 files changed, 53 insertions, 22 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 8bfad8ee27..30208deb14 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -7289,11 +7289,20 @@ DEFUN (no_ip_pim_ecmp_rebalance,
static int pim_cmd_igmp_start(struct vty *vty, struct interface *ifp)
{
struct pim_interface *pim_ifp;
+ struct pim_instance *pim;
uint8_t need_startup = 0;
pim_ifp = ifp->info;
if (!pim_ifp) {
+ pim = pim_get_pim_instance(ifp->vrf_id);
+ /* Limit mcast interfaces to number of vifs available */
+ if (pim->mcast_if_count == MAXVIFS) {
+ vty_out(vty,
+ "Max multicast interfaces(%d) Reached. Could not enable IGMP on interface %s\n",
+ MAXVIFS, ifp->name);
+ return CMD_WARNING_CONFIG_FAILED;
+ }
(void)pim_if_new(ifp, true, false, false, false);
need_startup = 1;
} else {
@@ -8043,13 +8052,21 @@ DEFPY_HIDDEN (interface_ip_igmp_query_generate,
return CMD_SUCCESS;
}
-static int pim_cmd_interface_add(struct interface *ifp)
+static int pim_cmd_interface_add(struct vty *vty, struct interface *ifp)
{
struct pim_interface *pim_ifp = ifp->info;
+ struct pim_instance *pim;
- if (!pim_ifp)
+ if (!pim_ifp) {
+ pim = pim_get_pim_instance(ifp->vrf_id);
+ /* Limiting mcast interfaces to number of VIFs */
+ if (pim->mcast_if_count == MAXVIFS) {
+ vty_out(vty, "Max multicast interfaces(%d) reached.",
+ MAXVIFS);
+ return 0;
+ }
pim_ifp = pim_if_new(ifp, false, true, false, false);
- else
+ } else
PIM_IF_DO_PIM(pim_ifp->options);
pim_if_addr_add_all(ifp);
@@ -8120,15 +8137,17 @@ DEFPY (interface_ip_pim_activeactive,
VTY_DECLVAR_CONTEXT(interface, ifp);
struct pim_interface *pim_ifp;
- if (!no && !pim_cmd_interface_add(ifp)) {
- vty_out(vty, "Could not enable PIM SM active-active on interface\n");
+ if (!no && !pim_cmd_interface_add(vty, ifp)) {
+ vty_out(vty,
+ "Could not enable PIM SM active-active on interface %s\n",
+ ifp->name);
return CMD_WARNING_CONFIG_FAILED;
}
- if (PIM_DEBUG_MLAG)
- zlog_debug("%sConfiguring PIM active-active on Interface: %s",
- no ? "Un-":" ", ifp->name);
+ if (PIM_DEBUG_MLAG)
+ zlog_debug("%sConfiguring PIM active-active on Interface: %s",
+ no ? "Un-" : " ", ifp->name);
pim_ifp = ifp->info;
if (no)
@@ -8148,8 +8167,9 @@ DEFUN_HIDDEN (interface_ip_pim_ssm,
{
VTY_DECLVAR_CONTEXT(interface, ifp);
- if (!pim_cmd_interface_add(ifp)) {
- vty_out(vty, "Could not enable PIM SM on interface\n");
+ if (!pim_cmd_interface_add(vty, ifp)) {
+ vty_out(vty, "Could not enable PIM SM on interface %s\n",
+ ifp->name);
return CMD_WARNING_CONFIG_FAILED;
}
@@ -8165,8 +8185,9 @@ static int interface_ip_pim_helper(struct vty *vty)
VTY_DECLVAR_CONTEXT(interface, ifp);
- if (!pim_cmd_interface_add(ifp)) {
- vty_out(vty, "Could not enable PIM SM on interface\n");
+ if (!pim_cmd_interface_add(vty, ifp)) {
+ vty_out(vty, "Could not enable PIM SM on interface %s\n",
+ ifp->name);
return CMD_WARNING_CONFIG_FAILED;
}
@@ -8454,8 +8475,10 @@ DEFUN (interface_ip_pim_hello,
struct pim_interface *pim_ifp = ifp->info;
if (!pim_ifp) {
- if (!pim_cmd_interface_add(ifp)) {
- vty_out(vty, "Could not enable PIM SM on interface\n");
+ if (!pim_cmd_interface_add(vty, ifp)) {
+ vty_out(vty,
+ "Could not enable PIM SM on interface %s\n",
+ ifp->name);
return CMD_WARNING_CONFIG_FAILED;
}
}
@@ -9197,8 +9220,10 @@ DEFUN (ip_pim_bfd,
struct bfd_info *bfd_info = NULL;
if (!pim_ifp) {
- if (!pim_cmd_interface_add(ifp)) {
- vty_out(vty, "Could not enable PIM SM on interface\n");
+ if (!pim_cmd_interface_add(vty, ifp)) {
+ vty_out(vty,
+ "Could not enable PIM SM on interface %s\n",
+ ifp->name);
return CMD_WARNING;
}
}
@@ -9248,8 +9273,10 @@ DEFUN (ip_pim_bsm,
struct pim_interface *pim_ifp = ifp->info;
if (!pim_ifp) {
- if (!pim_cmd_interface_add(ifp)) {
- vty_out(vty, "Could not enable PIM SM on interface\n");
+ if (!pim_cmd_interface_add(vty, ifp)) {
+ vty_out(vty,
+ "Could not enable PIM SM on interface %s\n",
+ ifp->name);
return CMD_WARNING;
}
}
@@ -9292,8 +9319,10 @@ DEFUN (ip_pim_ucast_bsm,
struct pim_interface *pim_ifp = ifp->info;
if (!pim_ifp) {
- if (!pim_cmd_interface_add(ifp)) {
- vty_out(vty, "Could not enable PIM SM on interface\n");
+ if (!pim_cmd_interface_add(vty, ifp)) {
+ vty_out(vty,
+ "Could not enable PIM SM on interface %s\n",
+ ifp->name);
return CMD_WARNING;
}
}
@@ -9360,8 +9389,10 @@ DEFUN(
struct pim_interface *pim_ifp = ifp->info;
if (!pim_ifp) {
- if (!pim_cmd_interface_add(ifp)) {
- vty_out(vty, "Could not enable PIM SM on interface\n");
+ if (!pim_cmd_interface_add(vty, ifp)) {
+ vty_out(vty,
+ "Could not enable PIM SM on interface %s\n",
+ ifp->name);
return CMD_WARNING;
}
}