On Fri, May 24, 2013 at 10:02:26AM +0200, Linus Lüssing wrote:
With this patch a node which has no bridge interface on top of its soft interface announces its local multicast listeners via the translation table.
Signed-off-by: Linus Lüssing linus.luessing@web.de
Makefile | 2 + Makefile.kbuild | 1 + compat.c | 21 +++++ compat.h | 18 ++++ gen-compat-autoconf.sh | 1 + main.c | 6 ++ main.h | 9 ++ multicast.c | 213 ++++++++++++++++++++++++++++++++++++++++++++++++ multicast.h | 43 ++++++++++ soft-interface.c | 3 + sysfs.c | 6 ++ translation-table.c | 22 ++++- types.h | 12 +++ 13 files changed, 353 insertions(+), 4 deletions(-) create mode 100644 multicast.c create mode 100644 multicast.h
diff --git a/Makefile b/Makefile index 407cdc4..d7c6fa6 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,8 @@ export CONFIG_BATMAN_ADV_BLA=y export CONFIG_BATMAN_ADV_DAT=y # B.A.T.M.A.N network coding (catwoman): export CONFIG_BATMAN_ADV_NC=n +# B.A.T.M.A.N. multicast optimizations: +export CONFIG_BATMAN_ADV_MCAST_OPTIMIZATIONS=y
PWD:=$(shell pwd) KERNELPATH ?= /lib/modules/$(shell uname -r)/build diff --git a/Makefile.kbuild b/Makefile.kbuild index 8ddbfe6..d3efe3a 100644 --- a/Makefile.kbuild +++ b/Makefile.kbuild @@ -38,3 +38,4 @@ batman-adv-y += soft-interface.o batman-adv-y += sysfs.o batman-adv-y += translation-table.o batman-adv-y += unicast.o +batman-adv-$(CONFIG_BATMAN_ADV_MCAST_OPTIMIZATIONS) += multicast.o diff --git a/compat.c b/compat.c index 1f3a39d..27df197 100644 --- a/compat.c +++ b/compat.c @@ -25,6 +25,27 @@ #include <linux/version.h> #include "main.h"
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 38)
+void batadv_for_each_pmc_rcu_init(struct in_device *in_dev,
struct ip_mc_list **pmc)
+{
- read_lock(&in_dev->mc_list_lock);
- *pmc = in_dev->mc_list;
+}
+bool batadv_for_each_pmc_rcu_check(struct in_device *in_dev,
struct ip_mc_list *pmc)
+{
- if (pmc == NULL)
read_unlock(&in_dev->mc_list_lock);
- return (pmc != NULL);
+}
+#endif /* < KERNEL_VERSION(2, 6, 38) */
I guess there is some more compat code required here.
For kernel 2.6.32 I get
compat.h:159:14: warning: ‘struct ip_mc_list’ declared inside parameter list [enabled by default] compat.h:159:14: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default] compat.h:159:14: warning: ‘struct in_device’ declared inside parameter list [enabled by default] compat.h:161:15: warning: ‘struct ip_mc_list’ declared inside parameter list [enabled by default] compat.h:161:15: warning: ‘struct in_device’ declared inside parameter list [enabled by default]
Am I missing config options? These structs are defined in linux/igmp.h though ...
Cheers, Simon