diff options
author | Antonio Quartulli <ordex@autistici.org> | 2011-11-06 06:23:55 -0500 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-11-07 14:00:22 -0500 |
commit | 172244748204c894864def59133d0133ccfabe30 (patch) | |
tree | 1fbf50d85f91ae0ef253b2080556b455a28c7789 | |
parent | c384ea3ec930ef11060a7308fbbd02b4871384f9 (diff) |
batman-adv: Distributed ARP Table - add compile option
This patch makes it possible to decide whether to include DAT within the
batman-adv binary or not.
It is extremely useful when the user wants to reduce the size of the resulting
module by cutting off any not needed feature.
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
-rw-r--r-- | net/batman-adv/Kconfig | 14 | ||||
-rw-r--r-- | net/batman-adv/Makefile | 2 | ||||
-rw-r--r-- | net/batman-adv/debugfs.c | 7 | ||||
-rw-r--r-- | net/batman-adv/distributed-arp-table.h | 65 | ||||
-rw-r--r-- | net/batman-adv/types.h | 10 |
5 files changed, 94 insertions, 4 deletions
diff --git a/net/batman-adv/Kconfig b/net/batman-adv/Kconfig index e77f805d38da..250e0b58109c 100644 --- a/net/batman-adv/Kconfig +++ b/net/batman-adv/Kconfig | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | config BATMAN_ADV | 5 | config BATMAN_ADV |
6 | tristate "B.A.T.M.A.N. Advanced Meshing Protocol" | 6 | tristate "B.A.T.M.A.N. Advanced Meshing Protocol" |
7 | depends on NET && INET | 7 | depends on NET |
8 | select CRC16 | 8 | select CRC16 |
9 | default n | 9 | default n |
10 | help | 10 | help |
@@ -16,7 +16,7 @@ config BATMAN_ADV | |||
16 | 16 | ||
17 | config BATMAN_ADV_BLA | 17 | config BATMAN_ADV_BLA |
18 | bool "Bridge Loop Avoidance" | 18 | bool "Bridge Loop Avoidance" |
19 | depends on BATMAN_ADV | 19 | depends on BATMAN_ADV && INET |
20 | default y | 20 | default y |
21 | help | 21 | help |
22 | This option enables BLA (Bridge Loop Avoidance), a mechanism | 22 | This option enables BLA (Bridge Loop Avoidance), a mechanism |
@@ -25,6 +25,16 @@ config BATMAN_ADV_BLA | |||
25 | more than one mesh node in the same LAN, you can safely remove | 25 | more than one mesh node in the same LAN, you can safely remove |
26 | this feature and save some space. | 26 | this feature and save some space. |
27 | 27 | ||
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 | |||
28 | config BATMAN_ADV_DEBUG | 38 | config BATMAN_ADV_DEBUG |
29 | bool "B.A.T.M.A.N. debugging" | 39 | bool "B.A.T.M.A.N. debugging" |
30 | depends on BATMAN_ADV | 40 | depends on BATMAN_ADV |
diff --git a/net/batman-adv/Makefile b/net/batman-adv/Makefile index 7604159e7aa5..e45e3b4e32e3 100644 --- a/net/batman-adv/Makefile +++ b/net/batman-adv/Makefile | |||
@@ -23,7 +23,7 @@ batman-adv-y += bat_iv_ogm.o | |||
23 | batman-adv-y += bitarray.o | 23 | batman-adv-y += bitarray.o |
24 | batman-adv-$(CONFIG_BATMAN_ADV_BLA) += bridge_loop_avoidance.o | 24 | batman-adv-$(CONFIG_BATMAN_ADV_BLA) += bridge_loop_avoidance.o |
25 | batman-adv-y += debugfs.o | 25 | batman-adv-y += debugfs.o |
26 | batman-adv-y += distributed-arp-table.o | 26 | batman-adv-$(CONFIG_BATMAN_ADV_DAT) += distributed-arp-table.o |
27 | batman-adv-y += gateway_client.o | 27 | batman-adv-y += gateway_client.o |
28 | batman-adv-y += gateway_common.o | 28 | batman-adv-y += gateway_common.o |
29 | batman-adv-y += hard-interface.o | 29 | batman-adv-y += hard-interface.o |
diff --git a/net/batman-adv/debugfs.c b/net/batman-adv/debugfs.c index ebc5f4d1f53c..3f679cb2d0e2 100644 --- a/net/batman-adv/debugfs.c +++ b/net/batman-adv/debugfs.c | |||
@@ -281,6 +281,7 @@ static int batadv_bla_backbone_table_open(struct inode *inode, | |||
281 | 281 | ||
282 | #endif | 282 | #endif |
283 | 283 | ||
284 | #ifdef CONFIG_BATMAN_ADV_DAT | ||
284 | /** | 285 | /** |
285 | * batadv_dat_cache_open - Prepare file handler for reads from dat_chache | 286 | * batadv_dat_cache_open - Prepare file handler for reads from dat_chache |
286 | * @inode: inode which was opened | 287 | * @inode: inode which was opened |
@@ -291,7 +292,7 @@ static int batadv_dat_cache_open(struct inode *inode, struct file *file) | |||
291 | struct net_device *net_dev = (struct net_device *)inode->i_private; | 292 | struct net_device *net_dev = (struct net_device *)inode->i_private; |
292 | return single_open(file, batadv_dat_cache_seq_print_text, net_dev); | 293 | return single_open(file, batadv_dat_cache_seq_print_text, net_dev); |
293 | } | 294 | } |
294 | 295 | #endif | |
295 | 296 | ||
296 | static int batadv_transtable_local_open(struct inode *inode, struct file *file) | 297 | static int batadv_transtable_local_open(struct inode *inode, struct file *file) |
297 | { | 298 | { |
@@ -332,7 +333,9 @@ static BATADV_DEBUGINFO(bla_claim_table, S_IRUGO, batadv_bla_claim_table_open); | |||
332 | static BATADV_DEBUGINFO(bla_backbone_table, S_IRUGO, | 333 | static BATADV_DEBUGINFO(bla_backbone_table, S_IRUGO, |
333 | batadv_bla_backbone_table_open); | 334 | batadv_bla_backbone_table_open); |
334 | #endif | 335 | #endif |
336 | #ifdef CONFIG_BATMAN_ADV_DAT | ||
335 | static BATADV_DEBUGINFO(dat_cache, S_IRUGO, batadv_dat_cache_open); | 337 | static BATADV_DEBUGINFO(dat_cache, S_IRUGO, batadv_dat_cache_open); |
338 | #endif | ||
336 | static BATADV_DEBUGINFO(transtable_local, S_IRUGO, | 339 | static BATADV_DEBUGINFO(transtable_local, S_IRUGO, |
337 | batadv_transtable_local_open); | 340 | batadv_transtable_local_open); |
338 | static BATADV_DEBUGINFO(vis_data, S_IRUGO, batadv_vis_data_open); | 341 | static BATADV_DEBUGINFO(vis_data, S_IRUGO, batadv_vis_data_open); |
@@ -345,7 +348,9 @@ static struct batadv_debuginfo *batadv_mesh_debuginfos[] = { | |||
345 | &batadv_debuginfo_bla_claim_table, | 348 | &batadv_debuginfo_bla_claim_table, |
346 | &batadv_debuginfo_bla_backbone_table, | 349 | &batadv_debuginfo_bla_backbone_table, |
347 | #endif | 350 | #endif |
351 | #ifdef CONFIG_BATMAN_ADV_DAT | ||
348 | &batadv_debuginfo_dat_cache, | 352 | &batadv_debuginfo_dat_cache, |
353 | #endif | ||
349 | &batadv_debuginfo_transtable_local, | 354 | &batadv_debuginfo_transtable_local, |
350 | &batadv_debuginfo_vis_data, | 355 | &batadv_debuginfo_vis_data, |
351 | NULL, | 356 | NULL, |
diff --git a/net/batman-adv/distributed-arp-table.h b/net/batman-adv/distributed-arp-table.h index 01308cea5b4e..fdb3522ad516 100644 --- a/net/batman-adv/distributed-arp-table.h +++ b/net/batman-adv/distributed-arp-table.h | |||
@@ -20,6 +20,8 @@ | |||
20 | #ifndef _NET_BATMAN_ADV_ARP_H_ | 20 | #ifndef _NET_BATMAN_ADV_ARP_H_ |
21 | #define _NET_BATMAN_ADV_ARP_H_ | 21 | #define _NET_BATMAN_ADV_ARP_H_ |
22 | 22 | ||
23 | #ifdef CONFIG_BATMAN_ADV_DAT | ||
24 | |||
23 | #include "types.h" | 25 | #include "types.h" |
24 | #include "originator.h" | 26 | #include "originator.h" |
25 | 27 | ||
@@ -72,4 +74,67 @@ int batadv_dat_init(struct batadv_priv *bat_priv); | |||
72 | void batadv_dat_free(struct batadv_priv *bat_priv); | 74 | void batadv_dat_free(struct batadv_priv *bat_priv); |
73 | int batadv_dat_cache_seq_print_text(struct seq_file *seq, void *offset); | 75 | int batadv_dat_cache_seq_print_text(struct seq_file *seq, void *offset); |
74 | 76 | ||
77 | #else | ||
78 | |||
79 | static inline bool | ||
80 | batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv, | ||
81 | struct sk_buff *skb) | ||
82 | { | ||
83 | return false; | ||
84 | } | ||
85 | |||
86 | static inline bool | ||
87 | batadv_dat_snoop_incoming_arp_request(struct batadv_priv *bat_priv, | ||
88 | struct sk_buff *skb, int hdr_size) | ||
89 | { | ||
90 | return false; | ||
91 | } | ||
92 | |||
93 | static inline bool | ||
94 | batadv_dat_snoop_outgoing_arp_reply(struct batadv_priv *bat_priv, | ||
95 | struct sk_buff *skb) | ||
96 | { | ||
97 | return false; | ||
98 | } | ||
99 | |||
100 | static inline bool | ||
101 | batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv, | ||
102 | struct sk_buff *skb, int hdr_size) | ||
103 | { | ||
104 | return false; | ||
105 | } | ||
106 | |||
107 | static inline bool | ||
108 | batadv_dat_drop_broadcast_packet(struct batadv_priv *bat_priv, | ||
109 | struct batadv_forw_packet *forw_packet) | ||
110 | { | ||
111 | return false; | ||
112 | } | ||
113 | |||
114 | static inline void | ||
115 | batadv_dat_init_orig_node_addr(struct batadv_orig_node *orig_node) | ||
116 | { | ||
117 | } | ||
118 | |||
119 | static inline void batadv_dat_init_own_addr(struct batadv_priv *bat_priv, | ||
120 | struct batadv_hard_iface *iface) | ||
121 | { | ||
122 | } | ||
123 | |||
124 | static inline void batadv_arp_change_timeout(struct net_device *soft_iface, | ||
125 | const char *name) | ||
126 | { | ||
127 | } | ||
128 | |||
129 | static inline int batadv_dat_init(struct batadv_priv *bat_priv) | ||
130 | { | ||
131 | return 0; | ||
132 | } | ||
133 | |||
134 | static inline void batadv_dat_free(struct batadv_priv *bat_priv) | ||
135 | { | ||
136 | } | ||
137 | |||
138 | #endif /* CONFIG_BATMAN_ADV_DAT */ | ||
139 | |||
75 | #endif /* _NET_BATMAN_ADV_ARP_H_ */ | 140 | #endif /* _NET_BATMAN_ADV_ARP_H_ */ |
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h index 9ed1bb275d31..00d3093f3a9c 100644 --- a/net/batman-adv/types.h +++ b/net/batman-adv/types.h | |||
@@ -28,6 +28,8 @@ | |||
28 | (ETH_HLEN + max(sizeof(struct batadv_unicast_packet), \ | 28 | (ETH_HLEN + max(sizeof(struct batadv_unicast_packet), \ |
29 | sizeof(struct batadv_bcast_packet))) | 29 | sizeof(struct batadv_bcast_packet))) |
30 | 30 | ||
31 | #ifdef CONFIG_BATMAN_ADV_DAT | ||
32 | |||
31 | /* batadv_dat_addr_t is the type used for all DHT addresses. If it is changed, | 33 | /* batadv_dat_addr_t is the type used for all DHT addresses. If it is changed, |
32 | * BATADV_DAT_ADDR_MAX is changed as well. | 34 | * BATADV_DAT_ADDR_MAX is changed as well. |
33 | * | 35 | * |
@@ -35,6 +37,8 @@ | |||
35 | */ | 37 | */ |
36 | #define batadv_dat_addr_t uint16_t | 38 | #define batadv_dat_addr_t uint16_t |
37 | 39 | ||
40 | #endif /* CONFIG_BATMAN_ADV_DAT */ | ||
41 | |||
38 | /** | 42 | /** |
39 | * struct batadv_hard_iface_bat_iv - per hard interface B.A.T.M.A.N. IV data | 43 | * struct batadv_hard_iface_bat_iv - per hard interface B.A.T.M.A.N. IV data |
40 | * @ogm_buff: buffer holding the OGM packet | 44 | * @ogm_buff: buffer holding the OGM packet |
@@ -80,7 +84,9 @@ struct batadv_orig_node { | |||
80 | uint8_t orig[ETH_ALEN]; | 84 | uint8_t orig[ETH_ALEN]; |
81 | uint8_t primary_addr[ETH_ALEN]; | 85 | uint8_t primary_addr[ETH_ALEN]; |
82 | struct batadv_neigh_node __rcu *router; /* rcu protected pointer */ | 86 | struct batadv_neigh_node __rcu *router; /* rcu protected pointer */ |
87 | #ifdef CONFIG_BATMAN_ADV_DAT | ||
83 | batadv_dat_addr_t dat_addr; | 88 | batadv_dat_addr_t dat_addr; |
89 | #endif | ||
84 | unsigned long *bcast_own; | 90 | unsigned long *bcast_own; |
85 | uint8_t *bcast_own_sum; | 91 | uint8_t *bcast_own_sum; |
86 | unsigned long last_seen; | 92 | unsigned long last_seen; |
@@ -252,11 +258,13 @@ struct batadv_priv_vis { | |||
252 | * @hash: hashtable representing the local ARP cache | 258 | * @hash: hashtable representing the local ARP cache |
253 | * @work: work queue callback item for cache purging | 259 | * @work: work queue callback item for cache purging |
254 | */ | 260 | */ |
261 | #ifdef CONFIG_BATMAN_ADV_DAT | ||
255 | struct batadv_priv_dat { | 262 | struct batadv_priv_dat { |
256 | batadv_dat_addr_t addr; | 263 | batadv_dat_addr_t addr; |
257 | struct batadv_hashtable *hash; | 264 | struct batadv_hashtable *hash; |
258 | struct delayed_work work; | 265 | struct delayed_work work; |
259 | }; | 266 | }; |
267 | #endif | ||
260 | 268 | ||
261 | struct batadv_priv { | 269 | struct batadv_priv { |
262 | atomic_t mesh_state; | 270 | atomic_t mesh_state; |
@@ -295,7 +303,9 @@ struct batadv_priv { | |||
295 | struct batadv_priv_gw gw; | 303 | struct batadv_priv_gw gw; |
296 | struct batadv_priv_tt tt; | 304 | struct batadv_priv_tt tt; |
297 | struct batadv_priv_vis vis; | 305 | struct batadv_priv_vis vis; |
306 | #ifdef CONFIG_BATMAN_ADV_DAT | ||
298 | struct batadv_priv_dat dat; | 307 | struct batadv_priv_dat dat; |
308 | #endif | ||
299 | }; | 309 | }; |
300 | 310 | ||
301 | struct batadv_socket_client { | 311 | struct batadv_socket_client { |