On Fri, May 06, 2016 at 10:58:23AM +0200, Andreas Pape wrote:
> Speeding up dat address lookup is achieved by snooping all incoming ip
> traffic. This especially increases the propability in bla setups that
> a gateway into a common backbone network already has a fitting dat entry
> to answer incoming ARP requests directly coming from the backbone
> network thus further reducing ARP traffic in the mesh.
> 
> Signed-off-by: Andreas Pape <ap...@phoenixcontact.com>
> ---

This patch looks interesting :). Currently we have quite some
ARP-requests from gateways to clients left in Freifunk setups (had
been asking Antonio about it just yesterday) and looks like this
patch could help here.

> +void batadv_dat_entry_check(struct batadv_priv *bat_priv, struct sk_buff 
> *skb,
> +                         unsigned short vid)
> +{
[...]
> +             batadv_dat_entry_add(bat_priv, iphdr->saddr,
> +                                  ethhdr->h_source, vid);
> +     }
> +}

There is something in batadv_dat_entry_add() that makes me a
little worried:

----
        if (dat_entry) {
                if (!batadv_compare_eth(dat_entry->mac_addr,
                                        mac_addr))
                        ether_addr_copy(dat_entry->mac_addr, mac_addr);
----

ether_addr_copy() isn't atomic, there is a race condition between
the update and any such check - like the one just above it.

This isn't really a bug of your patchset, but could make this race
condition much more likely. In the worst case, a fast IP packet
stream would create a constant rewrite and mostly broken
dat_entry->mac_addr.

Reply via email to