public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Antonio Quartulli <a@unstable.cc>
To: The list for a Better Approach To Mobile Ad-hoc Networking
	<b.a.t.m.a.n@lists.open-mesh.org>
Subject: Re: [B.A.T.M.A.N.] [PATCHv2 1/7] batman-adv: prevent multiple ARP replies sent by gateways if dat enabled
Date: Thu, 3 Mar 2016 05:36:01 +0800	[thread overview]
Message-ID: <20160302213601.GI7704@prodigo.lan> (raw)
In-Reply-To: <1456492666-29672-1-git-send-email-apape@phoenixcontact.com>

[-- Attachment #1: Type: text/plain, Size: 4039 bytes --]

Hi Andreas and thanks for your work on this topic :)

please find some comments inline

On Fri, Feb 26, 2016 at 02:17:46PM +0100, Andreas Pape wrote:

...

> +bool batadv_bla_handle_local_claim(struct batadv_priv *bat_priv,
> +				   u8 *addr, unsigned short vid)
> +{
> +	struct batadv_bla_claim search_claim;
> +	struct batadv_bla_claim *claim = NULL;
> +	struct batadv_hard_iface *primary_if = NULL;
> +	bool ret = true;
> +
> +	if (!atomic_read(&bat_priv->bridge_loop_avoidance))
> +		return ret;
> +
> +	primary_if = batadv_primary_if_get_selected(bat_priv);
> +	if (!primary_if)
> +		goto out;

do you really need this goto here ? I think you can just return ret.

This way you can avoid the blind initialization of claim and primary_if and you
can also remove the 'out' label at all.

> +
> +	/* First look if the mac address is claimed */
> +	ether_addr_copy(search_claim.addr, addr);
> +	search_claim.vid = vid;
> +
> +	claim = batadv_claim_hash_find(bat_priv, &search_claim);
> +
> +	/* If there is a claim and we are not owner of the claim,
> +	 * return false;

no need for the ';' here :)

> +	 */
> +	if (claim) {
> +		if (!batadv_compare_eth(claim->backbone_gw->orig,
> +					primary_if->net_dev->dev_addr))
> +			ret = false;
> +	} else {
> +		/* If there is no claim, claim the device */
> +		batadv_dbg(BATADV_DBG_BLA, bat_priv,
> +			   "Handle claim locally for currently not claimed mac %pM.\n",
> +			   search_claim.addr);
> +
> +		batadv_handle_claim(bat_priv, primary_if,
> +				    primary_if->net_dev->dev_addr, addr, vid);
> +	}
> +

...

> @@ -1000,6 +1001,20 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
>  			goto out;
>  		}
> 
> +		/* If BLA is enabled, only send ARP replies if we have claimed
> +		 * the destination for the ARP request or if no one else of
> +		 * the backbone gws belonging to our backbone has claimed the
> +		 * destination.
> +		 */
> +		if (!batadv_bla_handle_local_claim(bat_priv,
> +						   dat_entry->mac_addr, vid)) {

I like the approach you take to fix this issue, however I don't understand why
you want to "manually" claim a client.

If I recall correctly, a backbone node
will try to claim a client only if the latter tries to use such node to enter
the LAN.
In this situation the client may never use this backbone to enter the LAN (i.e. bad
metric towards this node) and therefore we are forcing a claim that is not
correct.

Simon, what do you think ?

Imho it is ok to *not* reply to the ARP request is the client is not claimed,
but I don't understand why claiming it now.


> Sitz der Gesellschaft / registered office of the company: 31812 Bad Pyrmont
> USt-Id-Nr.: DE811742156
> Amtsgericht Hannover HRB 100528 / district court Hannover HRB 100528
> Geschäftsführer / Executive Board: Roland Bent, Dr. Martin Heubeck
> ___________________________________________________________________
> Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren, jegliche anderweitige Verwendung sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.
> ----------------------------------------------------------------------------------------------------
> This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure, distribution or other use of the material or parts thereof is strictly forbidden.

Are you sure this footer does not conflict with the GPL ? Not sure how important
this is, but I'd rather not send it along with patches.
However, if you use git-send-email this footer should not appear at all.


Cheers,


-- 
Antonio Quartulli

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2016-03-02 21:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-26 13:17 [B.A.T.M.A.N.] [PATCHv2 1/7] batman-adv: prevent multiple ARP replies sent by gateways if dat enabled Andreas Pape
2016-03-02 21:36 ` Antonio Quartulli [this message]
2016-03-04  7:11   ` [B.A.T.M.A.N.] Antwort: " Andreas Pape
2016-03-10 14:36     ` Simon Wunderlich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160302213601.GI7704@prodigo.lan \
    --to=a@unstable.cc \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox