Skip to content

Commit f1e0b5b

Browse files
committed
Merge tag 'batman-adv-for-davem' of git://git.open-mesh.org/linux-merge
Included changes: - minimal fixes to the packet layout to avoid the __packed attribute when not needed - new packet type called UNICAST_4ADDR: in this packet it is possible to find both source and destination node (in the classic UNICAST header only the destination field exists). - a new feature: Distributed ARP Table (D.A.T.). It aims to reduce ARP lookups latency by means of a simil-DHT approach.
2 parents b20b6d9 + 9affec6 commit f1e0b5b

22 files changed

Lines changed: 1682 additions & 55 deletions

‎Documentation/networking/batman-adv.txt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ abled during run time. Following log_levels are defined:
203203
2 - Enable messages related to route added / changed / deleted
204204
4 - Enable messages related to translation table operations
205205
8 - Enable messages related to bridge loop avoidance
206-
15 - enable all messages
206+
16 - Enable messaged related to DAT, ARP snooping and parsing
207+
31 - Enable all messages
207208

208209
The debug output can be changed at runtime using the file
209210
/sys/class/net/bat0/mesh/log_level. e.g.

‎net/batman-adv/Kconfig‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ config BATMAN_ADV_BLA
2525
more than one mesh node in the same LAN, you can safely remove
2626
this feature and save some space.
2727

28+
config BATMAN_ADV_DAT
29+
bool "Distributed ARP Table"
30+
depends on BATMAN_ADV && INET
31+
default n
32+
help
33+
This option enables DAT (Distributed ARP Table), a DHT based
34+
mechanism that increases ARP reliability on sparse wireless
35+
mesh networks. If you think that your network does not need
36+
this option you can safely remove it and save some space.
37+
2838
config BATMAN_ADV_DEBUG
2939
bool "B.A.T.M.A.N. debugging"
3040
depends on BATMAN_ADV

‎net/batman-adv/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ batman-adv-y += bat_iv_ogm.o
2323
batman-adv-y += bitarray.o
2424
batman-adv-$(CONFIG_BATMAN_ADV_BLA) += bridge_loop_avoidance.o
2525
batman-adv-y += debugfs.o
26+
batman-adv-$(CONFIG_BATMAN_ADV_DAT) += distributed-arp-table.o
2627
batman-adv-y += gateway_client.o
2728
batman-adv-y += gateway_common.o
2829
batman-adv-y += hard-interface.o

‎net/batman-adv/bat_iv_ogm.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,11 @@ static void batadv_iv_ogm_aggregate_new(const unsigned char *packet_buff,
411411

412412
if ((atomic_read(&bat_priv->aggregated_ogms)) &&
413413
(packet_len < BATADV_MAX_AGGREGATION_BYTES))
414-
skb_size = BATADV_MAX_AGGREGATION_BYTES + ETH_HLEN;
414+
skb_size = BATADV_MAX_AGGREGATION_BYTES;
415415
else
416-
skb_size = packet_len + ETH_HLEN;
416+
skb_size = packet_len;
417+
418+
skb_size += ETH_HLEN + NET_IP_ALIGN;
417419

418420
forw_packet_aggr->skb = dev_alloc_skb(skb_size);
419421
if (!forw_packet_aggr->skb) {
@@ -422,7 +424,7 @@ static void batadv_iv_ogm_aggregate_new(const unsigned char *packet_buff,
422424
kfree(forw_packet_aggr);
423425
goto out;
424426
}
425-
skb_reserve(forw_packet_aggr->skb, ETH_HLEN);
427+
skb_reserve(forw_packet_aggr->skb, ETH_HLEN + NET_IP_ALIGN);
426428

427429
INIT_HLIST_NODE(&forw_packet_aggr->list);
428430

‎net/batman-adv/debugfs.c‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "vis.h"
3232
#include "icmp_socket.h"
3333
#include "bridge_loop_avoidance.h"
34+
#include "distributed-arp-table.h"
3435

3536
static struct dentry *batadv_debugfs;
3637

@@ -280,6 +281,19 @@ static int batadv_bla_backbone_table_open(struct inode *inode,
280281

281282
#endif
282283

284+
#ifdef CONFIG_BATMAN_ADV_DAT
285+
/**
286+
* batadv_dat_cache_open - Prepare file handler for reads from dat_chache
287+
* @inode: inode which was opened
288+
* @file: file handle to be initialized
289+
*/
290+
static int batadv_dat_cache_open(struct inode *inode, struct file *file)
291+
{
292+
struct net_device *net_dev = (struct net_device *)inode->i_private;
293+
return single_open(file, batadv_dat_cache_seq_print_text, net_dev);
294+
}
295+
#endif
296+
283297
static int batadv_transtable_local_open(struct inode *inode, struct file *file)
284298
{
285299
struct net_device *net_dev = (struct net_device *)inode->i_private;
@@ -319,6 +333,9 @@ static BATADV_DEBUGINFO(bla_claim_table, S_IRUGO, batadv_bla_claim_table_open);
319333
static BATADV_DEBUGINFO(bla_backbone_table, S_IRUGO,
320334
batadv_bla_backbone_table_open);
321335
#endif
336+
#ifdef CONFIG_BATMAN_ADV_DAT
337+
static BATADV_DEBUGINFO(dat_cache, S_IRUGO, batadv_dat_cache_open);
338+
#endif
322339
static BATADV_DEBUGINFO(transtable_local, S_IRUGO,
323340
batadv_transtable_local_open);
324341
static BATADV_DEBUGINFO(vis_data, S_IRUGO, batadv_vis_data_open);
@@ -330,6 +347,9 @@ static struct batadv_debuginfo *batadv_mesh_debuginfos[] = {
330347
#ifdef CONFIG_BATMAN_ADV_BLA
331348
&batadv_debuginfo_bla_claim_table,
332349
&batadv_debuginfo_bla_backbone_table,
350+
#endif
351+
#ifdef CONFIG_BATMAN_ADV_DAT
352+
&batadv_debuginfo_dat_cache,
333353
#endif
334354
&batadv_debuginfo_transtable_local,
335355
&batadv_debuginfo_vis_data,

0 commit comments

Comments
 (0)