Sven Eckelmann | 1 Mar 16:56 2015

[PATCH] batman-adv: Remove unnecessary check for orig_ifinfo == NULL

orig_ifinfo is dereferenced multiple times in batadv_iv_ogm_update_seqnos
before the check for NULL is done. The function also exists at the beginning
when orig_ifinfo would have been NULL. This makes the check at the end
unnecessary and only confuses the reader/code analyzers.

Signed-off-by: Sven Eckelmann <sven@...>
---
 bat_iv_ogm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 554e0e0..04bd220 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
 <at>  <at>  -1357,8 +1357,7  <at>  <at>  batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
 out:
 	spin_unlock_bh(&orig_node->bat_iv.ogm_cnt_lock);
 	batadv_orig_node_free_ref(orig_node);
-	if (orig_ifinfo)
-		batadv_orig_ifinfo_free_ref(orig_ifinfo);
+	batadv_orig_ifinfo_free_ref(orig_ifinfo);
 	return ret;
 }

--

-- 
2.1.4

Sven Eckelmann | 1 Mar 14:15 2015

[RFCv3 1/3] batman-adv: Define the size of hashtables by hash bits

The common hashtable implementation in the kernel uses bits of the hash to
compute the final size of the hastable. Similar can be done for the partially
locked, concurrent hashtables in batman-adv. The requirement of sizes with
power two will allow better compiler optimization in the future.

Signed-off-by: Sven Eckelmann <sven@...>
---
v3:
 - Rebased on master

 bridge_loop_avoidance.c | 6 ++++--
 distributed-arp-table.c | 2 +-
 main.h                  | 9 +++++++++
 network-coding.c        | 7 +++++--
 originator.c            | 2 +-
 translation-table.c     | 8 ++++++--
 6 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/bridge_loop_avoidance.c b/bridge_loop_avoidance.c
index 6927589..c999d6b 100644
--- a/bridge_loop_avoidance.c
+++ b/bridge_loop_avoidance.c
 <at>  <at>  -1220,6 +1220,8  <at>  <at>  int batadv_bla_init(struct batadv_priv *bat_priv)
 	struct batadv_hard_iface *primary_if;
 	uint16_t crc;
 	unsigned long entrytime;
+	uint32_t hash_claim_size = 1u << BATADV_BLA_CLAIM_HASH_BITS;
+	uint32_t hash_backbone_size = 1u << BATADV_BLA_BACKBONE_HASH_BITS;

 	spin_lock_init(&bat_priv->bla.bcast_duplist_lock);
(Continue reading)

Sven Eckelmann | 1 Mar 09:46 2015

[PATCHv3] batman-adv: Use common Jenkins Hash implementation

An unoptimized version of the Jenkins one-at-a-time hash function is used and
partially copied all over the code wherever an hashtable is used. Instead the
optimized version shared between the whole kernel should be used to reduce code
duplication and use better optimized code.

Only the DAT code must use the old implementation because it is used as
distributed hash function which has to be common for all nodes.

Signed-off-by: Sven Eckelmann <sven@...>
---
v3: rebased on top of current master

 bridge_loop_avoidance.c | 16 ++++------------
 distributed-arp-table.c | 17 +++++++++++++++--
 hash.h                  | 22 ----------------------
 main.h                  |  1 +
 network-coding.c        | 10 ++--------
 originator.h            | 13 +------------
 translation-table.c     |  8 ++------
 7 files changed, 25 insertions(+), 62 deletions(-)

diff --git a/bridge_loop_avoidance.c b/bridge_loop_avoidance.c
index ac4b96e..6927589 100644
--- a/bridge_loop_avoidance.c
+++ b/bridge_loop_avoidance.c
 <at>  <at>  -42,12 +42,8  <at>  <at>  static inline uint32_t batadv_choose_claim(const void *data, uint32_t size)
 	struct batadv_bla_claim *claim = (struct batadv_bla_claim *)data;
 	uint32_t hash = 0;

-	hash = batadv_hash_bytes(hash, &claim->addr, sizeof(claim->addr));
(Continue reading)

Ufo | 25 Feb 03:47 2015
Picon

use_count = 1 / device stuck on reboot or netifd restart

in leipzig since months we have problems with batman-adv and these
start/stop scripts or netifd-stuff.

we thought that this might be our own special problem, because we are
using more than one batman-adv instance (separated by vlan).

but its still there, also on openwrt-cc-trunk, now also on our
batman-adv super-gluon-node-servers (using fastd) on virtualized
x86-openwrt.
so f.i. i can crash that system in a way by: etc/init.d/fastd stop

please help us and have a look at our local ticket number 23
https://github.com/freifunk/firmware-leipzig/issues/23

good luck
ufo

root <at> vpnb9:~# batctl -v
batctl 2014.4.0 [batman-adv: 2014.4.0]
root <at> vpnb9:~# fastd -v
fastd v17
root <at> vpnb9:~# cat /etc/openwrt_*
DISTRIB_ID='OpenWrt'
DISTRIB_RELEASE='Bleeding Edge'
DISTRIB_REVISION='r44497'
DISTRIB_CODENAME='chaos_calmer'
DISTRIB_TARGET='x86/kvm_guest'
DISTRIB_DESCRIPTION='OpenWrt Chaos Calmer r44497'
DISTRIB_TAINTS=''
r44497
(Continue reading)

Sven Eckelmann | 23 Feb 20:18 2015

[PATCH] alfred: Drop capabilities when not needed

The alfred process only requires the capability to bind to a raw socket
(CAP_NET_RAW). It is enough to mark this capability as permitted on program
startup and mark it again as effective whenever a new netsock is initialized.
All other capabilities can be dropped completely.

Signed-off-by: Sven Eckelmann <sven@...>
---
 Makefile  | 24 ++++++++++++++++++
 main.c    | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 netsock.c | 44 +++++++++++++++++++++++++++++++++
 3 files changed, 151 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 8e944c9..4e22d76 100644
--- a/Makefile
+++ b/Makefile
 <at>  <at>  -27,6 +27,9  <at>  <at>  MANPAGE = man/alfred.8
 CFLAGS += -pedantic -Wall -W -std=gnu99 -fno-strict-aliasing -MD -MP
 LDLIBS += -lrt

+# B.A.T.M.A.N. debugging:
+export CONFIG_ALFRED_CAPABILITIES=y
+
 # disable verbose output
 ifneq ($(findstring $(MAKEFLAGS),s),s)
 ifndef V
 <at>  <at>  -70,6 +73,27  <at>  <at>  ifneq ($(CONFIG_ALFRED_GPSD),n)
 	GPSD_INSTALL=gpsd-install
 endif

(Continue reading)

Sven Eckelmann | 23 Feb 19:08 2015

[PATCH] alfred: Add explanation how to run alfred as non-root user

Reported-by: MK <mailing.m1@...>
Signed-off-by: Sven Eckelmann <sven@...>
---
 README | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/README b/README
index 90a99de..205c156 100644
--- a/README
+++ b/README
 <at>  <at>  -256,6 +256,32  <at>  <at>  To get JSON formatted output, use:

 See gpsd_json(5) for documentation of the tpv object. 

+Running alfred as non-root user
+-------------------------------
+
+Alfred currently requires special capabilities and access rights to work
+correctly. The user root is normally the only user having these
+capabilities/rights on a standard Linux system.
+
+Operations requiring special capabilities:
+
+ * bind to device
+ * creating the unix socket
+ * accessing the debugfs filesystem
+
+The first operation can still be executed when the admin grants the special
+capability CAP_NET_RAW to anyone executing the alfred binary. The unix socket
+can also be moved to a different directly which is accessible by the user by
(Continue reading)

Andreas Pape | 19 Feb 11:28 2015

Antwort: Re: Antwort: Re: Antwort: Antwort: Re: Antwort: Re: Question concerning batman-adv bug #173 "Mesh packets on bat0"

I started with a freshly unpacked source code of the 2014.4.0 release and 
applied only  your latest patch. 

As expected from the tests done so far with the old kernel effectively not 
calling netdev_set_master allows the usage of the latest batman-adv 
version in combination with older kernels (at least the 2.6.32 I tested 
with).

I think this patch is worth to be integrated into the next batman-adv 
version.

Regards,
Andreas

"B.A.T.M.A.N" <b.a.t.m.a.n-bounces@...>
schrieb am 
19.02.2015 10:40:34:

> Von: Marek Lindner <mareklindner@...>
> An: The list for a Better Approach To Mobile Ad-hoc Networking 
> <b.a.t.m.a.n@...>, 
> Datum: 19.02.2015 10:42
> Betreff: Re: [B.A.T.M.A.N.] Antwort: Re: Antwort: Antwort: Re: 
> Antwort: Re: Question concerning batman-adv bug #173 "Mesh packets on 
bat0"
> Gesendet von: "B.A.T.M.A.N" <b.a.t.m.a.n-bounces@...>
> 
> On Thursday, February 19, 2015 09:31:08 Andreas Pape wrote:
> > the problem seems to be a little bit more complex. Your latest patch 
does 
(Continue reading)

Andreas Pape | 19 Feb 09:31 2015

Re: Antwort: Re: Antwort: Antwort: Re: Antwort: Re: Question concerning batman-adv bug #173 "Mesh packets on bat0"

Hi Marek,

the problem seems to be a little bit more complex. Your latest patch does 
not solve the problem.

But I found out, that commenting out the following line in your patch 
makes bat0 work:

slave->master = master;

But as this is the core of "enslaving" a device to a master device, this 
breaks the complete concept behind this I guess (I'm not a skilled kernel 
developer). From this I conclude that there might be a bug somewhere 
deeper in the kernel version I use.  I don't want to give up too early, 
but it looks a little bit as if this "enslaving concept using rtnl" might 
not be usable in these older kernels. What do you think?

Regards,
Andreas

Martin Hundebøll | 18 Feb 18:18 2015
Picon

Re: [PATCH] batman-adv: Use safer default config for optional features

Hi Sven, Marek,

On 2015-02-18 08:33, Marek Lindner wrote:
> On Thursday, February 05, 2015 17:22:53 Sven Eckelmann wrote:
>> The current default settings for optional features in batman-adv seems to be
>> based around the idea that the user only compiles what he requires. They
>> will automatically enabled when they are compiled in. For example the
>> network coding part of batman-adv is by default disabled in the out-of-tree
>> module but will be enabled when the code is compiled during the module
>> build.
>>
>> But distributions like Debian just enable all features of the batman-adv
>> kernel module and hope that more experimental features or features with
>> possible negative effects have to be enabled using some runtime
>> configuration interface.
>
> Interesting point. Based on what you are saying we definitely should review our
> policy and agree on sane defaults.

Sane defaults have always been one of the great values of batman-adv...

>> The network_coding feature can help in specific setups but also has
>> drawbacks and is not disabled by default in the out-of-tree module.
>> Disabling by default in the runtime config seems to be also quite sane.
>
> This feature requires the wifi driver to support promisc mode. We should keep
> it disabled.

I think the problem Sven mentions, is that some distro's build their 
kernels with all_yes, and so network coding is always built in. Since NC 
(Continue reading)

Sven Eckelmann | 18 Feb 18:20 2015

[PATCHv2] batman-adv: Use safer default config for optional features

The current default settings for optional features in batman-adv seems to be
based around the idea that the user only compiles what he requires. They will
automatically enabled when they are compiled in. For example the network coding
part of batman-adv is by default disabled in the out-of-tree module but will be
enabled when the code is compiled during the module build.

But distributions like Debian just enable all features of the batman-adv kernel
module and hope that more experimental features or features with possible
negative effects have to be enabled using some runtime configuration interface.

The network_coding feature can help in specific setups but also has drawbacks
and is not disabled by default in the out-of-tree module. Disabling by default
in the runtime config seems to be also quite sane.

The bridge_loop_avoidance is the only feature which is disabled by default but
may be necessary even in simple setups. Packet loops may even be created
during the initial node setup when this is not enabled. This is different than
STP on bridges because mesh is usually used on Adhoc WiFi. Having two nodes
(by accident) in the same LAN segment and in the same mesh network is rather
common in this situation.

Signed-off-by: Sven Eckelmann <sven@...>
---
DAT is now removed from this patch because the discussion showed that it is
preferred to have DAT enabled by default.

 network-coding.c | 2 +-
 soft-interface.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

(Continue reading)

Andreas Pape | 18 Feb 17:10 2015

Antwort: Re: Antwort: Antwort: Re: Antwort: Re: Question concerning batman-adv bug #173 "Mesh packets on bat0"

Hi Marek,

I reverted the changes step by step starting with patch 
0002-remove-netdev_calls.patch, as patch 1 did not help and patch 3 
containes in compat.h and soft-interface.c, I tried out myself earlier 
today.

The essential call is in patch 2 as assumed. As soon as I add the 
netdev_master_upper_dev_link call again to the compilable code, the 
problem starts to occur (mesh doesn't work as soon as bat0 is added to the 
bridge, ogm packets can be seen at bat0). It seems that this call behaves 
in older kernels different compared to newer ones.

I haven't tried to add all the other excluded parts again except for the 
netdev_master_upper_dev_link call. If you are interested I can test this 
tomorrow, too.

Regards,
Andreas


Gmane