From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Simon Wunderlich Date: Fri, 01 Jul 2016 16:11:12 +0200 Message-ID: <1763113.8FgPGrc5MB@prime> In-Reply-To: <1465557064-24406-4-git-send-email-apape@phoenixcontact.com> References: <1465557064-24406-1-git-send-email-apape@phoenixcontact.com> <1465557064-24406-4-git-send-email-apape@phoenixcontact.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2850835.UUXfNiJrUx"; micalg="pgp-sha512"; protocol="application/pgp-signature" Subject: Re: [B.A.T.M.A.N.] [PATCH v5 3/6] batman-adv: prevent duplication of ARP replies when DAT is used List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: b.a.t.m.a.n@lists.open-mesh.org --nextPart2850835.UUXfNiJrUx Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" On Friday 10 June 2016 13:11:01 Andreas Pape wrote: > If none of the backbone gateways in a bla setup has already knowledge of > the mac address searched for in an incoming ARP request from the backbone > an address resolution via the DHT of DAT is started. The gateway can send > several ARP requests to different DHT nodes and therefore can get several > replies. This patch assures that not all of the possible ARP replies are > returned to the backbone by checking the local DAT cache of the gateway. > If there is an entry in the local cache the gateway has already learned > the requested address and there is no need to forward the additional reply > to the backbone. > Furthermore it is checked if this gateway has claimed the source of the ARP > reply and only forwards it to the backbone if it has claimed the source or > if there is no claim at all. Acked-by: Simon Wunderlich but one small style suggestion below: > > Signed-off-by: Andreas Pape > --- > net/batman-adv/distributed-arp-table.c | 32 > ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 > deletions(-) > > diff --git a/net/batman-adv/distributed-arp-table.c > b/net/batman-adv/distributed-arp-table.c index 998a4b8..e7b054a 100644 > --- a/net/batman-adv/distributed-arp-table.c > +++ b/net/batman-adv/distributed-arp-table.c > @@ -1244,6 +1244,7 @@ bool batadv_dat_snoop_incoming_arp_reply(struct > batadv_priv *bat_priv, __be32 ip_src, ip_dst; > u8 *hw_src, *hw_dst; > bool dropped = false; > + struct batadv_dat_entry *dat_entry = NULL; > unsigned short vid; > > if (!atomic_read(&bat_priv->distributed_arp_table)) > @@ -1263,12 +1264,41 @@ bool batadv_dat_snoop_incoming_arp_reply(struct > batadv_priv *bat_priv, hw_dst = batadv_arp_hw_dst(skb, hdr_size); > ip_dst = batadv_arp_ip_dst(skb, hdr_size); > > + /* If ip_dst is already in cache and has the right mac address, > + * drop this frame if this ARP reply is destined for us because it's > + * most probably an ARP reply generated by another node of the DHT. > + * We have most probably received already a reply earlier. Delivering > + * this frame would lead to doubled receive of an ARP reply. > + */ > + dat_entry = batadv_dat_entry_hash_find(bat_priv, ip_src, vid); > + if ((dat_entry) && (batadv_compare_eth(hw_src, dat_entry->mac_addr))) { you can drop the braces for dat_entry and batadv_compare_eth here. Cheers, Simon --nextPart2850835.UUXfNiJrUx Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABCgAGBQJXdnoAAAoJEKEr45hCkp6h8GoQAIXZcrn7qTZ7XwLgiCccLStF pNkxS8b7wseez3pKTUB65Oqriaa10kXCqrg14UoIrBtXWAPeHbJYU3jVmQcJZYyW 88y577BMdnjbI0ufu+XW+ycYyOYp1fz7on0xkmw7zl01OAcYc9kpinOwCFzhaDzp kEH/iSXltrOLBC8kkuHBmpSkz4U4BxB7XIKVCtkGn79KRa5SMu/8b8qgpFQOhpIO jbNvHidl9TDceWl6qbGerCtK7uPsOz1xZdkx2lmU0tnVe66/haz3lVX1QIiWF4mG UaTj0ufQNEEO4q0ELZNv3OAyjrmox9MAIFe3sIy93ObvyCaUsEErPNzr8DPZ9Ha/ itAL1bzOkhRc7TkCzQsPyWX/c2nA1r4HQRt+WCQ2eLEcuuX1t6PQoo74OYtvRZQP Kg8t7tTLE03GJ7yi96KI1cUn2U2wCoXJoVKmV8GttC8LxiXva55DICAA9hDuOo/E MdJsG2Is+A52ESv73aEtmbTD+S0p3oJu/GWDQ8+v4XPX9aQjykScb/r2PhdOYq/Z IihHCpnklT8/C0igTM4bFevBHaCHaa927J2+M7u3yYyesVm/nwpkoIfD7R4iDDNL j5JTuP6eCF6Zzgv2gbdA1bIJtaF/CWeuy1dhBk+4yYVJaxF3s8pEYlG9Ya8kNLy/ NxfNopxm+M3sEgShWkwb =j2PI -----END PGP SIGNATURE----- --nextPart2850835.UUXfNiJrUx--