From: "Linus Lüssing" <linus.luessing@c0d3.blue>
To: The list for a Better Approach To Mobile Ad-hoc Networking
<b.a.t.m.a.n@lists.open-mesh.org>
Subject: Re: [PATCH v2] batman-adv: bcast: queue per interface, if needed
Date: Fri, 14 May 2021 13:35:32 +0200 [thread overview]
Message-ID: <20210514113532.GF2222@otheros> (raw)
In-Reply-To: <3148825.KiqjeL1upR@sven-desktop>
On Fri, May 14, 2021 at 10:28:53AM +0200, Sven Eckelmann wrote:
> On Tuesday, 27 April 2021 20:45:27 CEST Linus Lüssing wrote:
> > - * The skb is not consumed, so the caller should make sure that the
> > - * skb is freed.
> > + * This call clones the given skb, hence the caller needs to take into
> > + * account that the data segment of the original skb might not be
> > + * modifiable anymore.
>
> But none of your callers is now taking care of it because you've removed all
> skb_copy's. All you do is to clone the control data and give it to the
> underlying layers. And they may write freely to the data. Thus breaking
> parallel (and under some circumstances sequential) running code which operates
> on the skbs.
Hi Sven,
Thanks for looking at it so far. I'm not quite sure if the
skb_copy() is needed though. Because there is a new skb_cow(). Let
me explain my thoughts:
We have two cases: A) Packet originating from ourself, via
batadv_interface_tx(). Or B) received+forwarded from a neighbor
node via batadv_recv_bcast_packet().
For case A), self generated:
When we send the packet multiple times, for each rebroadcast or
interface we will push the ethernet header and write the ether-src,
ether-dest and ether protocol in batadv_send_skb_packet(). Before that
batadv_send_skb_packet() calls batadv_skb_head_push() which calls
skb_cow_head(). So the ethernet header should be modifiable safely then,
even if it is an skb clone.
For case B), received/forwarded:
Rebroadcasts same as in A), but additionally after rebroadcasting
with potential requeuing in batadv_recv_bcast_packet() via
batadv_forw_bcast_packet() we will also call
batadv_interface_rx() and strip the batman header. Betweeen these
calls there is the following though:
batadv_forw_bcast_packet(skb, ...)
-> __batadv_forw_bcast_packet(skb, ...);
...
skb_cow(skb, 0)
So the original skb will have been made uncloned/writeable again
via the skb_cow() before being handed to batadv_interface_rx().
Let me know if I'm missing something.
Regards, Linus
next prev parent reply other threads:[~2021-05-14 11:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-27 18:45 [PATCH v2] batman-adv: bcast: queue per interface, if needed Linus Lüssing
2021-05-14 8:28 ` Sven Eckelmann
2021-05-14 11:35 ` Linus Lüssing [this message]
2021-05-14 11:52 ` 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=20210514113532.GF2222@otheros \
--to=linus.luessing@c0d3.blue \
--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