Merge branch 'quagga'
[lede-routing/.git] / batman-adv / patches / 0005-batman-adv-make-DAT-drop-ARP-requests-targeting-loca.patch
1 From d6bd8b36fa1f3d72a6fd5942a6e9bde6ddafcd0d Mon Sep 17 00:00:00 2001
2 From: Antonio Quartulli <ordex@autistici.org>
3 Date: Thu, 9 May 2013 09:35:45 +0200
4 Subject: [PATCH 05/10] batman-adv: make DAT drop ARP requests targeting local
5  clients
6
7 In the outgoing ARP request snooping routine in DAT, ARP
8 Request sent by local clients which are supposed to be
9 replied by other local clients can be silently dropped.
10
11 The destination host will reply by itself through the LAN
12 and therefore there is no need to involve DAT.
13
14 Reported-by: Carlos Quijano <carlos@crqgestion.es>
15 Signed-off-by: Antonio Quartulli <ordex@autistici.org>
16 Tested-by: Carlos Quijano <carlos@crqgestion.es>
17 Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
18 ---
19  distributed-arp-table.c |   13 +++++++++++++
20  1 file changed, 13 insertions(+)
21
22 diff --git a/distributed-arp-table.c b/distributed-arp-table.c
23 index 8e15d96..2399920 100644
24 --- a/distributed-arp-table.c
25 +++ b/distributed-arp-table.c
26 @@ -837,6 +837,19 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
27  
28         dat_entry = batadv_dat_entry_hash_find(bat_priv, ip_dst);
29         if (dat_entry) {
30 +               /* If the ARP request is destined for a local client the local
31 +                * client will answer itself. DAT would only generate a
32 +                * duplicate packet.
33 +                *
34 +                * Moreover, if the soft-interface is enslaved into a bridge, an
35 +                * additional DAT answer may trigger kernel warnings about
36 +                * a packet coming from the wrong port.
37 +                */
38 +               if (batadv_is_my_client(bat_priv, dat_entry->mac_addr)) {
39 +                       ret = true;
40 +                       goto out;
41 +               }
42 +
43                 skb_new = arp_create(ARPOP_REPLY, ETH_P_ARP, ip_src,
44                                      bat_priv->soft_iface, ip_dst, hw_src,
45                                      dat_entry->mac_addr, hw_src);
46 -- 
47 1.7.10.4
48