From: Antonio Quartulli <antonio(a)open-mesh.com>
hard-interface.c has to do not contain any routing algorithm
specific code.
Allocate the hard-interface with kzalloc() and remove any
useless and algorithm specific member initialisation
Signed-off-by: Antonio Quartulli <antonio(a)open-mesh.com>
---
hard-interface.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/hard-interface.c b/hard-interface.c
index 18f4523..dc4ac29 100644
--- a/hard-interface.c
+++ b/hard-interface.c
@@ -577,7 +577,7 @@ batadv_hardif_add_interface(struct net_device *net_dev)
dev_hold(net_dev);
- hard_iface = kmalloc(sizeof(*hard_iface), GFP_ATOMIC);
+ hard_iface = kzalloc(sizeof(*hard_iface), GFP_ATOMIC);
if (!hard_iface)
goto release_dev;
@@ -603,12 +603,6 @@ batadv_hardif_add_interface(struct net_device *net_dev)
batadv_check_known_mac_addr(hard_iface->net_dev);
list_add_tail_rcu(&hard_iface->list, &batadv_hardif_list);
- /* This can't be called via a bat_priv callback because
- * we have no bat_priv yet.
- */
- atomic_set(&hard_iface->bat_iv.ogm_seqno, 1);
- hard_iface->bat_iv.ogm_buff = NULL;
-
return hard_iface;
free_if:
--
1.8.1.5
Hi,
In the file distributed-arp-table.c, function
batadv_dat_snoop_incoming_arp_request, after creation of ARP reply
(skb_new = arp_create(...)) and testing if the creation was
successful, shouldn't exist a call to skb_reset_mac_header(skb_new),
just like in batadv_dat_snoop_outgoing_arp_request?
I've done something similar for NDP and I think that this is the line
that might generate a kernel panic (not sure yet, I might have to do
more testing).
As I said, I'm not sure yet, and maybe my code might generate it. But
my question is why isn't here a skb_reset_mac_header as it is in the
first function.
Thanks,
Mihail
I found about Horst a few years ago when i got to know olsr and it's
usefulness for olsr mesh networks and recently decided to check it out
again.
Although i do see an option for batman i am not sure if it refers to
batmand or batman-adv and as i wait for an answer from it's developer.
My question is if there are any plans for a similar tool from open-mesh
side.
I am also curious to know if someone is using it with batman-adv or
anything equivalent/similar or close ?
What are our options.
http://br1.einfach.org/tech/horst/
--
Site: http://wirelesspt.net
Mesh: http://tinyurl.com/wirelesspt
Admin: http://wirelesspt.net/wiki/Cmsv
Suporte técnico via sms: 91 19 11 798
Chave publica PGP/SSH: http://wirelesspt.net/arquivos/pk
Email assinado digitalmente pelo emissor assegurando autenticidade
the two lonely ring_buffer helper functions are used by the
bat_iv_ogm module only and therefore they can be moved
inside it.
Reported-by: Marek Lindner <lindner_marek(a)yahoo.de>
Signed-off-by: Antonio Quartulli <ordex(a)autistici.org>
---
Makefile.kbuild | 1 -
bat_iv_ogm.c | 30 +++++++++++++++++++++++++++++-
ring_buffer.c | 51 ---------------------------------------------------
ring_buffer.h | 27 ---------------------------
4 files changed, 29 insertions(+), 80 deletions(-)
delete mode 100644 ring_buffer.c
delete mode 100644 ring_buffer.h
diff --git a/Makefile.kbuild b/Makefile.kbuild
index acbac2a..489bb36 100644
--- a/Makefile.kbuild
+++ b/Makefile.kbuild
@@ -32,7 +32,6 @@ batman-adv-y += icmp_socket.o
batman-adv-y += main.o
batman-adv-$(CONFIG_BATMAN_ADV_NC) += network-coding.o
batman-adv-y += originator.o
-batman-adv-y += ring_buffer.o
batman-adv-y += routing.o
batman-adv-y += send.o
batman-adv-y += soft-interface.o
diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 3c6670f..66d2c3b 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -19,7 +19,6 @@
#include "main.h"
#include "translation-table.h"
-#include "ring_buffer.h"
#include "originator.h"
#include "routing.h"
#include "gateway_common.h"
@@ -29,6 +28,35 @@
#include "bat_algo.h"
#include "network-coding.h"
+static void batadv_ring_buffer_set(uint8_t lq_recv[], uint8_t *lq_index,
+ uint8_t value)
+{
+ lq_recv[*lq_index] = value;
+ *lq_index = (*lq_index + 1) % BATADV_TQ_GLOBAL_WINDOW_SIZE;
+}
+
+static uint8_t batadv_ring_buffer_avg(const uint8_t lq_recv[])
+{
+ const uint8_t *ptr;
+ uint16_t count = 0, i = 0, sum = 0;
+
+ ptr = lq_recv;
+
+ while (i < BATADV_TQ_GLOBAL_WINDOW_SIZE) {
+ if (*ptr != 0) {
+ count++;
+ sum += *ptr;
+ }
+
+ i++;
+ ptr++;
+ }
+
+ if (count == 0)
+ return 0;
+
+ return (uint8_t)(sum / count);
+}
static struct batadv_neigh_node *
batadv_iv_ogm_neigh_new(struct batadv_hard_iface *hard_iface,
const uint8_t *neigh_addr,
diff --git a/ring_buffer.c b/ring_buffer.c
deleted file mode 100644
index ccab0bb..0000000
--- a/ring_buffer.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Copyright (C) 2007-2013 B.A.T.M.A.N. contributors:
- *
- * Marek Lindner
- *
- * 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
- */
-
-#include "main.h"
-#include "ring_buffer.h"
-
-void batadv_ring_buffer_set(uint8_t lq_recv[], uint8_t *lq_index,
- uint8_t value)
-{
- lq_recv[*lq_index] = value;
- *lq_index = (*lq_index + 1) % BATADV_TQ_GLOBAL_WINDOW_SIZE;
-}
-
-uint8_t batadv_ring_buffer_avg(const uint8_t lq_recv[])
-{
- const uint8_t *ptr;
- uint16_t count = 0, i = 0, sum = 0;
-
- ptr = lq_recv;
-
- while (i < BATADV_TQ_GLOBAL_WINDOW_SIZE) {
- if (*ptr != 0) {
- count++;
- sum += *ptr;
- }
-
- i++;
- ptr++;
- }
-
- if (count == 0)
- return 0;
-
- return (uint8_t)(sum / count);
-}
diff --git a/ring_buffer.h b/ring_buffer.h
deleted file mode 100644
index 3f92ae2..0000000
--- a/ring_buffer.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 2007-2013 B.A.T.M.A.N. contributors:
- *
- * Marek Lindner
- *
- * 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
- */
-
-#ifndef _NET_BATMAN_ADV_RING_BUFFER_H_
-#define _NET_BATMAN_ADV_RING_BUFFER_H_
-
-void batadv_ring_buffer_set(uint8_t lq_recv[], uint8_t *lq_index,
- uint8_t value);
-uint8_t batadv_ring_buffer_avg(const uint8_t lq_recv[]);
-
-#endif /* _NET_BATMAN_ADV_RING_BUFFER_H_ */
--
1.8.1.5
Only one neigh_node per orig_node should match a given
neighbor address, therefore, if more than one matching
neigh_node is found, a WARNING has to be triggered to let
the user know that something is wrong in the originator
state instead of silently skipping the error.
Signed-off-by: Antonio Quartulli <ordex(a)autistici.org>
---
bat_iv_ogm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 38183dc..9fbf588 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -669,7 +669,7 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,
if (batadv_compare_eth(neigh_addr, ethhdr->h_source) &&
tmp_neigh_node->if_incoming == if_incoming &&
atomic_inc_not_zero(&tmp_neigh_node->refcount)) {
- if (neigh_node)
+ if (WARN(neigh_node, "too many matching neigh_nodes")
batadv_neigh_node_free_ref(neigh_node);
neigh_node = tmp_neigh_node;
continue;
--
1.8.1.5
From: Antonio Quartulli <antonio(a)open-mesh.com>
Compatibility version is checked upon packet reception
before calling any handler. For this reason it does need to
be checked once more in the handler itself.
Signed-off-by: Antonio Quartulli <antonio(a)open-mesh.com>
---
bat_iv_ogm.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 6d62e29..38183dc 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -1054,13 +1054,6 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
}
rcu_read_unlock();
- if (batadv_ogm_packet->header.version != BATADV_COMPAT_VERSION) {
- batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
- "Drop packet: incompatible batman version (%i)\n",
- batadv_ogm_packet->header.version);
- return;
- }
-
if (is_my_addr) {
batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Drop packet: received my own broadcast (sender: %pM)\n",
--
1.8.1.5