Re: [B.A.T.M.A.N.] [RFC 0/3] GSOC 2012: bandwidth meter project

2012-08-10 Thread Simon Wunderlich
Hello Edo,

as discussed already, some general remarks:

 * please squash these patches to one - as far as I can see, the 2 others are 
mostly
   fixes to the first one
 * Don't turn on debugging in the Makefile - we don't want that by default
 * please also include the batctl patch, it is important for testing

Thanks
Simon

On Thu, Aug 09, 2012 at 02:15:23PM +0200, Edo Monticelli wrote:
 Hi,
 
 I have almost completed my Google Summer of Code project and I'd like to have 
 a
 feedback from the batman community. The project is a kernel-space bandwidth
 meter, a lightweight tool to measure network performance between batman nodes.
 You can find a general project description in the project wiki page:
 
 http://www.open-mesh.org/projects/batman-adv/wiki/GSOC2012_BW
 
 Any advice is welcome,
 Edo Monticelli
 
 
 Edo Monticelli (3):
   batman-adv: bandwidth meter implementation
   batman-adv: sender retransmission counter
   batman-adv: seqnumber is wrap around safe
 
  Makefile |2 +-
  Makefile.kbuild  |1 +
  bw_meter.c   |  531 
 ++
  bw_meter.h   |7 +
  icmp_socket.c|   18 ++
  main.c   |2 +
  packet.h |   22 ++-
  routing.c|   15 ++-
  soft-interface.c |5 +
  types.h  |   38 
  10 files changed, 634 insertions(+), 7 deletions(-)
  create mode 100644 bw_meter.c
  create mode 100644 bw_meter.h
 
 -- 
 1.7.8.6
 
 


signature.asc
Description: Digital signature


[B.A.T.M.A.N.] [PATCH] batman-adv: Remove unused hlist macros in compat.h

2012-08-10 Thread Martin Hundebøll
Signed-off-by: Martin Hundebøll mar...@hundeboll.net
---
 compat.h | 8 
 1 file changed, 8 deletions(-)

diff --git a/compat.h b/compat.h
index 13253dd..8ac22a8 100644
--- a/compat.h
+++ b/compat.h
@@ -67,14 +67,6 @@
 
 #if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 34)
 
-#define hlist_first_rcu(head) (*((struct hlist_node **)((head)-first)))
-#define hlist_next_rcu(node) (*((struct hlist_node **)((node)-next)))
-
-#define __hlist_for_each_rcu(pos, head) \
-   for (pos = rcu_dereference(hlist_first_rcu(head)); \
-pos  ({ prefetch(pos-next); 1; }); \
-pos = rcu_dereference(hlist_next_rcu(pos)))
-
 #define rcu_dereference_protected(p, c) (p)
 
 #endif /*  KERNEL_VERSION(2, 6, 34) */
-- 
1.7.11.4



Re: [B.A.T.M.A.N.] propagate gw_mode over two mesh linked by ethernet with bla2

2012-08-10 Thread Gui Iribarren
On Tue, Aug 7, 2012 at 7:46 AM, Simon Wunderlich
simon.wunderl...@s2003.tu-chemnitz.de wrote:
 Hello Guido,

 OGMs flood the ethernet backbone again as expected; running batctl o
 in mesh1 nodes show nodes from mesh2, and viceversa; i smiled!
 unfortunately, trying to get a DHCP lease while connected to a mesh
 node was again malfunctioning :(
 a couple of quick batctl td, and i thnk that looked like dhcp
 request packets were being dropped at the backbone gateway, kinda like
 the check incoming type for bla bug, but i didn't try to narrow it
 down
 instead reverted configs back to gw_mode=off and things started working again

 Mhm, we could track this further down if you want. So you have eth0 in your
 bridge and batman using a VLAN (e.g. eth0.1234) at the same time?

Case closed: i had gone lost in a myriad of different openwrt
revisions, compiled binaries, and patches, so I unknowingly updated
that part of the network to a more recent openwrt version, but that
didn't have the check incoming type for bla patch.
So it was a simple regression on my part. I just reflashed those
routers to a firmware confirmed to include the patch, and everything
is working again. (bla2+gw_mode+vlan)
Thanks a lot Marek for pushing that patch to openwrt batman-adv stable
package, it helped a lot in getting things straight :)

 Feel free to update the Wiki, although I'd suggest to add an FAQ to the
 user page and not on the technical documentation. :)

Done, added two entries to the FAQ rewording this thread :)

Thanks as always,

Gui


[B.A.T.M.A.N.] [PATCH] batman-adv: return proper value in case of hash_add failure

2012-08-10 Thread Antonio Quartulli
In case of hash_add failure tt_global_add() must return 0 (which means on entry
insertion).

Signed-off-by: Antonio Quartulli or...@autistici.org
---

This patch is based on master. This bug exists since a bit but nobody actually
found it because this bug should have been triggered in the unlikely case of 
hash
adding failure. Therefore I do not think it is a crucial bug and it is not worth
sending this patch to stable.

Cheers,


 Makefile|2 +-
 translation-table.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index bd8d30c..12aebe5 100644
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@
 
 # changing the CONFIG_* line to 'y' enables the related feature
 # B.A.T.M.A.N. debugging:
-export CONFIG_BATMAN_ADV_DEBUG=n
+export CONFIG_BATMAN_ADV_DEBUG=y
 # B.A.T.M.A.N. bridge loop avoidance:
 export CONFIG_BATMAN_ADV_BLA=y
 
diff --git a/translation-table.c b/translation-table.c
index 112edd3..eb352db 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -788,13 +788,13 @@ int batadv_tt_global_add(struct batadv_priv *bat_priv,
batadv_dbg(BATADV_DBG_TT, bat_priv,
   Creating new global tt entry: %pM (via %pM)\n,
   tt_global_entry-common.addr, orig_node-orig);
+   ret = 1;
 
 out_remove:
/* remove address from local hash if present */
batadv_tt_local_remove(bat_priv, tt_global_entry-common.addr,
   global tt received,
   flags  BATADV_TT_CLIENT_ROAM);
-   ret = 1;
 out:
if (tt_global_entry)
batadv_tt_global_entry_free_ref(tt_global_entry);
-- 
1.7.9.4



[B.A.T.M.A.N.] [PATCH v3] batman-adv: pass the WIFI flag from the local to global entry

2012-08-10 Thread Antonio Quartulli
in case of client roaming a new global entry is added while a corresponding
local one is still present. In this case the node can safely pass the WIFI flag
from the local to the global entry.

This change is required to let the AP-isolation correctly working in case of
roaming: if a generic WIFI client C roams from node A to B, A adds a global
entry for C without adding any WIFI flag. The latter will be set only later,
once A has received C's advertisement from B. In this time period the
AP-Isolation (if enabled) would not correctly work since C is not marked as
WIFI, so allowing it to communicate with other WIFI clients.

Signed-off-by: Antonio Quartulli or...@autistici.org
---

v3:
- rebased on top of latest master + batman-adv: return proper value in case of
  hash_add failure there the latter patch must be merged before applying this
  one.


 translation-table.c |   36 
 1 file changed, 28 insertions(+), 8 deletions(-)

diff --git a/translation-table.c b/translation-table.c
index eb352db..b257067 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -501,21 +501,30 @@ batadv_tt_local_set_pending(struct batadv_priv *bat_priv,
   tt_local_entry-common.addr, message);
 }
 
+static void __batadv_tt_local_remove(struct batadv_priv *bat_priv,
+struct batadv_tt_local_entry *tt_local,
+const char *message, bool roaming)
+{
+   uint16_t flags;
+
+   flags = BATADV_TT_CLIENT_DEL;
+   if (roaming)
+   flags |= BATADV_TT_CLIENT_ROAM;
+
+   batadv_tt_local_set_pending(bat_priv, tt_local, flags, message);
+}
+
 void batadv_tt_local_remove(struct batadv_priv *bat_priv, const uint8_t *addr,
const char *message, bool roaming)
 {
struct batadv_tt_local_entry *tt_local_entry = NULL;
-   uint16_t flags;
 
tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr);
if (!tt_local_entry)
goto out;
 
-   flags = BATADV_TT_CLIENT_DEL;
-   if (roaming)
-   flags |= BATADV_TT_CLIENT_ROAM;
+   __batadv_tt_local_remove(bat_priv, tt_local_entry, message, roaming);
 
-   batadv_tt_local_set_pending(bat_priv, tt_local_entry, flags, message);
 out:
if (tt_local_entry)
batadv_tt_local_entry_free_ref(tt_local_entry);
@@ -722,9 +731,11 @@ int batadv_tt_global_add(struct batadv_priv *bat_priv,
 uint8_t ttvn)
 {
struct batadv_tt_global_entry *tt_global_entry = NULL;
+   struct batadv_tt_local_entry *tt_local_entry = NULL;
int ret = 0;
int hash_added;
struct batadv_tt_common_entry *common;
+   uint16_t wifi_flag;
 
tt_global_entry = batadv_tt_global_hash_find(bat_priv, tt_addr);
 
@@ -791,13 +802,22 @@ int batadv_tt_global_add(struct batadv_priv *bat_priv,
ret = 1;
 
 out_remove:
+   tt_local_entry = batadv_tt_local_hash_find(bat_priv, tt_addr);
+   if (!tt_local_entry)
+   goto out;
+
+   wifi_flag = tt_local_entry-common.flags  BATADV_TT_CLIENT_WIFI;
+   tt_global_entry-common.flags |= wifi_flag;
+
/* remove address from local hash if present */
-   batadv_tt_local_remove(bat_priv, tt_global_entry-common.addr,
-  global tt received,
-  flags  BATADV_TT_CLIENT_ROAM);
+   __batadv_tt_local_remove(bat_priv, tt_local_entry, global tt received,
+flags  BATADV_TT_CLIENT_ROAM);
+
 out:
if (tt_global_entry)
batadv_tt_global_entry_free_ref(tt_global_entry);
+   if (tt_local_entry)
+   batadv_tt_local_entry_free_ref(tt_local_entry);
return ret;
 }
 
-- 
1.7.9.4