login
Header Space

 
 

Re: sockets affected by IPsec always block (2.6.23)

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: David Miller <davem@...>
Cc: <herbert@...>, <simon@...>, <linux-kernel@...>, <netdev@...>
Date: Thursday, December 6, 2007 - 6:56 am

Am Donnerstag, 6. Dezember 2007 09:53 schrieb David Miller:


"socket is connection-mode" => SOCK_STREAM


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.


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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
sockets affected by IPsec always block (2.6.23), Simon Arlott, (Tue Dec 4, 2:53 pm)
Re: sockets affected by IPsec always block (2.6.23), Herbert Xu, (Tue Dec 4, 8:12 pm)
Re: sockets affected by IPsec always block (2.6.23), David Miller, (Wed Dec 5, 2:30 am)
Re: sockets affected by IPsec always block (2.6.23), Herbert Xu, (Wed Dec 5, 2:51 am)
Re: sockets affected by IPsec always block (2.6.23), Stefan Rompf, (Wed Dec 5, 2:39 pm)
Re: sockets affected by IPsec always block (2.6.23), David Miller, (Wed Dec 5, 10:25 pm)
Re: sockets affected by IPsec always block (2.6.23), Stefan Rompf, (Thu Dec 6, 4:49 am)
Re: sockets affected by IPsec always block (2.6.23), David Miller, (Thu Dec 6, 4:53 am)
Re: sockets affected by IPsec always block (2.6.23), Stefan Rompf, (Thu Dec 6, 6:56 am)
Re: sockets affected by IPsec always block (2.6.23), David Miller, (Thu Dec 6, 7:13 am)
Re: sockets affected by IPsec always block (2.6.23), Stefan Rompf, (Thu Dec 6, 7:35 am)
Re: sockets affected by IPsec always block (2.6.23), David Miller, (Thu Dec 6, 7:39 am)
Re: sockets affected by IPsec always block (2.6.23), Stefan Rompf, (Thu Dec 6, 8:30 am)
Re: sockets affected by IPsec always block (2.6.23), David Miller, (Thu Dec 6, 9:55 am)
Re: sockets affected by IPsec always block (2.6.23), Stefan Rompf, (Thu Dec 6, 10:31 am)
Re: sockets affected by IPsec always block (2.6.23), David Miller, (Thu Dec 6, 11:20 pm)
Re: sockets affected by IPsec always block (2.6.23), Stefan Rompf, (Fri Dec 7, 5:29 am)
Re: sockets affected by IPsec always block (2.6.23), David Miller, (Wed Dec 5, 3:12 am)
Re: sockets affected by IPsec always block (2.6.23), Stefan Rompf, (Wed Dec 5, 2:42 pm)
Re: sockets affected by IPsec always block (2.6.23), Herbert Xu, (Wed Dec 5, 3:16 am)
Re: sockets affected by IPsec always block (2.6.23), David Miller, (Wed Dec 5, 3:34 am)
Re: sockets affected by IPsec always block (2.6.23), Herbert Xu, (Wed Dec 5, 3:39 am)
Re: sockets affected by IPsec always block (2.6.23), David Miller, (Wed Dec 5, 5:55 am)
Re: sockets affected by IPsec always block (2.6.23), Herbert Xu, (Wed Dec 5, 5:57 am)
Re: sockets affected by IPsec always block (2.6.23), David Miller, (Wed Dec 5, 2:06 am)
speck-geostationary