b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: Re: [PATCH v6 2/3] batman-adv: mcast: implement multicast packet generation
Date: Sat, 29 Jul 2023 12:49:29 +0200	[thread overview]
Message-ID: <2654113.Lt9SDvczpP@sven-l14> (raw)
In-Reply-To: <20230720043556.12163-3-linus.luessing@c0d3.blue>

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

On Thursday, 20 July 2023 06:35:54 CEST Linus Lüssing wrote:
> Implement the preparation of a batman-adv multicast packet and use this
> under certain conditions.
> 
> For one thing this implements the capability to push a complete
> batman-adv multicast packet header, including a tracker TVLV with all
> originator destinations that have signaled interest in it, onto a given
> ethernet frame with an IP multicast packet inside.
> 
> For another checks are implemented to determine if encapsulating a
> multicast packet in this new batman-adv multicast packet type and using
> it is feasible. Those checks are:
> 
> 1) Have all nodes signaled that they are capable of handling the new
>    batman-adv multicast packet type?
> 2) Do all active hard interfaces of all nodes, including us, have an MTU
>    of at least 1280 bytes?
> 3) Does a complete multicast packet header with all its destination
>    addresses fit onto the given multicast packet / ethernet frame and
>    does not exceed 1280 bytes?
> 
> If all checks passed then the new batman-adv multicast packet type will
> be used for transmission and distribution. Otherwise we fall back to one or
> more batman-adv unicast packet transmissions, if possible. Or if not
> possible we will fall back to classic flooding through a batman-adv
> broadcast packet.
> 
> Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
> ---
>  net/batman-adv/multicast.c      |  79 +++-
>  net/batman-adv/multicast.h      |  25 +-
>  net/batman-adv/multicast_forw.c | 727 ++++++++++++++++++++++++++++++++
>  net/batman-adv/soft-interface.c |   6 +-
>  net/batman-adv/types.h          |   6 +
>  5 files changed, 835 insertions(+), 8 deletions(-)

Acked-by: Sven Eckelmann <sven@narfation.org>

> +/**
> + * batadv_mcast_forw_scrape() - remove bytes within skb data
> + * @skb: the skb to remove bytes from
> + * @offset: the offset from the skb data from which to scrape
> + * @len: the amount of bytes to scrape starting from the offset
> + *
> + * Scrapes/removes len bytes from the given skb at the given offset from the
> + * skb data.
> + *
> + * Caller needs to ensure that the region from the skb data's start up
> + * to/including the to be removed bytes are linearized.
> + */
> +static void batadv_mcast_forw_scrape(struct sk_buff *skb,
> +				     unsigned short offset,
> +				     unsigned short len)
> +{
> +	char *to = skb_pull(skb, len), *from = to - len;
> +
> +	memmove(to, from, offset);
> +}

Just because I remembered it when reading a comment: SKB_LINEAR_ASSERT(skb) 
might be a good idea in places like this. Not all over the place but actually 
in the code which operates on the buffer and assumes the skbuff to be 
linearized. skb_put would do such a check (because it is a put at the end of 
the skb) but not an skb_pull.

Kind regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2023-07-29 10:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-20  4:35 [PATCH v6 0/3] Implementation of a Stateless Multicast Packet Type Linus Lüssing
2023-07-20  4:35 ` [PATCH v6 1/3] batman-adv: mcast: implement multicast packet reception and forwarding Linus Lüssing
2023-07-28 17:52   ` Sven Eckelmann
2023-08-14 15:35   ` Simon Wunderlich
2023-08-14 15:53     ` Simon Wunderlich
2023-07-20  4:35 ` [PATCH v6 2/3] batman-adv: mcast: implement multicast packet generation Linus Lüssing
2023-07-29 10:49   ` Sven Eckelmann [this message]
2023-07-20  4:35 ` [PATCH v6 3/3] batman-adv: mcast: shrink tracker packet after scrubbing Linus Lüssing
2023-07-29 11:11   ` Sven Eckelmann
2023-08-14 15:56   ` Simon Wunderlich
2023-07-29 11:11 ` [PATCH v6 0/3] Implementation of a Stateless Multicast Packet Type Sven Eckelmann
2023-08-14 16:05   ` 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=2654113.Lt9SDvczpP@sven-l14 \
    --to=sven@narfation.org \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).