summaryrefslogtreecommitdiffstats
path: root/pimd
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2016-08-04 15:07:30 +0200
committerDonald Sharp <sharpd@cumulusnetwroks.com>2016-08-08 03:05:26 +0200
commitb3f2bf7cbe92b1ee6942f68038f17a3329c61f06 (patch)
treebf43821b84fa65934d89c27704e3c5117c679cb2 /pimd
parentbgpd: fix wrong use of IN6_IS_ADDR_LINKLOCAL (diff)
downloadfrr-b3f2bf7cbe92b1ee6942f68038f17a3329c61f06.tar.xz
frr-b3f2bf7cbe92b1ee6942f68038f17a3329c61f06.zip
pimd: add a workaround for *BSD
VIFF_USE_IFINDEX is not available on BSDs and other UNIX systems. In order to build pimd on these platforms, use 'vifc_lcl_addr' instead of 'vifc_lcl_ifindex' to specify the interfaces we want to enable forwarding of multicast traffic. In the case of unnumbered interfaces, print an error and return. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'pimd')
-rw-r--r--pimd/pim_iface.c24
-rw-r--r--pimd/pim_mroute.c9
2 files changed, 17 insertions, 16 deletions
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c
index 14c8c7262..3c6027502 100644
--- a/pimd/pim_iface.c
+++ b/pimd/pim_iface.c
@@ -41,19 +41,6 @@
#include "pim_time.h"
#include "pim_ssmpingd.h"
-#ifndef VIFF_USE_IFINDEX
-# ifdef linux
-/* make it work compile-time - whether it works runtime depends on the user
- * having 2.6.32 or newer */
-# define VIFF_USE_IFINDEX 0x8
-# else
-# error no VIFF_USE_IFINDEX on this system, code needs porting
-/* NB: without VIFF_USE_IFINDEX, the local IP address is used to identify
- * interfaces, which means it's impossible to support multiple interfaces that
- * have the same or no IP address (e.g. unnumbered) */
-# endif
-#endif
-
struct interface *pim_regiface = NULL;
static void pim_if_igmp_join_del_all(struct interface *ifp);
@@ -645,7 +632,7 @@ int pim_if_add_vif(struct interface *ifp)
{
struct pim_interface *pim_ifp = ifp->info;
struct in_addr ifaddr;
- unsigned char flags;
+ unsigned char flags = 0;
zassert(pim_ifp);
@@ -681,8 +668,13 @@ int pim_if_add_vif(struct interface *ifp)
return -3;
}
- flags = (ifp->ifindex == PIM_OIF_PIM_REGISTER_VIF) ?
- VIFF_REGISTER : VIFF_USE_IFINDEX;
+ if (ifp->ifindex == PIM_OIF_PIM_REGISTER_VIF)
+ flags = VIFF_REGISTER;
+#ifdef VIFF_USE_IFINDEX
+ else
+ flags = VIFF_USE_IFINDEX;
+#endif
+
if (pim_mroute_add_vif(ifp, ifaddr, flags)) {
/* pim_mroute_add_vif reported error */
return -5;
diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c
index ab3742438..56f49d62f 100644
--- a/pimd/pim_mroute.c
+++ b/pimd/pim_mroute.c
@@ -501,7 +501,16 @@ int pim_mroute_add_vif(struct interface *ifp, struct in_addr ifaddr, unsigned ch
memset(&vc, 0, sizeof(vc));
vc.vifc_vifi = pim_ifp->mroute_vif_index;
+#ifdef VIFF_USE_IFINDEX
vc.vifc_lcl_ifindex = ifp->ifindex;
+#else
+ if (ifaddr.s_addr == INADDR_ANY) {
+ zlog_warn("%s: unnumbered interfaces are not supported on this platform",
+ __PRETTY_FUNCTION__);
+ return -1;
+ }
+ memcpy(&vc.vifc_lcl_addr, &ifaddr, sizeof(vc.vifc_lcl_addr));
+#endif
vc.vifc_flags = flags;
vc.vifc_threshold = PIM_MROUTE_MIN_TTL;
vc.vifc_rate_limit = 0;