From: Vlad Yasevich <vladislav.yasevich@hp.com>
To: "Diego Elio “Flameeyes” Pettenò" <flameeyes@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-sctp@vger.kernel.org
Subject: Re: [PATCH] sctp: implement SIOCINQ ioctl()
Date: Thu, 24 Jun 2010 09:40:51 -0400 [thread overview]
Message-ID: <4C236063.9050302@hp.com> (raw)
In-Reply-To: <1277385636.13544.67.camel@yamato.local>
Diego Elio “Flameeyes” Pettenò wrote:
> Il giorno gio, 24/06/2010 alle 09.19 -0400, Vlad Yasevich ha scritto:
>> This should add a check for sctp_style(sk, TCP), since one can't read
>> from
>> a TCP style listening sockets, but can do so from UDP-style
>> (SOCK_SEQPACKET).
>
> I don't want to sound arrogant but... are you sure?
Yes, I am sure. :)
>
> I ask because the simple testcase I wrote to make sure I didn't get it
> wrong opened the socket as SOCK_STREAM, and yet all of this worked fine
> (I'm attaching the source, for the sake of it)...
>
> I sure hope you're mistaken here and it is _supposed_ to work here as
> well, as we cannot use SOCK_SEQPACKET in the software I'm writing this
> for (feng, from the lscube project) as accept() fails on SOCK_SEQPACKET
> (EOPNOTSUPP) -- which itslef is strange given that the man page for
> accept(2) reports it's supported on SOCK_STREAM and SOCK_SEQPACKET.
>
You don't call accept() on an SCTP SEQPACKET socket. You can just read from it.
SCTP uses SOCK_SEQPACKET to implement 1-to-many semantics, where you can have
multiple associations all serviced by the same socket. In that case, the socket
is placed into the listening state and then the application may simply read
from it.
Thus your code that just returns the size of the first skb should take that into
consideration.
So the condition really is:
if (sctp_style(sk, TCP) && sctp_state(sk, LISTENING))
goto out;
This way, you'll ignore listening SOCK_STREAM sockets which will not have any
data anyway, but you'll check out listening SOCK_SEQPACKET sockets that may have
data waiting on them.
-vlad
next prev parent reply other threads:[~2010-06-24 13:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-23 21:37 [PATCH] sctp: implement SIOCINQ ioctl() Diego Elio 'Flameeyes' Pettenò
2010-06-24 13:19 ` Vlad Yasevich
2010-06-24 13:20 ` Diego Elio “Flameeyes” Pettenò
2010-06-24 13:40 ` Vlad Yasevich [this message]
2010-06-24 13:44 ` Diego Elio “Flameeyes” Pettenò
2010-06-24 13:58 ` Vlad Yasevich
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=4C236063.9050302@hp.com \
--to=vladislav.yasevich@hp.com \
--cc=flameeyes@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sctp@vger.kernel.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