From: Stefan Rompf <stefan@loplof.de>
To: David Miller <davem@davemloft.net>
Cc: herbert@gondor.apana.org.au, simon@fire.lp0.eu,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: sockets affected by IPsec always block (2.6.23)
Date: Thu, 6 Dec 2007 11:56:48 +0100 [thread overview]
Message-ID: <200712061156.48810.stefan@loplof.de> (raw)
In-Reply-To: <20071206.005344.74817074.davem@davemloft.net>
Am Donnerstag, 6. Dezember 2007 09:53 schrieb David Miller:
> > I think the words "shall fail" and "immediately" are quite clear.
>
> They are, but the context in which they apply is vague.
"socket is connection-mode" => SOCK_STREAM
> I can equally generate examples where the non-blocking behavior you
> are a proponent of would break non-blocking UDP apps during a
> sendmsg() call when we hit IPSEC resolution. Yet similar language on
> blocking semantics exists for sendmsg() in the standards.
I am not a good enough kernel hacker to exactly understand the code flow in
udp_sendmsg(). However, it seems that it first checks destination validity
via ip_route_output_flow() and queues the message then. The sendmsg()
documentation only talks about buffer space. I can see your dilemma.
The reason why I'm pushing this issue another time is that I know quite a
bit about system level application development. A very typical design pattern
for non-naive single or multi threaded programs is that they set all
communication sockets to be nonblocking and use a select()/epoll() based loop
to dispatch IO. This often includes initiating a TCP connect() and
asynchronously waiting for it to finish or fail from the main loop.
The dangerous situation here is that in 99% of all cases things will just work
because the phase 2 SA exists. In 0.8%, the SA will be established in <1 sec.
However, in the rest of time the server application that you have considered
to be stable will end up sleeping with all threads in a connect() call that
is supposed to return immediatly.
> The world is shades of gray, implying anything else is foolhardy and
> that's how I'm handling this.
Even though I consider programmers that ignore the result code on a
nonblocking UDP sendmsg() fools, I agree. May be the best compromise is what
Herbert Xu suggested in <20071205001230.GA11391@gondor.apana.org.au> in this
thread: At least, for connect() O_NONBLOCK ist ALWAYS respected. Because this
is where the chance for breakage is highest.
Stefan
next prev parent reply other threads:[~2007-12-06 10:58 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-04 18:53 sockets affected by IPsec always block (2.6.23) Simon Arlott
2007-12-05 0:12 ` Herbert Xu
2007-12-05 6:30 ` David Miller
2007-12-05 6:51 ` Herbert Xu
2007-12-05 7:12 ` David Miller
2007-12-05 7:16 ` Herbert Xu
2007-12-05 7:34 ` David Miller
2007-12-05 7:39 ` Herbert Xu
2007-12-05 9:55 ` David Miller
2007-12-05 9:57 ` Herbert Xu
2007-12-05 18:42 ` Stefan Rompf
2007-12-05 18:39 ` Stefan Rompf
2007-12-06 2:25 ` David Miller
2007-12-06 8:49 ` Stefan Rompf
2007-12-06 8:53 ` David Miller
2007-12-06 10:56 ` Stefan Rompf [this message]
2007-12-06 11:13 ` David Miller
2007-12-06 11:35 ` Stefan Rompf
2007-12-06 11:39 ` David Miller
2007-12-06 12:30 ` Stefan Rompf
2007-12-06 13:55 ` David Miller
2007-12-06 14:31 ` Stefan Rompf
2007-12-07 3:20 ` David Miller
2007-12-07 9:29 ` Stefan Rompf
2007-12-16 22:47 ` Bill Davidsen
2007-12-16 23:22 ` David Miller
2007-12-05 6:06 ` David Miller
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=200712061156.48810.stefan@loplof.de \
--to=stefan@loplof.de \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=simon@fire.lp0.eu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.