Project

General

Profile

Bug #216 » 0001-batman-adv-avoid-DAT-to-mess-up-LAN-state.patch

Antonio Quartulli, 06/01/2015 05:35 PM

View differences:

distributed-arp-table.c
* @bat_priv: the bat priv with all the soft interface information
* @skb: packet to check
* @hdr_size: size of the encapsulation header
*
* Returns true if the packet was snooped and consumed by DAT. False if the
* packet has to be delivered to the interface
*/
bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv,
struct sk_buff *skb, int hdr_size)
......
uint16_t type;
__be32 ip_src, ip_dst;
uint8_t *hw_src, *hw_dst;
bool ret = false;
bool dropped = false;
unsigned short vid;
if (!atomic_read(&bat_priv->distributed_arp_table))
......
/* if this REPLY is directed to a client of mine, let's deliver the
* packet to the interface
*/
ret = !batadv_is_my_client(bat_priv, hw_dst, vid);
dropped = !batadv_is_my_client(bat_priv, hw_dst, vid);
/* if this REPLY is sent on behalf of a client of mine, let's drop the
* packet because the client will reply by itself
*/
dropped |= batadv_is_my_client(bat_priv, hw_src, vid);
out:
if (ret)
if (dropped)
kfree_skb(skb);
/* if ret == false -> packet has to be delivered to the interface */
return ret;
/* if dropped == false -> deliver to the interface */
return dropped;
}
/**
(1-1/4)