This is a small patchset intended for net/linux-3.8.
Here there are three small patches from Matthias Schiffer aimed to fix some
memory problems in the recently introduced D.A.T. component. One of them is
fixing an skb memleak, one is fixing the ARP filter routine by preventing DAT to
parse not useful messages (so reducing the amount of memory used by the local
cache) and one fixing again the ARP filter routine by preventing DAT to
overwrite correct entries with bogus ones in the local cache.
Please pull or let me know if there is any problem.
Thanks a lot,
Antonio
The following changes since commit 1591ab6740326aaf41e194c43bdf8ece6e2e4835:
Merge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless (2013-01-27 01:37:22 -0500)
are available in the git repository at:
git://git.open-mesh.org/linux-merge.git tags/batman-adv-fix-for-davem
for you to fetch changes up to b618ad1103c9ea0c4a69b44f42fc3c7b4e231e22:
batman-adv: filter ARP packets with invalid MAC addresses in DAT (2013-01-27 14:02:39 +0100)
----------------------------------------------------------------
Included changes ares:
- fix an skb memleak in DAT
- fix the ARP filtering routine in DAT by preventing bogus entries to overwrite
already existing ones in the local cache.
- fix the ARP filtering routine in DAT by preventing it to parse and add to the
cache bogus entries
----------------------------------------------------------------
Matthias Schiffer (3):
batman-adv: fix skb leak in batadv_dat_snoop_incoming_arp_reply()
batman-adv: check for more types of invalid IP addresses in DAT
batman-adv: filter ARP packets with invalid MAC addresses in DAT
net/batman-adv/distributed-arp-table.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
batadv_check_unicast_packet() is changed to return a value based on the
reason to drop the packet, which will be useful information for
future users of batadv_check_unicast_packet().
Signed-off-by: Martin Hundebøll <martin(a)hundeboll.net>
---
v2:
* Changed return values to defined error codes.
* Send as separate patch
routing.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/routing.c b/routing.c
index 1aa1722..a3ee5be 100644
--- a/routing.c
+++ b/routing.c
@@ -552,27 +552,37 @@ batadv_find_ifalter_router(struct batadv_orig_node *primary_orig,
return router;
}
+/**
+ * batadv_check_unicast_packet - Check for malformed unicast packets
+ * @skb: packet to check
+ * @hdr_size: size of header to pull
+ *
+ * Check for short header and bad addresses in given packet. Returns negative
+ * value when check fails and 0 otherwise. The negative value depends on the
+ * reason: -ENODATA for bad header, -EBADR for broadcast destination or source
+ * source, and -EREMOTE for non-local (other host) destination.
+ */
static int batadv_check_unicast_packet(struct sk_buff *skb, int hdr_size)
{
struct ethhdr *ethhdr;
/* drop packet if it has not necessary minimum size */
if (unlikely(!pskb_may_pull(skb, hdr_size)))
- return -1;
+ return -ENODATA;
ethhdr = (struct ethhdr *)skb_mac_header(skb);
/* packet with unicast indication but broadcast recipient */
if (is_broadcast_ether_addr(ethhdr->h_dest))
- return -1;
+ return -EBADR;
/* packet with broadcast sender address */
if (is_broadcast_ether_addr(ethhdr->h_source))
- return -1;
+ return -EBADR;
/* not for me */
if (!batadv_is_my_mac(ethhdr->h_dest))
- return -1;
+ return -EREMOTE;
return 0;
}
--
1.8.1
The callers of batadv_dat_snoop_incoming_arp_reply() assume the skb has been
freed when it returns true; fix this by calling kfree_skb before returning as
it is done in batadv_dat_snoop_incoming_arp_request().
Signed-off-by: Matthias Schiffer <mschiffer(a)universe-factory.net>
---
distributed-arp-table.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/distributed-arp-table.c b/distributed-arp-table.c
index 7485a78..9f4cff3 100644
--- a/distributed-arp-table.c
+++ b/distributed-arp-table.c
@@ -1012,6 +1012,8 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv,
*/
ret = !batadv_is_my_client(bat_priv, hw_dst);
out:
+ if (ret)
+ kfree_skb(skb);
/* if ret == false -> packet has to be delivered to the interface */
return ret;
}
--
1.8.1.1
I hereby bring you network coding in batman-adv (in its third revision.
This allows a relay to send two packets (to two destinations) in a single
transmission. Tests[1] have shown an increase in throughput up to 1.6
under the right circumstances.
For this to work, you will need to compile batman-adv with
CONFIG_BATMAN_ADV_NC=y and a wireless interface with working
promiscuous mode. The rest is taken care of by batman-adv and the
following patches.
Patch 5/6 depends on my previous patch on the mailing list:
"Return reason for failure in batadv_check_unicast_packet()"
[1] http://www.open-mesh.org/projects/open-mesh/wiki/2011-08-18-network-coding-…
Martin Hundebøll (6):
batman-adv: Add the initial code for network coding.
batman-adv: Detect coding nodes and remove these after timeout
batman-adv: Buffer unicast packets before forward.
batman-adv: Code and transmit packets if possible.
batman-adv: Save overheard and tx packets for decoding.
batman-adv: Receive coded packets and decode them.
Makefile | 2 +
Makefile.kbuild | 1 +
bat_iv_ogm.c | 5 +
compat.c | 10 +
compat.h | 1 +
debugfs.c | 18 +
gen-compat-autoconf.sh | 1 +
main.c | 6 +
main.h | 12 +-
network-coding.c | 1832 ++++++++++++++++++++++++++++++++++++++++++++++++
network-coding.h | 123 ++++
originator.c | 6 +
packet.h | 33 +
routing.c | 31 +-
send.c | 5 +
soft-interface.c | 14 +
sysfs-class-net-mesh | 8 +
sysfs.c | 6 +
types.h | 124 ++++
19 files changed, 2228 insertions(+), 10 deletions(-)
create mode 100644 network-coding.c
create mode 100644 network-coding.h
--
1.8.1.1
I am running LXC (SID) under Debian SID and the current git version of
batman-adv (v3.7-rc7-1325-gaf5d4f7) +batctl (v2012.4.0-30-ga395164).
But it fails to add any of my interfaces and non-batman-adv interfaces
can be created without problems
# ip link
13: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP mode DEFAULT qlen 1000
link/ether 00:ff:aa:00:00:01 brd ff:ff:ff:ff:ff:ff
15: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
# batctl if add eth0
Error - can't open file '/sys/class/net/eth0/batman_adv/mesh_iface':
Read-only file system
# ls -l /sys/class/net/eth0/batman_adv/mesh_iface
-rw-r--r-- 1 root root 4096 Dec 30 18:26
/sys/class/net/eth0/batman_adv/mesh_iface
# id
uid=0(root) gid=0(root) groups=0(root)
# ip link add dev br0 type bridge
# ip link set dev eth0 master br0
# ip link
18: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
master br0 state UP mode DEFAULT qlen 1000
link/ether 00:ff:aa:00:00:01 brd ff:ff:ff:ff:ff:ff
20: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
21: br0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT
link/ether 00:ff:aa:00:00:01 brd ff:ff:ff:ff:ff:ff
> I am seeking some general advice on how to optimise batman-adv in the
> context of a dense mesh.
Update to newest compat wireless
Change multicast rate to something higher like 18M/54M
Change radio distance setting to something < 300m
Increase beacon_int of all VIf to something like 5000 (5 sec) or higher
Enable sst in Adhoc (modifying source for 2.4GHz required
http://article.gmane.org/gmane.linux.kernel.wireless.general/100844 )
Increase batman-adv ogm interval to 5000 or 10000
Increase batman-adv hop penalty to to 50 or 70
Hi all,
A colleague of mine is building a batman-adv mesh network in an
apartment building with essentially one node per apartment. Not
surprisingly, results in a very dense mesh with each node having a
large number of neighbours. Here is a typical batctl o output
http://pastebin.com/aAR43hj7 This results in some fairly slow
connections.
I am seeking some general advice on how to optimise batman-adv in the
context of a dense mesh. Options that we have considered include
turning the radio transmit power down on all of the devices and/or
alternating channels on different floors (e.g. 1,6,11,1,6,11,etc).
However, it is not clear to us what is the best strategy in this
context. Grateful for any tips or suggestions you may have.
Thanks in advance.... Steve Song
--
Steve Song
+1 902 529 0046
+27 83 482 2088 (SMS only)
http://manypossibilities.nethttp://villagetelco.org
here is our second patchset intended for net-next/linux-3.9.
In this batch you have some struct refactoring and a great kernel doc
improvement by Marek Lindner. In patch 10/13 you have the random32() function
renaming proposed by Akinobu Mita.
In 11/13 instead you have a behavioural change brought by Simon Wunderlich which
is modifying the way a batman-adv virtual interface is unregistered in order to
prevent a possible deadlock involving rntl_lock and s_active. We have
already been discussing about this problem and its possible solution on the
netdev mailing list.
The rest is just clean up work.
Please pull or let me know if there is any problem.
Thanks a lot,
Antonio
The following changes since commit 1ad759d8479b4b28f2a6c874d380066cf987b341:
ipv6: remove unneeded check to pskb_may_pull in ipip6_rcv (2013-01-18 14:43:51 -0500)
are available in the git repository at:
git://git.open-mesh.org/linux-merge.git tags/batman-adv-for-davem
for you to fetch changes up to 5ac2a177298e1f245aa54cce4030842f3abe5aea:
batman-adv: Start new development cycle (2013-01-19 21:18:13 +0800)
----------------------------------------------------------------
Included changes:
- sysfs removal postponement during interface un-registration
- random32() function renaming
- struct refactoring
- kernel doc improvement
- deleyed_work initialisation clean up work
- copyright year and internal version number update
- kernel doc improvement
----------------------------------------------------------------
Akinobu Mita (1):
batman-adv: rename random32() to prandom_u32()
Antonio Quartulli (3):
batman-adv: a delayed_work has to be initialised once
batman-adv: update copyright years
batman-adv: Start new development cycle
Marek Lindner (8):
batman-adv: align kernel doc properly
batman-adv: mark debug_log struct as bat_priv only struct
batman-adv: group tt type definitions together
batman-adv: rename batadv_if_list_entry struct to make clear it is used by vis
batman-adv: rename batadv_recvlist_node struct to make clear it is used by vis
batman-adv: rename batadv_backbone_gw struct to make clear it is used by bla
batman-adv: rename batadv_claim struct to make clear it is used by bla
batman-adv: kernel doc for types.h
Simon Wunderlich (1):
batman-adv: postpone sysfs removal when unregistering
net/batman-adv/bat_algo.h | 2 +-
net/batman-adv/bat_iv_ogm.c | 6 +-
net/batman-adv/bitarray.c | 2 +-
net/batman-adv/bitarray.h | 2 +-
net/batman-adv/bridge_loop_avoidance.c | 113 ++++---
net/batman-adv/bridge_loop_avoidance.h | 2 +-
net/batman-adv/debugfs.c | 15 +-
net/batman-adv/debugfs.h | 2 +-
net/batman-adv/distributed-arp-table.c | 2 +-
net/batman-adv/distributed-arp-table.h | 2 +-
net/batman-adv/gateway_client.c | 2 +-
net/batman-adv/gateway_client.h | 2 +-
net/batman-adv/gateway_common.c | 2 +-
net/batman-adv/gateway_common.h | 2 +-
net/batman-adv/hard-interface.c | 26 +-
net/batman-adv/hard-interface.h | 2 +-
net/batman-adv/hash.c | 2 +-
net/batman-adv/hash.h | 2 +-
net/batman-adv/icmp_socket.c | 2 +-
net/batman-adv/icmp_socket.h | 2 +-
net/batman-adv/main.c | 2 +-
net/batman-adv/main.h | 6 +-
net/batman-adv/originator.c | 19 +-
net/batman-adv/originator.h | 2 +-
net/batman-adv/packet.h | 2 +-
net/batman-adv/ring_buffer.c | 2 +-
net/batman-adv/ring_buffer.h | 2 +-
net/batman-adv/routing.c | 2 +-
net/batman-adv/routing.h | 2 +-
net/batman-adv/send.c | 7 +-
net/batman-adv/send.h | 2 +-
net/batman-adv/soft-interface.c | 34 +-
net/batman-adv/soft-interface.h | 2 +-
net/batman-adv/sysfs.c | 2 +-
net/batman-adv/sysfs.h | 2 +-
net/batman-adv/translation-table.c | 16 +-
net/batman-adv/translation-table.h | 2 +-
net/batman-adv/types.h | 568 ++++++++++++++++++++++++++-------
net/batman-adv/unicast.c | 2 +-
net/batman-adv/unicast.h | 2 +-
net/batman-adv/vis.c | 36 +--
net/batman-adv/vis.h | 2 +-
42 files changed, 641 insertions(+), 267 deletions(-)