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
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/bl…
[4] http://git.open-mesh.org/?p=simon/batman-adv.git;a=shortlog;h=refs/heads/bl…
[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
Hi folks,
after the previous discussions how to proceed with BATMAN V we came to the
conclusion that a runtime switch for changing the routing algorithms would be
the best solution. Hence, I drafted a couple of patches that I'd like to get
some feedback on. Note, that these patches are not ready to be included. For
instance, the rcu locking isn't clean.
I'd like to focus your attention towards the following items:
* How do we design the algorithm registration. At the moment batman_init()
calls bat_iv_init() and possibly other algorithms in the future but this is
less than ideal. I had hoped to find a mechanism which allows an init function
to be declared and called inside of the respective routing algorithm files.
These files can be compiled into the module or not.
* The API and its implementation. It is highly likely that this API won't
survive for very long as it has been designed to satisfy one routing algorithm
only. However, changing it in the future should be easy.
* Other ideas / comments ?
Cheers,
Marek
Hi David,
the following 10 patches constitute the first batch I'd like to get the pulled
into net-next-2.6/3.3. They're mostly uncritical fixes around the recently
introduced tt code, some code refactoring, the kstrto update and the range
check fix reported by Thomas Jarosch.
Thanks,
Marek
The following changes since commit 1ea6b8f48918282bdca0b32a34095504ee65bab5:
Linux 3.2-rc1 (2011-11-07 16:16:02 -0800)
are available in the git repository at:
git://git.open-mesh.org/linux-merge.git for_david
Antonio Quartulli (5):
batman-adv: tt_global_del_orig() has to print the correct message
batman-adv: use orig_hash_find() instead of get_orig_node() in TT code
batman-adv: fixed hash functions type to uint32_t instead of int
batman-adv: linearise the tt_response skb only if needed
batman-adv: check for tt_reponse packet real length
Marek Lindner (1):
batman-adv: refactoring gateway handling code
Simon Wunderlich (2):
batman-adv: directly write tt entries without buffering
batman-adv: Fix range check for expected packets
Sven Eckelmann (2):
batman-adv: update internal version number
batman-adv: Replace obsolete strict_strto<foo> with kstrto<foo>
net/batman-adv/bat_sysfs.c | 4 +-
net/batman-adv/bitarray.c | 2 +-
net/batman-adv/gateway_client.c | 153 ++++++++++++++++++++++--------------
net/batman-adv/gateway_client.h | 5 +-
net/batman-adv/gateway_common.c | 4 +-
net/batman-adv/hash.c | 4 +-
net/batman-adv/hash.h | 13 ++--
net/batman-adv/main.h | 2 +-
net/batman-adv/originator.c | 13 ++-
net/batman-adv/originator.h | 2 +-
net/batman-adv/routing.c | 22 ++++--
net/batman-adv/soft-interface.c | 43 +++++++---
net/batman-adv/translation-table.c | 100 ++++++-----------------
net/batman-adv/vis.c | 17 +++--
14 files changed, 202 insertions(+), 182 deletions(-)
There is a typo here where an extra '!' made the check to the opposite
of what was intended.
Signed-off-by: Dan Carpenter <dan.carpenter(a)oracle.com>
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index 9373a14..24403a7 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -695,7 +695,7 @@ bool gw_out_of_range(struct bat_priv *bat_priv,
}
neigh_old = find_router(bat_priv, orig_dst_node, NULL);
- if (!!neigh_old)
+ if (!neigh_old)
goto out;
if (curr_tq_avg - neigh_old->tq_avg > GW_THRESHOLD)
Hi,
I looked at the new patches from ordex and thought about using the Makefile
from the kernel as the Makefile.kbuild in the standalone distribution. The
Makefile is only the user friendly compatibility layer over the kbuild stuff.
The problem is: The OpenWRT buildscript only uses the Makefile.kbuild (for a
reason I don't know right now) and "adds" those extra includes for OpenWRT
specific rules to the Makefile.kbuild (another part I never understood and only
saw in the batman-adv makefiles).
So maybe it is possible to discuss those different points and maybe find a
solution for it. Things which are done here:
* Import of kernel Makefile as Makefile.kbuild
- Removes OpenWRT specific include of Rules.make
- Removes place to manually set -DCONFIG_BATMAN_ADV_DEBUG
- Removes compat.c build
* Removal of the automatic detection of CPUs (see the discussion of the batctl
patch)
* Enabling of the batman-adv module build and adding of compat.o to the build
through Makefile instead of Makefile.kbuild
* Introducing the "new" way to enable optional features through
`make CONFIG_BATMAN_ADV_FEATURE=y`
* Fix of source revision "branding" when directly calling `make install` in
the clean source directory
Kind regards,
Sven
---
diff --git a/Makefile b/Makefile
index 3374687..b4159ed 100644
--- a/Makefile
+++ b/Makefile
@@ -33,15 +33,19 @@ REVISION= $(shell if [ -d .git ]; then \
echo $$(git describe --always --dirty --match "v*" |sed 's/^v//' 2> /dev/null || echo "[unknown]"); \
fi)
-NUM_CPUS = $(shell nproc 2> /dev/null || echo 1)
-
+CONFIG_BATMAN_ADV=m
+batman-adv-y += compat.o
+ifneq ($(REVISION),)
+ccflags-y += -DSOURCE_VERSION=\"$(REVISION)\"
+endif
+ccflags-$(CONFIG_BATMAN_ADV_DEBUG) += -DCONFIG_BATMAN_ADV_DEBUG
include $(PWD)/Makefile.kbuild
all:
- $(MAKE) -C $(KERNELPATH) REVISION=$(REVISION) M=$(PWD) PWD=$(PWD) -j $(NUM_CPUS) modules
+ $(MAKE) -C $(KERNELPATH) REVISION=$(REVISION) M=$(PWD) PWD=$(PWD) modules
clean:
$(MAKE) -C $(KERNELPATH) M=$(PWD) PWD=$(PWD) clean
install:
- $(MAKE) -C $(KERNELPATH) M=$(PWD) PWD=$(PWD) INSTALL_MOD_DIR=kernel/net/batman-adv/ modules_install
+ $(MAKE) -C $(KERNELPATH) REVISION=$(REVISION) M=$(PWD) PWD=$(PWD) INSTALL_MOD_DIR=kernel/net/batman-adv/ modules_install
diff --git a/Makefile.kbuild b/Makefile.kbuild
index bd7e93c..ce68611 100644
--- a/Makefile.kbuild
+++ b/Makefile.kbuild
@@ -18,20 +18,7 @@
# 02110-1301, USA
#
-
-
-# openwrt integration
-ifeq ($(MAKING_MODULES),1)
--include $(TOPDIR)/Rules.make
-endif
-
-# ccflags-y += -DCONFIG_BATMAN_ADV_DEBUG
-
-ifneq ($(REVISION),)
-ccflags-y += -DSOURCE_VERSION=\"$(REVISION)\"
-endif
-
-obj-m += batman-adv.o
+obj-$(CONFIG_BATMAN_ADV) += batman-adv.o
batman-adv-y += bat_debugfs.o
batman-adv-y += bat_iv_ogm.o
batman-adv-y += bat_sysfs.o
@@ -50,4 +37,3 @@ batman-adv-y += soft-interface.o
batman-adv-y += translation-table.o
batman-adv-y += unicast.o
batman-adv-y += vis.o
-batman-adv-y += compat.o
diff --git a/README b/README
index 7404c0a..ddc9569 100644
--- a/README
+++ b/README
@@ -207,10 +207,10 @@ times necessary to see more detail debug messages. This must be
enabled when compiling the batman-adv module. When building bat-
man-adv as part of kernel, use "make menuconfig" and enable the
option "B.A.T.M.A.N. debugging". When compiling outside of the
-kernel tree it is necessary to edit the file Makefile.kbuild and
-uncomment the line
+kernel tree it is necessary to enable it using the make option
+CONFIG_BATMAN_ADV_DEBUG=y
-#ccflags-y += -DCONFIG_BATMAN_ADV_DEBUG
+# make CONFIG_BATMAN_ADV_DEBUG=y
Those additional debug messages can be accessed using a special
file in debugfs
--
1.7.7.1
Hello people,
****
This is the fourth version of this patchset. The whole code has been reviewed
after some discussions on irc. Several bugs have been spotted and fixed.
Thanks Marek, Sven and Simon.
This should be a final version, unless some other mistakes/problems are find.
This patchset assume that patch
[PATCH] batman-adv: add biggest_unsigned_int(x) macro
has already been applied
****
as most of you may already know, last summer I've been working on the
B.A.T.M.A.N.-Adv GSoC project named "DAT: Distributed ARP Table". For who wants
to get deeper into the details of the project there are two links:
- The GSoC proposal [1]
- The DAT wikipage on open-mesh.org [2], with status and ideas description
Just to recap: DAT is a distributes hash table meant to store ARP entries for
fast lookup. In a normal scenario, whenever a node wants to communicate with
another one, it first needs to issue a broadcast ARP request in order to
retrieve its PHY/MAC address. In a sparse network a broadcast message could be
lost several times before reaching the real destination so creating high
latencies. With DAT, every ARP entries (a pair [IP addr, MAC addr]) is stored on
a "computed" set of nodes, therefore in case of ARP request theses nodes can
directly be contacted (in unicast) and the needed information can be quickly
fetched.
Cheers,
Antonio
[1] http://www.google-melange.com/gsoc/project/google/gsoc2011/ordex/4001
[2] http://www.open-mesh.org/wiki/batman-adv/GSOC2011_DAT
---
bat_iv_ogm.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index d60e1ba..e4bd54e 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -772,8 +772,7 @@ static int bat_ogm_calc_tq(struct orig_node *orig_node,
/* if we have too few packets (too less data) we set tq_own to zero */
/* if we receive too few packets it is not considered bidirectional */
- if ((total_count < TQ_LOCAL_BIDRECT_SEND_MINIMUM) ||
- (neigh_rq_count < TQ_LOCAL_BIDRECT_RECV_MINIMUM))
+ if (total_count < TQ_LOCAL_BIDRECT_SEND_MINIMUM)
tq_own = 0;
else
/* neigh_node->real_packet_count is never zero as we
--
1.7.1
The TT_CLIENT_ROAM flag has to be set in tt_global_del() only if the latter has
been invoked by the roaming_advertisement receiving routine. In case of changes
update (normal operation done on OGM/TT_QUERY receiving) this doesn't have to
happen. Moreover, a client which roamed to us has to be marked as ROAMED, not
PENDING. This will make it to be kept for consistency purposes until the related
change is received within the next OGM.
Signed-off-by: Antonio Quartulli <ordex(a)autistici.org>
---
translation-table.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/translation-table.c b/translation-table.c
index 379529d..633b35b 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -234,9 +234,11 @@ void tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
if (tt_global_entry) {
/* This node is probably going to update its tt table */
tt_global_entry->orig_node->tt_poss_change = true;
- /* The global entry has to be marked as PENDING and has to be
+ /* The global entry has to be marked as ROAMING and has to be
* kept for consistency purpose */
- tt_global_entry->common.flags |= TT_CLIENT_PENDING;
+ tt_global_entry->common.flags |= TT_CLIENT_ROAM;
+ tt_global_entry->roam_at = jiffies;
+
send_roam_adv(bat_priv, tt_global_entry->common.addr,
tt_global_entry->orig_node);
}
@@ -357,12 +359,14 @@ static void tt_local_set_pending(struct bat_priv *bat_priv,
uint16_t flags)
{
tt_local_event(bat_priv, tt_local_entry->common.addr,
- tt_local_entry->common.flags | flags);
+ TT_CLIENT_DEL);
/* The local client has to be marked as "pending to be removed" but has
* to be kept in the table in order to send it in a full table
* response issued before the net ttvn increment (consistency check) */
tt_local_entry->common.flags |= TT_CLIENT_PENDING;
+ /* if this is a roaming deletion, mark the local entry accordingly */
+ tt_local_entry->common.flags |= flags & TT_CLIENT_ROAM;
}
void tt_local_remove(struct bat_priv *bat_priv, const uint8_t *addr,
@@ -1404,7 +1408,7 @@ static void _tt_update_changes(struct bat_priv *bat_priv,
tt_global_del(bat_priv, orig_node,
(tt_change + i)->addr,
"tt removed by changes",
- (tt_change + i)->flags & TT_CLIENT_ROAM);
+ false);
else
if (!tt_global_add(bat_priv, orig_node,
(tt_change + i)->addr, ttvn, false,
--
1.7.3.4
On dom, nov 20, 2011 at 10:49:16 +0200, Panayot Daskalov wrote:
> > Hi All,
> >
> > I want to ask for your advice about a batman problem I am facing. I have
> > a mesh network of custom build embedded Linux devices. The devices have
> > only network one interface and this is the Wi-Fi that is used by batman.
> > So far the mesh is running OK, but at some point I need to be able to
> > connect with a laptop (non-Linux) to the network and access some of the
> > devices via its IP address. I tried simply connecting to the adhoc
> > network and setting a static IP to my laptop. I have managed to do that,
> > but I can't access the nodes from the mesh.
> >
> > I read the instruction for mixing with non-batman devices by bridging
> > the bat0 interface with the "non-batman" interface, but as far as I
> > understand that applies to systems with at least 2 network interfaces
> > e.g one for batman nodes and one for the non-batman. So my question is -
> > can I mix non-batman and batman nodes when I have only one network
> > interface on the batman nodes? If yes, then how?
>
Hi Panayot,
you are right: you need two "interfaces" in order to let clients connect
to the mesh. However (if you want to use wifi interfaces only) you can
also create "virtual interaces" using the same "real interface". This
feature is available depending on the wifi driver you are using. If you are
using madwifi or one of the new mac80211 drivers (not all support it),
this technique should be feasiable without introducing many problems :)
For instance, what driver are you using?
Cheers,
--
Antonio Quartulli
..each of us alone is worth nothing..
Ernesto "Che" Guevara ☭