+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* PIM for Quagga: add the ability to configure multicast static routes
* Copyright (C) 2014 Nathan Bahr, ATCorp
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <zebra.h>
}
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,
/* 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;
}
}