b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: "Linus Lüssing" <linus.luessing@c0d3.blue>
To: Sven Eckelmann <sven@narfation.org>
Cc: b.a.t.m.a.n@lists.open-mesh.org
Subject: Re: [PATCH v4 3/5] batman-adv: mcast: implement multicast packet reception and forwarding
Date: Mon, 16 Jan 2023 19:31:13 +0100	[thread overview]
Message-ID: <Y8WX8a0REDduYlKW@sellars> (raw)
In-Reply-To: <7420352.31tnzDBltd@sven-l14>

On Sun, Jan 15, 2023 at 06:56:37PM +0100, Sven Eckelmann wrote:
> [...]
> > +static void
> > +batadv_mcast_forw_scrub_dests(struct batadv_priv *bat_priv,
> > +			      struct batadv_neigh_node *comp_neigh, u8 *dest,
> > +			      u8 *next_dest, u16 num_dests)
> > +{
> > +	struct batadv_neigh_node *next_neigh;
> > +
> > +	/* skip first entry, this is what we are comparing with */
> > +	eth_zero_addr(dest);
> > +	dest += ETH_ALEN;
> > +	next_dest += ETH_ALEN;
> > +	num_dests--;
> > +
> > +	batadv_mcast_forw_tracker_for_each_dest(next_dest, num_dests) {
> > +		if (is_zero_ether_addr(next_dest))
> > +			goto scrub_next;
> > +
> > +		if (is_multicast_ether_addr(next_dest)) {
> > +			eth_zero_addr(dest);
> > +			eth_zero_addr(next_dest);
> > +			goto scrub_next;
> > +		}
> > +
> > +		next_neigh = batadv_mcast_forw_orig_to_neigh(bat_priv,
> > +							     next_dest);
> > +		if (!next_neigh) {
> > +			eth_zero_addr(next_dest);
> 
> Why is the original skb not touched in this case?
> 
> It might not be a problem because you are also doing the 
> batadv_mcast_forw_orig_to_neigh check in batadv_mcast_forw_packet. But I was 
> just wondering about it

I actually thought the same at some point, to potentially reduce the
number of neighbor node lookups, and tried it. And then
realized that it can break local reception. The destination
address might be our own one and then the neighbor node lookup
will return NULL, too.

So instead of adding another batadv_is_my_mac() check in yet
another place and branching here in scrub_dests(), I thought I'd keep
it simple.

I could also add these two lines in scrub_dests(), the check and zeroing,
I'm just not quite sure if we would overall gain something with it, as
batadv_is_my_mac() can be a bit expensive at the moment when there are
many interfaces?

> 
> 
> Btw. it could happen that you send out a packet with zero destinations in the 
> TVLV because the neighbor disappeared between the 
> batadv_mcast_forw_orig_to_neigh in batadv_mcast_forw_packet and in 
> batadv_mcast_forw_scrub_dests

Ah good point. Hm, the protocol should be robust enough on
the receiver side to handle it. And it should overall happen very rarely.
I'm indifferent to adding two more lines of code to check that.

> 
> Kind regards,
> 	Sven


  reply	other threads:[~2023-01-16 18:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-27 19:34 [PATCH v4 0/5] Implementation of a Stateless Multicast Packet Type Linus Lüssing
2022-12-27 19:34 ` [PATCH v4 1/5] batman-adv: mcast: remove now redundant single ucast forwarding Linus Lüssing
2023-01-06 17:21   ` Sven Eckelmann
2022-12-27 19:34 ` [PATCH v4 2/5] batman-adv: tvlv: prepare for tvlv enabled multicast packet type Linus Lüssing
2023-01-06 17:54   ` Sven Eckelmann
2022-12-27 19:34 ` [PATCH v4 3/5] batman-adv: mcast: implement multicast packet reception and forwarding Linus Lüssing
2023-01-15 17:56   ` Sven Eckelmann
2023-01-16 18:31     ` Linus Lüssing [this message]
2023-01-19 12:47   ` Simon Wunderlich
2023-01-21 13:15     ` Linus Lüssing
2022-12-27 19:34 ` [PATCH v4 4/5] batman-adv: mcast: implement multicast packet generation Linus Lüssing
2023-01-18 21:15   ` Sven Eckelmann
2022-12-27 19:34 ` [PATCH v4 5/5] batman-adv: mcast: shrink tracker packet after scrubbing Linus Lüssing
2023-01-18 21:29   ` Sven Eckelmann
2023-01-27  9:26 ` [PATCH v4 0/5] Implementation of a Stateless Multicast Packet Type Sven Eckelmann

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=Y8WX8a0REDduYlKW@sellars \
    --to=linus.luessing@c0d3.blue \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=sven@narfation.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;
as well as URLs for NNTP newsgroup(s).