aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/soft-interface.c
diff options
context:
space:
mode:
authorAntonio Quartulli <ordex@autistici.org>2011-06-25 21:37:18 -0400
committerAntonio Quartulli <ordex@autistici.org>2012-11-07 14:00:21 -0500
commitc384ea3ec930ef11060a7308fbbd02b4871384f9 (patch)
tree14764f1a722c0a5633aa9dc5cebc19081703d446 /net/batman-adv/soft-interface.c
parent5c3a0e5535933349a5d6e6bc8b704e0611f21d3f (diff)
batman-adv: Distributed ARP Table - add snooping functions for ARP messages
In case of an ARP message going in or out the soft_iface, it is intercepted and a special action is performed. In particular the DHT helper functions previously implemented are used to store all the ARP entries belonging to the network in order to provide a fast and unicast lookup instead of the classic broadcast flooding mechanism. Each node stores the entries it is responsible for (following the DHT rules) in its soft_iface ARP table. This makes it possible to reuse the kernel data structures and functions for ARP management. Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net/batman-adv/soft-interface.c')
-rw-r--r--net/batman-adv/soft-interface.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 2f123a1b174b..9dc0ae1d4da3 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -20,6 +20,7 @@
20#include "main.h" 20#include "main.h"
21#include "soft-interface.h" 21#include "soft-interface.h"
22#include "hard-interface.h" 22#include "hard-interface.h"
23#include "distributed-arp-table.h"
23#include "routing.h" 24#include "routing.h"
24#include "send.h" 25#include "send.h"
25#include "debugfs.h" 26#include "debugfs.h"
@@ -155,6 +156,7 @@ static int batadv_interface_tx(struct sk_buff *skb,
155 short vid __maybe_unused = -1; 156 short vid __maybe_unused = -1;
156 bool do_bcast = false; 157 bool do_bcast = false;
157 uint32_t seqno; 158 uint32_t seqno;
159 unsigned long brd_delay = 1;
158 160
159 if (atomic_read(&bat_priv->mesh_state) != BATADV_MESH_ACTIVE) 161 if (atomic_read(&bat_priv->mesh_state) != BATADV_MESH_ACTIVE)
160 goto dropped; 162 goto dropped;
@@ -224,6 +226,13 @@ static int batadv_interface_tx(struct sk_buff *skb,
224 if (!primary_if) 226 if (!primary_if)
225 goto dropped; 227 goto dropped;
226 228
229 /* in case of ARP request, we do not immediately broadcasti the
230 * packet, instead we first wait for DAT to try to retrieve the
231 * correct ARP entry
232 */
233 if (batadv_dat_snoop_outgoing_arp_request(bat_priv, skb))
234 brd_delay = msecs_to_jiffies(ARP_REQ_DELAY);
235
227 if (batadv_skb_head_push(skb, sizeof(*bcast_packet)) < 0) 236 if (batadv_skb_head_push(skb, sizeof(*bcast_packet)) < 0)
228 goto dropped; 237 goto dropped;
229 238
@@ -245,7 +254,7 @@ static int batadv_interface_tx(struct sk_buff *skb,
245 seqno = atomic_inc_return(&bat_priv->bcast_seqno); 254 seqno = atomic_inc_return(&bat_priv->bcast_seqno);
246 bcast_packet->seqno = htonl(seqno); 255 bcast_packet->seqno = htonl(seqno);
247 256
248 batadv_add_bcast_packet_to_list(bat_priv, skb, 1); 257 batadv_add_bcast_packet_to_list(bat_priv, skb, brd_delay);
249 258
250 /* a copy is stored in the bcast list, therefore removing 259 /* a copy is stored in the bcast list, therefore removing
251 * the original skb. 260 * the original skb.
@@ -260,6 +269,11 @@ static int batadv_interface_tx(struct sk_buff *skb,
260 goto dropped; 269 goto dropped;
261 } 270 }
262 271
272 if (batadv_dat_snoop_outgoing_arp_request(bat_priv, skb))
273 goto dropped;
274
275 batadv_dat_snoop_outgoing_arp_reply(bat_priv, skb);
276
263 ret = batadv_unicast_send_skb(bat_priv, skb); 277 ret = batadv_unicast_send_skb(bat_priv, skb);
264 if (ret != 0) 278 if (ret != 0)
265 goto dropped_freed; 279 goto dropped_freed;