]> git.puffer.fish Git - matthieu/frr.git/commitdiff
pimd: fix static mroute to also take into account the input interface
authorJafar Al-Gharaibeh <jafar@atcorp.com>
Thu, 28 Jul 2022 20:38:50 +0000 (15:38 -0500)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Fri, 5 Aug 2022 02:04:49 +0000 (02:04 +0000)
Allow the same group/source route to be configured on more than one interface.
Currently FRR doesn't allow adding the same mroute on different input interfaces.

Current behavior, if we have the following config:

```
interface eth1
   ip mroute eth0 239.0.0.1

interface eth2
   ip mroute eth0 239.0.0.1
```

Only one multicast route will be installed with an input interface of the last
interface configured.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
(cherry picked from commit 90937e420c9a02f61dfb43ce426b573186b2e591)

pimd/pim_static.c

index 581b855f924246543bdcb6b30f453f95a65dd4b6..f5449d28242094d2ba955b813bb206feb2318e66 100644 (file)
@@ -97,10 +97,11 @@ int pim_static_add(struct pim_instance *pim, struct interface *iif,
        }
 
        for (ALL_LIST_ELEMENTS_RO(pim->static_routes, node, s_route)) {
-               if (!pim_addr_cmp(s_route->group, group)
-                   && !pim_addr_cmp(s_route->source, source)) {
-                       if (s_route->iif == iif_index
-                           && s_route->oif_ttls[oif_index]) {
+               if (!pim_addr_cmp(s_route->group, group) &&
+                   !pim_addr_cmp(s_route->source, source) &&
+                   (s_route->iif == iif_index)) {
+
+                       if (s_route->oif_ttls[oif_index]) {
                                zlog_warn(
                                        "%s %s: Unable to add static route: Route already exists (iif=%d,oif=%d,group=%pPAs,source=%pPAs)",
                                        __FILE__, __func__, iif_index,
@@ -122,42 +123,11 @@ int pim_static_add(struct pim_instance *pim, struct interface *iif,
 
                        /* Route exists and has the same input interface, but
                         * adding a new output interface */
-                       if (s_route->iif == iif_index) {
-                               s_route->oif_ttls[oif_index] = 1;
-                               oil_if_set(&s_route->c_oil, oif_index, 1);
-                               s_route->c_oil.oif_creation[oif_index] =
-                                       pim_time_monotonic_sec();
-                               ++s_route->c_oil.oil_ref_count;
-                       } else {
-                               /* input interface changed */
-                               s_route->iif = iif_index;
-                               pim_static_mroute_iif_update(
-                                       &s_route->c_oil, iif_index, __func__);
-
-#ifdef PIM_ENFORCE_LOOPFREE_MFC
-                               /* check to make sure the new input was not an
-                                * old output */
-                               if (s_route->oif_ttls[iif_index]) {
-                                       s_route->oif_ttls[iif_index] = 0;
-                                       s_route->c_oil.oif_creation[iif_index] =
-                                               0;
-                                       oil_if_set(&s_route->c_oil, iif_index,
-                                                  0);
-                                       --s_route->c_oil.oil_ref_count;
-                               }
-#endif
-
-                               /* now add the new output, if it is new */
-                               if (!s_route->oif_ttls[oif_index]) {
-                                       s_route->oif_ttls[oif_index] = 1;
-                                       s_route->c_oil.oif_creation[oif_index] =
-                                               pim_time_monotonic_sec();
-                                       oil_if_set(&s_route->c_oil, oif_index,
-                                                  1);
-                                       ++s_route->c_oil.oil_ref_count;
-                               }
-                       }
-
+                       s_route->oif_ttls[oif_index] = 1;
+                       oil_if_set(&s_route->c_oil, oif_index, 1);
+                       s_route->c_oil.oif_creation[oif_index] =
+                               pim_time_monotonic_sec();
+                       ++s_route->c_oil.oil_ref_count;
                        break;
                }
        }