[B.A.T.M.A.N.] [PATCH] batman-adv: add biggest_unsigned_int(x) macro
by Antonio Quartulli
in case of dynamic type variable, it could be needed to compute at compile time
its maximal value. This macro helps in doing that for unsigned integer types
Signed-off-by: Antonio Quartulli <ordex(a)autistici.org>
---
main.h | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/main.h b/main.h
index 464439f..3c58235 100644
--- a/main.h
+++ b/main.h
@@ -210,6 +210,9 @@ static inline int compare_eth(const void *data1, const void *data2)
/* Returns the smallest signed integer in two's complement with the sizeof x */
#define smallest_signed_int(x) (1u << (7u + 8u * (sizeof(x) - 1u)))
+/* Returns the biggest unsigned integer with the sizeof x */
+#define biggest_unsigned_int(x) (~(x)0)
+
/* Checks if a sequence number x is a predecessor/successor of y.
* they handle overflows/underflows and can correctly check for a
* predecessor/successor unless the variable sequence number has grown by
--
1.7.3.4
10 years, 12 months
Re: [B.A.T.M.A.N.] HowTo Test Bla2
by Clemens John
On Mittwoch, 28. Dezember 2011 03:07:38 you wrote:
> Sry for the delay, but we were busy rebasing and fixing the blaII code.
> There are also some other meetings we are currently attending.
Thats no problem. We are very glad that you guys do this work and try to help
us.
> But to make it short: The code is automatically built (you correctly saw
> the CONFIG_BATMAN_ADV_BLA=y), but you have to enable it through the new
> sysfs file "bridge_loop_avoidance" or the batctl option.
Sadly we are still some steps away from enabling it on the device. I searched
for the sysfs file and while I did this I figured out, that the patch I created
was not apllied because patches for batman-adv need to have the string
"batman" in their file name. So I renamed it and now it gets apllied but: now I
get the compile error again I descriped already in my previos email. Here is
the pastebin link from the actual compile error: http://pastebin.com/iJy2u7Ff
Maybe you can take a look at it and find our mistake?
This is the patch we use:
http://trac.freifunk-ol.de/browser/firmware/Trunk/build_patches/bla2/0001-
batman-adv-bla2.patch
I made no other changes to the default files that are shipped with the latest
OpenWrt release.
Regards
Clemens
11 years, 1 month
[B.A.T.M.A.N.] [PATCH] batctl: Update copyright years
by Sven Eckelmann
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
Makefile | 2 +-
allocate.h | 2 +-
bat-hosts.c | 2 +-
bat-hosts.h | 2 +-
bisect.c | 2 +-
bisect.h | 2 +-
debug.c | 2 +-
debug.h | 2 +-
functions.c | 2 +-
functions.h | 2 +-
hash.c | 2 +-
hash.h | 2 +-
list-batman.c | 2 +-
list-batman.h | 2 +-
main.c | 2 +-
main.h | 2 +-
packet.h | 2 +-
ping.c | 2 +-
ping.h | 2 +-
sys.c | 2 +-
sys.h | 2 +-
tcpdump.c | 2 +-
tcpdump.h | 2 +-
traceroute.c | 2 +-
traceroute.h | 2 +-
vis.c | 2 +-
vis.h | 2 +-
27 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/Makefile b/Makefile
index 85efc30..c85dbaa 100755
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
#!/usr/bin/make -f
# -*- makefile -*-
#
-# Copyright (C) 2006-2011 B.A.T.M.A.N. contributors
+# Copyright (C) 2006-2012 B.A.T.M.A.N. contributors
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
diff --git a/allocate.h b/allocate.h
index 1fe6730..751380f 100644
--- a/allocate.h
+++ b/allocate.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2011 B.A.T.M.A.N. contributors:
+ * Copyright (C) 2009-2012 B.A.T.M.A.N. contributors:
*
* Marek Lindner <lindner_marek(a)yahoo.de>
*
diff --git a/bat-hosts.c b/bat-hosts.c
index 179e733..ad49618 100644
--- a/bat-hosts.c
+++ b/bat-hosts.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors:
+ * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
*
* Andreas Langer <an.langer(a)gmx.de>, Marek Lindner <lindner_marek(a)yahoo.de>
*
diff --git a/bat-hosts.h b/bat-hosts.h
index ba265bb..519862f 100644
--- a/bat-hosts.h
+++ b/bat-hosts.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2011 B.A.T.M.A.N. contributors:
+ * Copyright (C) 2009-2012 B.A.T.M.A.N. contributors:
*
* Marek Lindner <lindner_marek(a)yahoo.de>
*
diff --git a/bisect.c b/bisect.c
index d3789aa..b505b1a 100644
--- a/bisect.c
+++ b/bisect.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2011 B.A.T.M.A.N. contributors:
+ * Copyright (C) 2009-2012 B.A.T.M.A.N. contributors:
*
* Marek Lindner <lindner_marek(a)yahoo.de>
*
diff --git a/bisect.h b/bisect.h
index 4423608..7c43708 100644
--- a/bisect.h
+++ b/bisect.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2011 B.A.T.M.A.N. contributors:
+ * Copyright (C) 2009-2012 B.A.T.M.A.N. contributors:
*
* Marek Lindner <lindner_marek(a)yahoo.de>
*
diff --git a/debug.c b/debug.c
index 480e4a5..6a553ff 100644
--- a/debug.c
+++ b/debug.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2011 B.A.T.M.A.N. contributors:
+ * Copyright (C) 2009-2012 B.A.T.M.A.N. contributors:
*
* Marek Lindner <lindner_marek(a)yahoo.de>
*
diff --git a/debug.h b/debug.h
index b1648f3..939f281 100644
--- a/debug.h
+++ b/debug.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2011 B.A.T.M.A.N. contributors:
+ * Copyright (C) 2009-2012 B.A.T.M.A.N. contributors:
*
* Marek Lindner <lindner_marek(a)yahoo.de>
*
diff --git a/functions.c b/functions.c
index c2c0529..0729f15 100644
--- a/functions.c
+++ b/functions.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors:
+ * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
*
* Andreas Langer <an.langer(a)gmx.de>, Marek Lindner <lindner_marek(a)yahoo.de>
*
diff --git a/functions.h b/functions.h
index 7e9f68c..ea953dd 100644
--- a/functions.h
+++ b/functions.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors:
+ * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
*
* Andreas Langer <an.langer(a)gmx.de>, Marek Lindner <lindner_marek(a)yahoo.de>
*
diff --git a/hash.c b/hash.c
index e8c822f..2a9f557 100644
--- a/hash.c
+++ b/hash.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2011 B.A.T.M.A.N. contributors:
+ * Copyright (C) 2006-2012 B.A.T.M.A.N. contributors:
*
* Simon Wunderlich, Marek Lindner
*
diff --git a/hash.h b/hash.h
index 443ef28..91ee7d8 100644
--- a/hash.h
+++ b/hash.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2011 B.A.T.M.A.N. contributors:
+ * Copyright (C) 2006-2012 B.A.T.M.A.N. contributors:
*
* Simon Wunderlich, Marek Lindner
*
diff --git a/list-batman.c b/list-batman.c
index 356c1eb..a0c2ad8 100644
--- a/list-batman.c
+++ b/list-batman.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2011 B.A.T.M.A.N. contributors:
+ * Copyright (C) 2006-2012 B.A.T.M.A.N. contributors:
*
* Marek Lindner
*
diff --git a/list-batman.h b/list-batman.h
index 72d2ac4..ebff97c 100644
--- a/list-batman.h
+++ b/list-batman.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2011 B.A.T.M.A.N. contributors:
+ * Copyright (C) 2006-2012 B.A.T.M.A.N. contributors:
*
* Marek Lindner
*
diff --git a/main.c b/main.c
index 7f6d1a3..0dfdb8e 100644
--- a/main.c
+++ b/main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors:
+ * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
*
* Andreas Langer <an.langer(a)gmx.de>, Marek Lindner <lindner_marek(a)yahoo.de>
*
diff --git a/main.h b/main.h
index e5a3e01..2b231cb 100644
--- a/main.h
+++ b/main.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors:
+ * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
*
* Andreas Langer <an.langer(a)gmx.de>, Marek Lindner <lindner_marek(a)yahoo.de>
*
diff --git a/packet.h b/packet.h
index 4d9e54c..bac156a 100644
--- a/packet.h
+++ b/packet.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors:
+ * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
*
* Marek Lindner, Simon Wunderlich
*
diff --git a/ping.c b/ping.c
index 91b733a..d04672e 100644
--- a/ping.c
+++ b/ping.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors:
+ * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
*
* Andreas Langer <an.langer(a)gmx.de>, Marek Lindner <lindner_marek(a)yahoo.de>
*
diff --git a/ping.h b/ping.h
index ccc717a..e3f47fc 100644
--- a/ping.h
+++ b/ping.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2011 B.A.T.M.A.N. contributors:
+ * Copyright (C) 2009-2012 B.A.T.M.A.N. contributors:
*
* Marek Lindner <lindner_marek(a)yahoo.de>
*
diff --git a/sys.c b/sys.c
index 105bb51..9cdccba 100644
--- a/sys.c
+++ b/sys.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2011 B.A.T.M.A.N. contributors:
+ * Copyright (C) 2009-2012 B.A.T.M.A.N. contributors:
*
* Marek Lindner <lindner_marek(a)yahoo.de>
*
diff --git a/sys.h b/sys.h
index 2df846c..5dafe85 100644
--- a/sys.h
+++ b/sys.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2011 B.A.T.M.A.N. contributors:
+ * Copyright (C) 2009-2012 B.A.T.M.A.N. contributors:
*
* Marek Lindner <lindner_marek(a)yahoo.de>
*
diff --git a/tcpdump.c b/tcpdump.c
index 7dd289e..5e8574c 100644
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors:
+ * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
*
* Andreas Langer <an.langer(a)gmx.de>
*
diff --git a/tcpdump.h b/tcpdump.h
index 925b116..2a2cc0a 100644
--- a/tcpdump.h
+++ b/tcpdump.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors:
+ * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
*
* Andreas Langer <an.langer(a)gmx.de>, Marek Lindner <lindner_marek(a)yahoo.de>
*
diff --git a/traceroute.c b/traceroute.c
index d120311..02f0ecd 100644
--- a/traceroute.c
+++ b/traceroute.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors:
+ * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
*
* Andreas Langer <an.langer(a)gmx.de>, Marek Lindner <lindner_marek(a)yahoo.de>
*
diff --git a/traceroute.h b/traceroute.h
index 31edb7e..e78609f 100644
--- a/traceroute.h
+++ b/traceroute.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2011 B.A.T.M.A.N. contributors:
+ * Copyright (C) 2009-2012 B.A.T.M.A.N. contributors:
*
* Marek Lindner <lindner_marek(a)yahoo.de>
*
diff --git a/vis.c b/vis.c
index 1a8d181..b040497 100644
--- a/vis.c
+++ b/vis.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2011 B.A.T.M.A.N. contributors:
+ * Copyright (C) 2009-2012 B.A.T.M.A.N. contributors:
*
* Andrew Lunn <andrew(a)lunn.ch>
*
diff --git a/vis.h b/vis.h
index 8d6cfcd..77c6669 100644
--- a/vis.h
+++ b/vis.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2011 B.A.T.M.A.N. contributors:
+ * Copyright (C) 2009-2012 B.A.T.M.A.N. contributors:
*
* Andrew Lunn <andrew(a)lunn.ch>
*
--
1.7.7.3
11 years, 1 month
[B.A.T.M.A.N.] [PATCH 1/3] batmand: Remove unmaintained *BSD port
by Sven Eckelmann
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
INSTALL | 9 +-
Makefile | 18 ----
bsd/compat.c | 53 -------------
bsd/kernel.c | 145 ----------------------------------
bsd/route.c | 224 ----------------------------------------------------
bsd/tun.c | 239 --------------------------------------------------------
list-batman.h | 7 --
posix/tunnel.c | 15 ----
8 files changed, 4 insertions(+), 706 deletions(-)
delete mode 100644 bsd/compat.c
delete mode 100644 bsd/kernel.c
delete mode 100644 bsd/route.c
delete mode 100644 bsd/tun.c
diff --git a/INSTALL b/INSTALL
index 41566ab..15f53b0 100644
--- a/INSTALL
+++ b/INSTALL
@@ -13,12 +13,11 @@ You need the usual compile environment and the libpthread-library
and the kernel module "tun". Both should already be installed on
your machine, if you use a PC with Linux. On embedded devices
both may not be installed in order to save space. GNU Make is needed
-for compilation (currently BSD Make is not cooperating).
+for compilation.
-The *BSD and Mac OS operating systems are currently unmaintained,
-make targets are still available but will most probably not work.
-If you're interested in porting and maintaining B.A.T.M.A.N. for
-these systems, please contact us. We would appreciate your help.
+The ports to *BSD and Mac OS operating systems are currently not
+available. If you're interested in porting and maintaining B.A.T.M.A.N.
+for these systems, please contact us. We would appreciate your help.
Tweaking
--------
diff --git a/Makefile b/Makefile
index 65e0cf2..9aafbc8 100755
--- a/Makefile
+++ b/Makefile
@@ -23,30 +23,12 @@ BINARY_NAME = batmand
UNAME = $(shell uname)
POSIX_OBJ = posix/init.o posix/posix.o posix/tunnel.o posix/unix_socket.o
-BSD_OBJ = bsd/route.o bsd/tun.o bsd/kernel.o bsd/compat.o
LINUX_OBJ = linux/route.o linux/tun.o linux/kernel.o
ifeq ($(UNAME),Linux)
OS_OBJ = $(LINUX_OBJ) $(POSIX_OBJ)
endif
-ifeq ($(UNAME),Darwin)
-OS_OBJ = $(BSD_OBJ) $(POSIX_OBJ)
-endif
-
-ifeq ($(UNAME),GNU/kFreeBSD)
-OS_OBJ = $(BSD_OBJ) $(POSIX_OBJ)
-LDLIBS += -lfreebsd -lbsd
-endif
-
-ifeq ($(UNAME),FreeBSD)
-OS_OBJ = $(BSD_OBJ) $(POSIX_OBJ)
-endif
-
-ifeq ($(UNAME),OpenBSD)
-OS_OBJ = $(BSD_OBJ) $(POSIX_OBJ)
-endif
-
OBJ = batman.o originator.o schedule.o list-batman.o allocate.o bitarray.o hash.o profile.o ring_buffer.o hna.o $(OS_OBJ)
MANPAGE = man/batmand.8
diff --git a/bsd/compat.c b/bsd/compat.c
deleted file mode 100644
index a628378..0000000
--- a/bsd/compat.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2006, 2007 BATMAN contributors:
- * Stefan Sperling <stsp(a)stsp.name>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
- *
- */
-
-/* This file contains functions that are used by batman but are not
- * present in BSD libc. */
-
-#warning BSD support is known broken - if you compile this on BSD you are expected to fix it :-P
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdarg.h>
-
-/* Adapted from busybox */
-int vdprintf(int d, const char *format, va_list ap)
-{
- char buf[1024];
- int len;
-
- len = vsnprintf(buf, sizeof(buf), format, ap);
- return write(d, buf, len);
-}
-
-/* From glibc */
-int dprintf(int d, const char *format, ...)
-{
- va_list arg;
- int done;
-
- va_start (arg, format);
- done = vdprintf (d, format, arg);
- va_end (arg);
-
- return done;
-}
-
diff --git a/bsd/kernel.c b/bsd/kernel.c
deleted file mode 100644
index b98c06f..0000000
--- a/bsd/kernel.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (C) 2006, 2007 BATMAN contributors:
- * Stefan Sperling <stsp(a)stsp.name>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
- *
- */
-
-/* This file contains functions that deal with BSD kernel interfaces,
- * such as sysctls. */
-
-#warning BSD support is known broken - if you compile this on BSD you are expected to fix it :-P
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/sysctl.h>
-#include <sys/socket.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <errno.h>
-#include <err.h>
-
-#include "../os.h"
-#include "../batman.h"
-
-void set_forwarding(int32_t state)
-{
- int mib[4];
-
- /* FreeBSD allows us to set a boolean sysctl to anything.
- * Check the value for sanity. */
- if (state < 0 || state > 1) {
- errno = EINVAL;
- err(1, "set_forwarding: %i", state);
- }
-
- /* "net.inet.ip.forwarding" */
- mib[0] = CTL_NET;
- mib[1] = PF_INET;
- mib[2] = IPPROTO_IP;
- mib[3] = IPCTL_FORWARDING;
-
- if (sysctl(mib, 4, NULL, 0, (void*)&state, sizeof(state)) == -1)
- err(1, "Cannot change net.inet.ip.forwarding");
-}
-
-int32_t get_forwarding(void)
-{
- int state;
- size_t len;
- int mib[4];
-
- /* "net.inet.ip.forwarding" */
- mib[0] = CTL_NET;
- mib[1] = PF_INET;
- mib[2] = IPPROTO_IP;
- mib[3] = IPCTL_FORWARDING;
-
- len = sizeof(state);
-
- if (sysctl(mib, 4, &state, &len, NULL, 0) == -1)
- err(1, "Cannot tell if packet forwarding is enabled");
-
- return state;
-}
-
-void set_send_redirects(int32_t state, char* BATMANUNUSED(dev))
-{
- int mib[4];
-
- /* FreeBSD allows us to set a boolean sysctl to anything.
- * Check the value for sanity. */
- if (state < 0 || state > 1) {
- errno = EINVAL;
- err(1, "set_send_redirects: %i", state);
- }
-
- /* "net.inet.ip.redirect" */
- mib[0] = CTL_NET;
- mib[1] = PF_INET;
- mib[2] = IPPROTO_IP;
- mib[3] = IPCTL_SENDREDIRECTS;
-
- if (sysctl(mib, 4, NULL, 0, (void*)&state, sizeof(state)) == -1)
- err(1, "Cannot change net.inet.ip.redirect");
-}
-
-int32_t get_send_redirects(char *BATMANUNUSED(dev))
-{
- int state;
- size_t len;
- int mib[4];
-
- /* "net.inet.ip.redirect" */
- mib[0] = CTL_NET;
- mib[1] = PF_INET;
- mib[2] = IPPROTO_IP;
- mib[3] = IPCTL_SENDREDIRECTS;
-
- len = sizeof(state);
-
- if (sysctl(mib, 4, &state, &len, NULL, 0) == -1)
- err(1, "Cannot tell if redirects are enabled");
-
- return state;
-}
-
-void set_rp_filter( int32_t BATMANUNUSED(state), char* BATMANUNUSED(dev) )
-{
- /* On BSD, reverse path filtering should be disabled in the firewall. */
- return;
-}
-
-int32_t get_rp_filter( char *BATMANUNUSED(dev) )
-{
- /* On BSD, reverse path filtering should be disabled in the firewall. */
- return 0;
-}
-
-
-int8_t bind_to_iface( int32_t BATMANUNUSED(udp_recv_sock), char *BATMANUNUSED(dev) )
-{
- /* XXX: Is binding a socket to a specific
- * interface possible in *BSD?
- * Possibly via bpf... */
- return 1;
-}
-
-int32_t use_gateway_module(void)
-{
- return -1;
-}
-
diff --git a/bsd/route.c b/bsd/route.c
deleted file mode 100644
index 8c9de48..0000000
--- a/bsd/route.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Copyright (C) 2006, 2007 BATMAN contributors:
- * Stefan Sperling <stsp(a)stsp.name>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
- *
- */
-
-/* This file contains interface functions for the routing table on BSD. */
-
-#warning BSD support is known broken - if you compile this on BSD you are expected to fix it :-P
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <net/route.h>
-#include <net/if.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <err.h>
-
-#include "../os.h"
-#include "../batman.h"
-
-/* Message structure used to interface the kernel routing table.
- * See route(4) for details on the message passing interface for
- * manipulating the kernel routing table.
- */
-struct rt_msg
-{
- struct rt_msghdr hdr;
- struct sockaddr_in dest;
- struct sockaddr_in gateway;
- struct sockaddr_in netmask;
-};
-
-static inline int32_t n_bits(uint8_t n)
-{
- int32_t i, result;
-
- result = 0;
-
- if (n > 32)
- n = 32;
- for (i = 0; i < n; i++)
- result |= (0x80000000 >> i);
-
- return result;
-}
-
-/* Send routing message msg to the kernel.
- * The kernel's reply is returned in msg. */
-static int rt_message(struct rt_msg *msg)
-{
- int rt_sock;
- static unsigned int seq = 0;
- ssize_t len;
- pid_t pid;
-
- rt_sock = socket(PF_ROUTE, SOCK_RAW, AF_INET);
- if (rt_sock < 0)
- err(1, "Could not open socket to routing table");
-
- pid = getpid();
- len = 0;
- seq++;
-
- /* Send message */
- do {
- msg->hdr.rtm_seq = seq;
- len = write(rt_sock, msg, msg->hdr.rtm_msglen);
- if (len < 0) {
- warn("Error sending routing message to kernel");
- return -1;
- }
- } while (len < msg->hdr.rtm_msglen);
-
- /* Get reply */
- do {
- len = read(rt_sock, msg, sizeof(struct rt_msg));
- if (len < 0)
- err(1, "Error reading from routing socket");
- } while (len > 0 && (msg->hdr.rtm_seq != seq
- || msg->hdr.rtm_pid != pid));
-
- if (msg->hdr.rtm_version != RTM_VERSION)
- warn("RTM_VERSION mismatch: compiled with version %i, "
- "but running kernel uses version %i", RTM_VERSION,
- msg->hdr.rtm_version);
-
- /* Check reply for errors. */
- if (msg->hdr.rtm_errno) {
- errno = msg->hdr.rtm_errno;
- return -1;
- }
-
- return 0;
-}
-
-/* Get IP address of a network device (e.g. "tun0"). */
-static uint32_t get_dev_addr(char *dev)
-{
- int so;
- struct ifreq ifr;
- struct sockaddr_in *addr;
-
- memset(&ifr, 0, sizeof(ifr));
-
- strlcpy(ifr.ifr_name, dev, IFNAMSIZ);
-
- so = socket(AF_INET, SOCK_DGRAM, 0);
- if (ioctl(so, SIOCGIFADDR, &ifr, sizeof(ifr)) < 0) {
- perror("SIOCGIFADDR");
- return -1;
- }
-
- if (ifr.ifr_addr.sa_family != AF_INET) {
- warn("get_dev_addr: got a non-IPv4 interface");
- return -1;
- }
-
- addr = (struct sockaddr_in*)&ifr.ifr_addr;
- return addr->sin_addr.s_addr;
-}
-
-void add_del_route(uint32_t dest, uint8_t netmask, uint32_t router, uint32_t BATMANUNUSED(src_ip),
- int32_t BATMANUNUSED(ifi), char *dev, uint8_t BATMANUNUSED(rt_table), int8_t BATMANUNUSED(route_type), int8_t del)
-{
- char dest_str[16], router_str[16];
- struct rt_msg msg;
-
- memset(&msg, 0, sizeof(struct rt_msg));
-
- inet_ntop(AF_INET, &dest, dest_str, sizeof (dest_str));
- inet_ntop(AF_INET, &router, router_str, sizeof (router_str));
-
- /* Message header */
- msg.hdr.rtm_type = del ? RTM_DELETE : RTM_ADD;
- msg.hdr.rtm_version = RTM_VERSION;
- msg.hdr.rtm_flags = RTF_STATIC | RTF_UP;
- if (netmask == 32)
- msg.hdr.rtm_flags |= RTF_HOST;
- msg.hdr.rtm_addrs = RTA_DST | RTA_GATEWAY | RTA_NETMASK;
- msg.hdr.rtm_msglen = sizeof(struct rt_msg);
-
- /* Destination and gateway sockaddrs */
- msg.dest.sin_family = AF_INET;
- msg.dest.sin_len = sizeof(struct sockaddr_in);
- msg.gateway.sin_family = AF_INET;
- msg.gateway.sin_len = sizeof(struct sockaddr_in);
- msg.hdr.rtm_flags = RTF_GATEWAY;
- if (dest == router) {
- if (dest == 0) {
- /* Add default route via dev */
- fprintf(stderr, "%s default route via %s\n",
- del ? "Deleting" : "Adding", dev);
- msg.gateway.sin_addr.s_addr = get_dev_addr(dev);
- } else {
- /* Route to dest via default route.
- * This is a nop. */
- return;
- }
- } else {
- if (router != 0) {
- /* Add route to dest via router */
- msg.dest.sin_addr.s_addr = dest;
- msg.gateway.sin_addr.s_addr = router;
- fprintf(stderr, "%s route to %s/%i via %s\n", del ? "Deleting" : "Adding",
- dest_str, netmask, router_str);
- } else {
- /* Route to dest via default route.
- * This is a nop. */
- return;
- }
- }
-
- /* Netmask sockaddr */
- msg.netmask.sin_family = AF_INET;
- msg.netmask.sin_len = sizeof(struct sockaddr_in);
- /* Netmask is passed as decimal value (e.g. 28 for a /28).
- * So we need to convert it into a bit pattern with n_bits(). */
- msg.netmask.sin_addr.s_addr = htonl(n_bits(netmask));
-
- if (rt_message(&msg) < 0)
- err(1, "Cannot %s route to %s/%i",
- del ? "delete" : "add", dest_str, netmask);
-}
-
-
-void add_del_rule(uint32_t BATMANUNUSED(network), uint8_t BATMANUNUSED(netmask), int8_t BATMANUNUSED(rt_table),
- uint32_t BATMANUNUSED(prio), char *BATMANUNUSED(iif), int8_t BATMANUNUSED(dst_rule), int8_t BATMANUNUSED(del) )
-{
- fprintf(stderr, "add_del_rule: not implemented\n");
- return;
-}
-
-int add_del_interface_rules( int8_t BATMANUNUSED(del) )
-{
- fprintf(stderr, "add_del_interface_rules: not implemented\n");
- return 0;
-}
-
-int flush_routes_rules( int8_t BATMANUNUSED(rt_table) )
-{
- fprintf(stderr, "flush_routes_rules: not implemented\n");
- return 0;
-}
-
diff --git a/bsd/tun.c b/bsd/tun.c
deleted file mode 100644
index 2c571c0..0000000
--- a/bsd/tun.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Copyright (C) 2006, 2007 BATMAN contributors:
- * Stefan Sperling <stsp(a)stsp.name>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
- *
- */
-
-/* This file contains functions interfacing tun devices on BSD. */
-
-#warning BSD support is known broken - if you compile this on BSD you are expected to fix it :-P
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <net/if.h>
-#include <net/if_tun.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <err.h>
-
-#include "../os.h"
-#include "../batman.h"
-
-
-/*
- * open_tun_any() opens an available tun device.
- * It returns the file descriptor as return value,
- * or -1 on failure.
- *
- * The human readable name of the device (e.g. "/dev/tun0") is
- * copied into the dev_name parameter. The buffer to hold
- * this string is assumed to be dev_name_size bytes large.
- */
-#if defined(__OpenBSD__) || defined(__Darwin__)
-static int open_tun_any(char *dev_name, size_t dev_name_size)
-{
- int i;
- int fd;
- char tun_dev_name[12]; /* 12 = length("/dev/tunxxx\0") */
-
- for (i = 0; i < sizeof(tun_dev_name); i++)
- tun_dev_name[i] = '\0';
-
- /* Try opening tun device /dev/tun[0..255] */
- for (i = 0; i < 256; i++) {
- snprintf(tun_dev_name, sizeof(tun_dev_name), "/dev/tun%i", i);
- if ((fd = open(tun_dev_name, O_RDWR)) != -1) {
- if (dev_name != NULL)
- strlcpy(dev_name, tun_dev_name, dev_name_size);
- return fd;
- }
- }
- return -1;
-}
-#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
-static int open_tun_any(char *dev_name, size_t dev_name_size)
-{
- int fd;
- struct stat buf;
-
- /* Open lowest unused tun device */
- if ((fd = open("/dev/tun", O_RDWR)) != -1) {
- fstat(fd, &buf);
- printf("Using %s\n", devname(buf.st_rdev, S_IFCHR));
- if (dev_name != NULL)
- strlcpy(dev_name, devname(buf.st_rdev, S_IFCHR), dev_name_size);
- return fd;
- }
- return -1;
-}
-#endif
-
-/* Probe for nat tool availability */
-int probe_nat_tool(void) {
- fprintf(stderr, "probe_nat_tool: not implemented\n");
- return -1;
-}
-
-void add_nat_rule(char *BATMANUNUSED(dev)) {
- fprintf(stderr, "add_nat_rule: not implemented\n");
-}
-
-void del_nat_rule(char *BATMANUNUSED(dev)) {
- fprintf(stderr, "del_nat_rule: not implemented\n");
-}
-
-void own_hna_rules(uint32_t hna_ip, uint8_t netmask, int8_t route_action) {
- fprintf(stderr, "own_hna_rules: not implemented\n");
-}
-
-/* Probe for tun interface availability */
-int8_t probe_tun(uint8_t BATMANUNUSED(print_to_stderr))
-{
- int fd;
- fd = open_tun_any(NULL, 0);
- if (fd == -1)
- return 0;
- close(fd);
- return 1;
-}
-
-int8_t del_dev_tun(int32_t fd)
-{
- return close(fd);
-}
-
-int8_t set_tun_addr(int32_t BATMANUNUSED(fd), uint32_t tun_addr, char *tun_ifname)
-{
- int so;
- struct ifreq ifr_tun;
- struct sockaddr_in *addr;
-
- memset(&ifr_tun, 0, sizeof(ifr_tun));
- strlcpy(ifr_tun.ifr_name, tun_ifname, IFNAMSIZ);
-
- so = socket(AF_INET, SOCK_DGRAM, 0);
-
- /* Get interface flags */
- if (ioctl(so, SIOCGIFFLAGS, &ifr_tun) < 0) {
- perror("SIOCGIFFLAGS");
- return -1;
- }
-
- /* Set address */
- addr = (struct sockaddr_in*)&ifr_tun.ifr_addr;
- addr->sin_family = AF_INET;
- addr->sin_addr.s_addr = tun_addr;
- if (ioctl(so, SIOCAIFADDR, &ifr_tun) < 0) {
- perror("SIOCAIFADDR");
- return -1;
- }
- close(so);
-
- return 0;
-}
-
-int8_t add_dev_tun(struct batman_if *batman_if, uint32_t tun_addr,
- char *tun_dev, size_t tun_dev_size, int32_t *fd, int32_t *BATMANUNUSED(ifi))
-{
- int so;
- struct ifreq ifr_tun, ifr_if;
- struct tuninfo ti;
- char *tun_ifname;
-
- memset(&ifr_tun, 0, sizeof(ifr_tun));
- memset(&ifr_if, 0, sizeof(ifr_if));
- memset(&ti, 0, sizeof(ti));
-
- if ((*fd = open_tun_any(tun_dev, tun_dev_size)) < 0) {
- perror("Could not open tun device");
- return -1;
- }
-
- printf("Using %s\n", tun_dev);
-
- /* Initialise tuninfo to defaults. */
- if (ioctl(*fd, TUNGIFINFO, &ti) < 0) {
- perror("TUNGIFINFO");
- del_dev_tun(*fd);
- return -1;
- }
-
- /* Set name of interface to configure ("tunX") */
- tun_ifname = strstr(tun_dev, "tun");
- if (tun_ifname == NULL) {
- warn("Cannot determine tun interface name!");
- return -1;
- }
- strlcpy(ifr_tun.ifr_name, tun_ifname, IFNAMSIZ);
-
- /* Open temporary socket to configure tun interface. */
- so = socket(AF_INET, SOCK_DGRAM, 0);
-
- /* Get interface flags for tun device */
- if (ioctl(so, SIOCGIFFLAGS, &ifr_tun) < 0) {
- perror("SIOCGIFFLAGS");
- del_dev_tun(*fd);
- return -1;
- }
-
- /* Set up and running interface flags on tun device. */
- ifr_tun.ifr_flags |= IFF_UP;
- ifr_tun.ifr_flags |= IFF_RUNNING;
- if (ioctl(so, SIOCSIFFLAGS, &ifr_tun) < 0) {
- perror("SIOCSIFFLAGS");
- del_dev_tun(*fd);
- return -1;
- }
-
- /* Set IP of this end point of tunnel */
- if (set_tun_addr(*fd, tun_addr, tun_ifname) < 0) {
- perror("set_tun_addr");
- del_dev_tun(*fd);
- return -1;
- }
-
- /* get MTU from real interface */
- strlcpy(ifr_if.ifr_name, batman_if->dev, IFNAMSIZ);
- if (ioctl(so, SIOCGIFMTU, &ifr_if) < 0) {
- perror("SIOCGIFMTU");
- del_dev_tun(*fd);
- return -1;
- }
- /* set MTU of tun interface: real MTU - 28 */
- if (ifr_if.ifr_mtu < 100) {
- fprintf(stderr, "Warning: MTU smaller than 100 - cannot reduce MTU anymore\n" );
- } else {
- ti.mtu = ifr_if.ifr_mtu - 28;
- if (ioctl(*fd, TUNSIFINFO, &ti) < 0) {
- perror("TUNSIFINFO");
- del_dev_tun(*fd);
- return -1;
- }
- }
-
- strlcpy(tun_dev, ifr_tun.ifr_name, tun_dev_size);
- close(so);
- return 1;
-}
-
diff --git a/list-batman.h b/list-batman.h
index 72d2ac4..7780c9a 100644
--- a/list-batman.h
+++ b/list-batman.h
@@ -26,13 +26,6 @@
#define _LINUX_LIST_H
/*
- * XXX: Resolve conflict between this file and <sys/queue.h> on BSD systems.
- */
-#ifdef LIST_HEAD
-#undef LIST_HEAD
-#endif
-
-/*
* Simple linked list implementation.
*
* Some of the internal functions ("__xxx") are useful when
diff --git a/posix/tunnel.c b/posix/tunnel.c
index 1cfb501..cbbdea1 100644
--- a/posix/tunnel.c
+++ b/posix/tunnel.c
@@ -32,9 +32,6 @@
#include <netinet/ip.h>
#include <netinet/udp.h>
#include <netinet/tcp.h>
-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__Darwin__)
-#include <sys/sockio.h>
-#endif
#include <net/if.h>
#include <fcntl.h> /* open(), O_RDWR */
@@ -71,29 +68,17 @@ void init_bh_ports(void)
static uint8_t get_tunneled_protocol(const unsigned char *buff)
{
-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__Darwin__)
- return ((struct ip *)(buff + 1))->ip_p;
-#else
return ((struct iphdr *)(buff + 1))->protocol;
-#endif
}
static uint32_t get_tunneled_sender_ip(const unsigned char *buff)
{
-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__Darwin__)
- return ((struct ip *)(buff + 1))->ip_src;
-#else
return ((struct iphdr *)(buff + 1))->saddr;
-#endif
}
static uint16_t get_tunneled_udpdest(const unsigned char *buff)
{
-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__Darwin__)
- return ((struct udphdr *)(buff + 1 + ((struct ip *)(buff + 1))->ip_hl*4))->uh_dport;
-#else
return ((struct udphdr *)(buff + 1 + ((struct iphdr *)(buff + 1))->ihl*4))->dest;
-#endif
}
static int8_t get_tun_ip(struct sockaddr_in *gw_addr, int32_t udp_sock, uint32_t *tun_addr)
--
1.7.7.3
11 years, 1 month
[B.A.T.M.A.N.] HowTo Test Bla2
by Clemens John
Hi,
I want to test the Bridge loop avoidance II with our OpenWrt Freifunk
firmware. Is there a version that works and can be tested? Which git repo do I
have to use and what are the main steps to compile it into openwrt?
Regards
Clemens
11 years, 1 month
[B.A.T.M.A.N.] [PATCH] batman-adv: convert all times to miliseconds
by Simon Wunderlich
has_timed_out() takes the second argument in miliseconds. The commit
"batman-adv: convert time_after instances to has_timed_out" introduced
some bugs by confusing seconds and miliseconds.
This patch converts all timeouts to miliseconds to be consistent, and
also fixes the previously introduced bugs.
Signed-off-by: Simon Wunderlich <siwu(a)hrz.tu-chemnitz.de>
---
gateway_client.c | 2 +-
main.h | 13 +++++++------
translation-table.c | 15 ++++++---------
vis.h | 3 ++-
4 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/gateway_client.c b/gateway_client.c
index 24403a7..df5631e 100644
--- a/gateway_client.c
+++ b/gateway_client.c
@@ -396,7 +396,7 @@ void gw_node_purge(struct bat_priv *bat_priv)
{
struct gw_node *gw_node, *curr_gw;
struct hlist_node *node, *node_tmp;
- unsigned long timeout = 2 * PURGE_TIMEOUT * HZ;
+ unsigned long timeout = msecs_to_jiffies(2 * PURGE_TIMEOUT);
int do_deselect = 0;
curr_gw = gw_get_selected_gw_node(bat_priv);
diff --git a/main.h b/main.h
index 222c120..d124c28 100644
--- a/main.h
+++ b/main.h
@@ -41,13 +41,14 @@
/* purge originators after time in seconds if no valid packet comes in
* -> TODO: check influence on TQ_LOCAL_WINDOW_SIZE */
-#define PURGE_TIMEOUT 200
-#define TT_LOCAL_TIMEOUT 3600 /* in seconds */
-#define TT_CLIENT_ROAM_TIMEOUT 600
+#define PURGE_TIMEOUT 200000 /* 200 seconds */
+#define TT_LOCAL_TIMEOUT 3600000 /* in miliseconds */
+#define TT_CLIENT_ROAM_TIMEOUT 600000 /* in miliseconds */
/* sliding packet range of received originator messages in sequence numbers
* (should be a multiple of our word size) */
#define TQ_LOCAL_WINDOW_SIZE 64
-#define TT_REQUEST_TIMEOUT 3 /* seconds we have to keep pending tt_req */
+#define TT_REQUEST_TIMEOUT 3000 /* miliseconds we have to keep
+ * pending tt_req */
#define TQ_GLOBAL_WINDOW_SIZE 5
#define TQ_LOCAL_BIDRECT_SEND_MINIMUM 1
@@ -56,8 +57,8 @@
#define TT_OGM_APPEND_MAX 3 /* number of OGMs sent with the last tt diff */
-#define ROAMING_MAX_TIME 20 /* Time in which a client can roam at most
- * ROAMING_MAX_COUNT times */
+#define ROAMING_MAX_TIME 20000 /* Time in which a client can roam at most
+ * ROAMING_MAX_COUNT times in miliseconds*/
#define ROAMING_MAX_COUNT 5
#define NO_FLAGS 0
diff --git a/translation-table.c b/translation-table.c
index a1be7ef..9fe38c1 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -413,7 +413,7 @@ static void tt_local_purge(struct bat_priv *bat_priv)
continue;
if (!has_timed_out(tt_local_entry->last_seen,
- TT_LOCAL_TIMEOUT * 1000))
+ TT_LOCAL_TIMEOUT))
continue;
tt_local_set_pending(bat_priv, tt_local_entry,
@@ -753,7 +753,7 @@ static void tt_global_roam_purge(struct bat_priv *bat_priv)
if (!(tt_global_entry->common.flags & TT_CLIENT_ROAM))
continue;
if (!has_timed_out(tt_global_entry->roam_at,
- TT_CLIENT_ROAM_TIMEOUT * 1000))
+ TT_CLIENT_ROAM_TIMEOUT))
continue;
bat_dbg(DBG_TT, bat_priv, "Deleting global "
@@ -972,8 +972,7 @@ static void tt_req_purge(struct bat_priv *bat_priv)
spin_lock_bh(&bat_priv->tt_req_list_lock);
list_for_each_entry_safe(node, safe, &bat_priv->tt_req_list, list) {
- if (has_timed_out(node->issued_at,
- TT_REQUEST_TIMEOUT * 1000)) {
+ if (has_timed_out(node->issued_at, TT_REQUEST_TIMEOUT)) {
list_del(&node->list);
kfree(node);
}
@@ -992,7 +991,7 @@ static struct tt_req_node *new_tt_req_node(struct bat_priv *bat_priv,
list_for_each_entry(tt_req_node_tmp, &bat_priv->tt_req_list, list) {
if (compare_eth(tt_req_node_tmp, orig_node) &&
!has_timed_out(tt_req_node_tmp->issued_at,
- TT_REQUEST_TIMEOUT * 1000))
+ TT_REQUEST_TIMEOUT))
goto unlock;
}
@@ -1585,8 +1584,7 @@ static void tt_roam_purge(struct bat_priv *bat_priv)
spin_lock_bh(&bat_priv->tt_roam_list_lock);
list_for_each_entry_safe(node, safe, &bat_priv->tt_roam_list, list) {
- if (!has_timed_out(node->first_time,
- ROAMING_MAX_TIME * 1000))
+ if (!has_timed_out(node->first_time, ROAMING_MAX_TIME))
continue;
list_del(&node->list);
@@ -1613,8 +1611,7 @@ static bool tt_check_roam_count(struct bat_priv *bat_priv,
if (!compare_eth(tt_roam_node->addr, client))
continue;
- if (has_timed_out(tt_roam_node->first_time,
- ROAMING_MAX_TIME * 1000))
+ if (has_timed_out(tt_roam_node->first_time, ROAMING_MAX_TIME))
continue;
if (!atomic_dec_not_zero(&tt_roam_node->counter))
diff --git a/vis.h b/vis.h
index 31b820d..851bc4f 100644
--- a/vis.h
+++ b/vis.h
@@ -22,7 +22,8 @@
#ifndef _NET_BATMAN_ADV_VIS_H_
#define _NET_BATMAN_ADV_VIS_H_
-#define VIS_TIMEOUT 200 /* timeout of vis packets in seconds */
+#define VIS_TIMEOUT 200000 /* timeout of vis packets
+ * in miliseconds */
int vis_seq_print_text(struct seq_file *seq, void *offset);
void receive_server_sync_packet(struct bat_priv *bat_priv,
--
1.7.7.3
11 years, 1 month
[B.A.T.M.A.N.] [PATCHv2 00/10] bridge loop avoidance II
by Simon Wunderlich
This series of patches contains the changes for the redesigned
bridge loop avoidance. The general concept is described in the wiki
[1]. I've already performed a few testcases [2] which worked fine in
my kvm environment. No crashes while running or unloading the
extension either.
This is the third version of the patchset, rebased on the master and
including the changes according to reviews on the mailing list and
personal discussions. Also a few things were fixed:
* turn blaII off by default - must be explicitly turned on
* two rcu lock bugs (one found/fixed by Sven)
* replace time_after with has_timed_out
* fix the bla compile option
* integrate patches and rebase on master (mostly done by Sven, thanks!)
* fix alignment
* fix psk_may_pull bug
Sven also roughly reviewed the code, so we hope its ready for integration
now. ;)
Cheers,
Simon
The git repositories can be found on git.open-mesh.org:
* blaII_dirty branch [3] has all the patches in development order
* blaII branch [4] contains the patches squashed as sent the ml
* blaII branch in batctl [5] contains the batctl changes
Cheers,
Simon
[1] http://www.open-mesh.org/wiki/batman-adv/Bridge-loop-avoidance-II
[2] http://www.open-mesh.org/wiki/batman-adv/Bridge-loop-avoidance-Testcases
[3] http://git.open-mesh.org/?p=simon/batman-adv.git;a=shortlog;h=refs/heads/...
[4] http://git.open-mesh.org/?p=simon/batman-adv.git;a=shortlog;h=refs/heads/...
[5] http://git.open-mesh.org/?p=simon/batctl.git;a=shortlog;h=refs/heads/blaII
Simon Wunderlich (10):
batman-adv: remove old bridge loop avoidance code
batman-adv: add basic bridge loop avoidance code
batman-adv: make bridge loop avoidance switchable
batman-adv: export claim tables through debugfs
batman-adv: allow multiple entries in tt_global_entries
batman-adv: don't let backbone gateways exchange tt entries
batman-adv: add broadcast duplicate check
batman-adv: drop STP over batman
batman-adv: form groups in the bridge loop avoidance
batman-adv: add bridge loop avoidance compile option
Makefile | 2 +
Makefile.kbuild | 1 +
README | 19 +-
README.external | 1 +
bat_debugfs.c | 23 +-
bat_sysfs.c | 8 +-
bridge_loop_avoidance.c | 1594 +++++++++++++++++++++++++++++++++++++++++++++++
bridge_loop_avoidance.h | 55 ++
compat.c | 16 +-
compat.h | 3 +-
gen-compat-autoconf.sh | 1 +
hard-interface.c | 18 +-
main.c | 9 +-
main.h | 9 +-
originator.c | 3 +-
packet.h | 16 +
routing.c | 16 +
soft-interface.c | 490 +--------------
soft-interface.h | 2 -
sysfs-class-net-mesh | 9 +
translation-table.c | 335 +++++++---
types.h | 67 ++-
22 files changed, 2063 insertions(+), 634 deletions(-)
create mode 100644 bridge_loop_avoidance.c
create mode 100644 bridge_loop_avoidance.h
--
1.7.7.3
11 years, 1 month
[B.A.T.M.A.N.] [PATCH 00/11] bridge loop avoidance II
by Simon Wunderlich
This series of patches contains the changes for the redesigned
bridge loop avoidance. The general concept is described in the wiki
[1]. I've already performed a few testcases [2] which worked fine in
my kvm environment. No crashes while running or unloading the
extension either.
This is the second version of the patchset, rebased on the master and
including the changes according to reviews on the mailing list.
The git repositories can be found on git.open-mesh.org:
* blaII_dirty branch [3] has all the patches in development order
* blaII branch [4] contains the patches squashed as sent the ml
* blaII branch in batctl [5] contains the batctl changes
Cheers,
Simon
[1] http://www.open-mesh.org/wiki/batman-adv/Bridge-loop-avoidance-II
[2] http://www.open-mesh.org/wiki/batman-adv/Bridge-loop-avoidance-Testcases
[3] http://git.open-mesh.org/?p=simon/batman-adv.git;a=shortlog;h=refs/heads/...
[4] http://git.open-mesh.org/?p=simon/batman-adv.git;a=shortlog;h=refs/heads/...
[5] http://git.open-mesh.org/?p=simon/batctl.git;a=shortlog;h=refs/heads/blaII
---
The main changes to the previous version ([RFC]) are:
* rebase on latest master
* make bla sparse clean
* check for hash_add()
* check bla_get_backbone_gw()
* shorten announce_mac[]
* always use ETH_ALEN
* fix debug message
* don't change comment in batman_skb_recv()
* split choose_claim/choose_backbone_gw
* remove primary_if/own_orig address caching
* fix forgotten backbone_gw_free_ref() and error checking
* return 1 (handled) when there was an error in handle_claim()
* unify bla_free() with the purge_* functions
* call purge when (re)starting with a new primary interface
* add compile option for bla
Simon Wunderlich (11):
batman-adv: remove old bridge loop avoidance code
batman-adv: add basic bridge loop avoidance code
batman-adv: make bridge loop avoidance switchable
batman-adv: export claim tables through debugfs
batman-adv: allow multiple entries in tt_global_entries
batman-adv: don't let backbone gateways exchange tt entries
batman-adv: add broadcast duplicate check
batman-adv: drop STP over batman
batman-adv: form groups in the bridge loop avoidance
batman-adv: Update README and sysfs description
batman-adv: add bridge loop avoidance compile option
Makefile.kbuild | 2 +
README | 28 +-
bat_debugfs.c | 23 +-
bat_sysfs.c | 8 +-
bridge_loop_avoidance.c | 1592 +++++++++++++++++++++++++++++++++++++++++++++++
bridge_loop_avoidance.h | 49 ++
compat.c | 16 +-
compat.h | 3 +-
hard-interface.c | 18 +-
main.c | 9 +-
main.h | 9 +-
originator.c | 3 +-
packet.h | 16 +
routing.c | 16 +
soft-interface.c | 490 +--------------
soft-interface.h | 2 -
sysfs-class-net-mesh | 9 +
translation-table.c | 354 ++++++++---
types.h | 67 ++-
19 files changed, 2071 insertions(+), 643 deletions(-)
create mode 100644 bridge_loop_avoidance.c
create mode 100644 bridge_loop_avoidance.h
--
1.7.7.1
11 years, 1 month
[B.A.T.M.A.N.] [PATCH] batman-adv: Fix compilation with linux 2.6.29 and 2.6.30
by Sven Eckelmann
Linux v2.6.30-2332-gfddd520 introduced a seventh parameter to
__module_param_call. It is used to give a slightly different user experience
for bool parameters. Older kernels can just drop this information using a
special compat wrapper for __module_param_call.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
compat.h | 23 +++++++++++++++++++----
1 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/compat.h b/compat.h
index 3733f68..eb7ab50 100644
--- a/compat.h
+++ b/compat.h
@@ -56,6 +56,20 @@
#endif /* < KERNEL_VERSION(2, 6, 34) */
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)
+
+#define __compat__module_param_call(p1, p2, p3, p4, p5, p6, p7) \
+ __module_param_call(p1, p2, p3, p4, p5, p7)
+
+#else
+
+#define __compat__module_param_call(p1, p2, p3, p4, p5, p6, p7) \
+ __module_param_call(p1, p2, p3, p4, p5, p6, p7)
+
+#endif /* < KERNEL_VERSION(2, 6, 31) */
+
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36)
#define __rcu
@@ -77,10 +91,10 @@ struct kernel_param_ops {
static int __compat_get_param_##name(char *buffer, \
struct kernel_param *kp) \
{ return (ops)->get(buffer, kp); } \
- __module_param_call(MODULE_PARAM_PREFIX, name, \
- __compat_set_param_##name, \
- __compat_get_param_##name, arg, \
- __same_type((arg), bool *), perm)
+ __compat__module_param_call(MODULE_PARAM_PREFIX, name, \
+ __compat_set_param_##name, \
+ __compat_get_param_##name, arg, \
+ __same_type((arg), bool *), perm)
static inline int __param_set_copystring(const char *val,
const struct kernel_param *kp)
@@ -91,6 +105,7 @@ static inline int __param_set_copystring(const char *val,
#endif /* < KERNEL_VERSION(2, 6, 36) */
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
#define kstrtoul strict_strtoul
--
1.7.7.3
11 years, 1 month