linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* sockets affected by IPsec always block (2.6.23)
@ 2007-12-04 18:53 Simon Arlott
  2007-12-05  0:12 ` Herbert Xu
  2007-12-05  6:06 ` David Miller
  0 siblings, 2 replies; 27+ messages in thread
From: Simon Arlott @ 2007-12-04 18:53 UTC (permalink / raw)
  To: Linux Kernel Mailing List, netdev

If I have a IPsec rule like:
	spdadd 192.168.7.8 1.2.3.4 any -P out ipsec esp/transport//require;
(i.e. a remote host 1.2.3.4 which will not respond)

Then any attempt to communicate with 1.2.3.4 will block, even when using non-blocking sockets:

socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3
setsockopt(3, SOL_SOCKET, SO_LINGER, {onoff=1, linger=0}, 8) = 0
setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
fcntl64(3, F_GETFL)                     = 0x2 (flags O_RDWR)
fcntl64(3, F_SETFL, O_RDWR|O_NONBLOCK)  = 0 <-- non-blocking socket
connect(3, {sa_family=AF_INET, sin_port=htons(22), sin_addr=inet_addr("1.2.3.4")}, 16 <-- blocked connect()

[277657.564773] netcat        S b06bcf20     0  9450   9449
[277657.564785]        c8d51d28 00200046 00200046 b06bcf20 00200286 c8d51d14 00200286 c8d51d84
[277657.564814]        b06bcf20 c8d51d28 b013680b c8d51d84 eeae8800 c8d51d78 c8d51dd0 b04d3fc5
[277657.564843]        c8d51da4 00000002 00000001 ede87284 00000002 00000040 e9318ac0 db3f20a0
[277657.564874] Call Trace:
[277657.564881]  [<b04d3fc5>] __xfrm_lookup+0x2f5/0x510
[277657.564905]  [<b0494f9e>] ip_route_output_flow+0x4e/0x80
[277657.564919]  [<b04af303>] tcp_v4_connect+0x183/0x6d0
[277657.564934]  [<b04beaf2>] inet_stream_connect+0x122/0x1c0
[277657.564949]  [<b0471c8e>] sys_connect+0x9e/0xd0
[277657.564963]  [<b0472785>] sys_socketcall+0xa5/0x230
[277657.564973]  [<b01042ba>] syscall_call+0x7/0xb
[277657.564984]  =======================

I had a process using non-blocking sockets stuck in connect() for over 8 hours because of this...

00002630 <__xfrm_lookup>:
...
    290b:   b8 00 00 00 00          mov    $0x0,%eax
            290c: R_386_32  km_waitq
    2910:   e8 fc ff ff ff          call   2911 <__xfrm_lookup+0x2e1>
            2911: R_386_PC32    add_wait_queue
    2915:   a1 00 00 00 00          mov    0x0,%eax
            2916: R_386_32  per_cpu__current_task
    291a:   c7 00 01 00 00 00       movl   $0x1,(%eax)
    2920:   e8 fc ff ff ff          call   2921 <__xfrm_lookup+0x2f1>
            2921: R_386_PC32    schedule
    2925:   a1 00 00 00 00          mov    0x0,%eax
            2926: R_386_32  per_cpu__current_task
    292a:   c7 00 00 00 00 00       movl   $0x0,(%eax)
    2930:   b8 00 00 00 00          mov    $0x0,%eax
            2931: R_386_32  km_waitq
    2935:   89 da                   mov    %ebx,%edx
    2937:   e8 fc ff ff ff          call   2938 <__xfrm_lookup+0x308>
            2938: R_386_PC32    remove_wait_queue

-- 
Simon Arlott

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2007-12-16 23:22 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).