From: Paolo Abeni <pabeni@redhat.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
Matthew Dawson <matthew@mjdsystems.ca>
Cc: Network Development <netdev@vger.kernel.org>,
"Macieira, Thiago" <thiago.macieira@intel.com>
Subject: Re: [PATCH net] datagram: When peeking datagrams with offset < 0 don't skip empty skbs
Date: Mon, 14 Aug 2017 17:31:02 +0200 [thread overview]
Message-ID: <1502724662.8411.53.camel@redhat.com> (raw)
In-Reply-To: <CAF=yD-L9CpW-DRtKfWWWKcNKcPSWvXOkTGZoKBq6=fQMrcKVWQ@mail.gmail.com>
On Mon, 2017-08-14 at 11:03 -0400, Willem de Bruijn wrote:
> > I'm actually surprised that only unix sockets can have negative values. Is
> > there a reason for that? I had assumed that sk_set_peek_off would allow
> > negative values as the code already has to support negative values due to what
> > the initial value is.
>
> A negative initial value indicates that PEEK_OFF is disabled. It only
> makes sense to peek from a positive offset from the start of the data.
With the current code, the user space can disable peeking with offset
setting a negative offset value, after that peeking with offset has
been enabled. But only for UNIX sockets. I think the same should be
allowed for UDP sockets.
> > > I'm wondering adding an explicit SOCK_PEEK_OFF/MSG_PEEK_OFF socket flag
> > > would help simplyifing the code:
>
> The behavior needs to be bifurcated between peeking with
> offset and without offset.
>
> When peeking with offset is enabled by setting SO_PEEK_OFF,
> subsequent reads do move the offset, so the observed behavior
> is correct.
>
> When sk->sk_peek_offset is negative, offset mode is disabled
> and the same packet must be read twice.
>
> An explicit boolean flag to discern between the two may make
> the code simpler to understand, not sure whether that is logically
> required.
Yes, an explicit PEEK_OFF flag is just to keep the code simpler, so
that there is no need to add checks at every sk_peek_offset() call site
and the relevant logic can be fully encapsulated under the MSG_PEEK
branch in __skb_try_recv_from_queue(), I think/hope.
It's not a functional requirement.
Cheers,
Paolo
next prev parent reply other threads:[~2017-08-14 15:31 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-14 5:52 [PATCH net] datagram: When peeking datagrams with offset < 0 don't skip empty skbs Matthew Dawson
2017-08-14 9:27 ` Paolo Abeni
2017-08-14 14:05 ` Matthew Dawson
2017-08-14 15:03 ` Willem de Bruijn
2017-08-14 15:31 ` Paolo Abeni [this message]
2017-08-15 1:35 ` Willem de Bruijn
2017-08-15 15:40 ` Paolo Abeni
2017-08-15 16:45 ` Willem de Bruijn
2017-08-15 17:00 ` Willem de Bruijn
2017-08-16 9:28 ` Paolo Abeni
2017-08-16 15:18 ` Willem de Bruijn
2017-08-16 20:20 ` Paolo Abeni
2017-08-16 23:27 ` Willem de Bruijn
2017-08-16 23:40 ` Willem de Bruijn
2017-08-16 23:55 ` Thiago Macieira
2017-08-17 0:10 ` Willem de Bruijn
2017-08-17 9:15 ` David Laight
2017-08-17 14:37 ` Willem de Bruijn
2017-08-17 15:47 ` Matthew Dawson
2017-08-17 16:45 ` Willem de Bruijn
2017-08-15 18:17 ` Paolo Abeni
2017-08-14 16:06 ` Thiago Macieira
2017-08-14 16:33 ` Willem de Bruijn
2017-08-14 17:02 ` Thiago Macieira
2017-08-14 18:25 ` Willem de Bruijn
2017-08-14 18:33 ` Thiago Macieira
2017-08-14 18:46 ` Willem de Bruijn
2017-08-14 18:58 ` Thiago Macieira
2017-08-14 19:03 ` Willem de Bruijn
2017-08-14 19:15 ` Thiago Macieira
2017-08-14 19:39 ` Willem de Bruijn
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=1502724662.8411.53.camel@redhat.com \
--to=pabeni@redhat.com \
--cc=matthew@mjdsystems.ca \
--cc=netdev@vger.kernel.org \
--cc=thiago.macieira@intel.com \
--cc=willemdebruijn.kernel@gmail.com \
/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).