summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfigure.ac45
-rw-r--r--pimd/pim_iface.c24
-rw-r--r--pimd/pim_mroute.c9
3 files changed, 57 insertions, 21 deletions
diff --git a/configure.ac b/configure.ac
index 6f07f10cd..50918227e 100755
--- a/configure.ac
+++ b/configure.ac
@@ -996,11 +996,46 @@ dnl figure out how to specify an interface in multicast sockets API
dnl ---------------------------------------------------------------
AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [], [], QUAGGA_INCLUDES)
-AC_CHECK_HEADERS([linux/mroute.h], [], [],
-[
-#if HAVE_NETINET_IN_H
-#include<netinet/in.h>
-#endif])
+AC_CHECK_HEADERS([linux/mroute.h], [], [],[
+ #ifdef HAVE_SYS_SOCKET_H
+ # include <sys/socket.h>
+ #endif
+ #ifdef HAVE_NETINET_IN_H
+ # include <netinet/in.h>
+ #endif
+ #define _LINUX_IN_H /* For Linux <= 2.6.25 */
+ #include <linux/types.h>
+])
+
+m4_define([QUAGGA_INCLUDES],
+QUAGGA_INCLUDES
+[#if HAVE_LINUX_MROUTE_H
+# include <linux/mroute.h>
+#endif
+])dnl
+
+AC_CHECK_HEADERS([netinet/ip_mroute.h], [], [],[
+ #ifdef HAVE_SYS_SOCKET_H
+ # include <sys/socket.h>
+ #endif
+ #ifdef HAVE_SYS_TYPES_H
+ # include <sys/types.h>
+ #endif
+ #ifdef HAVE_NETINET_IN_H
+ # include <netinet/in.h>
+ #endif
+ #ifdef HAVE_NET_ROUTE_H
+ # include <net/route.h>
+ #endif
+])
+
+m4_define([QUAGGA_INCLUDES],
+QUAGGA_INCLUDES
+[#if HAVE_NETINET_IP_MROUTE_H
+# include <netinet/ip_mroute.h>
+#endif
+])dnl
+
AC_MSG_CHECKING([for BSD struct ip_mreq hack])
AC_TRY_COMPILE([#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
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;