From b0c3b36ecc1525a28b3e62ae579206efbd594013 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Sun, 28 Sep 2014 18:19:02 +0200 Subject: [PATCH] Fix issue #5: Conditionalize Linux anachronism The IPv6 multicast routing proc setting does not exist outside Linux, conditionalize it using #ifdef __linux__ (compiler built-in define). Signed-off-by: Joachim Nilsson --- src/mroute-api.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mroute-api.c b/src/mroute-api.c index bfc18554..297dc67e 100644 --- a/src/mroute-api.c +++ b/src/mroute-api.c @@ -400,6 +400,7 @@ int mroute4_del(mroute4_t *route) } #ifdef HAVE_IPV6_MULTICAST_ROUTING +#ifdef __linux__ #define IPV6_ALL_MC_FORWARD "/proc/sys/net/ipv6/conf/all/mc_forwarding" static int proc_set_val(char *file, int val) @@ -417,6 +418,7 @@ static int proc_set_val(char *file, int val) return result; } +#endif /* Linux only */ #endif /* HAVE_IPV6_MULTICAST_ROUTING */ /** @@ -463,13 +465,14 @@ int mroute6_enable(void) /* Initialize virtual interface table */ memset(&mif_list, 0, sizeof(mif_list)); +#ifdef __linux__ /* On Linux pre 2.6.29 kernels net.ipv6.conf.all.mc_forwarding * is not set on MRT6_INIT so we have to do this manually */ if (proc_set_val(IPV6_ALL_MC_FORWARD, 1)) { if (errno != EACCES) smclog(LOG_ERR, errno, "Failed enabling IPv6 multicast forwarding"); } - +#endif /* Create virtual interfaces, IPv6 MIFs, for all non-loopback interfaces */ for (i = 0; (iface = iface_find_by_index(i)); i++) { if (iface->flags & IFF_LOOPBACK) {