lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Tue, 04 Jan 2011 16:16:43 +0100
From:	Martin Sustrik <sustrik@...bpm.com>
To:	netdev@...r.kernel.org
Subject: Checking for closed TCP connection in kernel space

Hi all,

I open a TCP socket in the kernel space (sock_create_kern). I connect or 
bind it, I send and receive data. Everything works as expected.

The problem is how to find out that the peer have closed the connection.

In user space you get 0 when calling recv() is such case. However, in 
kernel space kernel_recvmsg seems to return 0 anytime when there are no 
more data available. It doesn't return an error either.

Should I monitor the socket state using sk_state_change callback? But 
the callback seems to work in async manner, i.e. I can accidentally use 
closed socket before I get notified about the state change.

Any ideas?
Martin
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ