From: chris schlund <chrisschlund@gmx.de>
To: netdev@vger.kernel.org
Subject: Socket hangs in read() when putting interface down
Date: Tue, 05 Jun 2007 17:11:29 +0200 [thread overview]
Message-ID: <46657D21.3010203@gmx.de> (raw)
Using read() on a socket(AF_INET, SOCK_STREAM) connected via any network
interface (e.g eth0) and putting this interface down (ifconfig) while
the socket is in read() produces a hanger (the read() will not return
anymore).
Even if I install sigaction signal handler I got no signal when the
interface is removed.
This may be ok on a major interface like eth0 but it is a problem when
using a ppp interface via GSM data or GPRS connection.
Killing the pppd while the socket waits in read() produces the same
behaviour. Also a broken connection looks the same.
It is reproducable on several 2.6 kernel versions including the lastest
stable 2.6.21.
On my understanding "ifconfig down" should lead into a read() error.
Unfortunately I am not very familiar with in-depth kernel programming
and I am still wondering about the magic inside the kernel:
ifconfig -> net/dev.c:dev_close() notifies a call chain which probably
could/should handle this.
But I miss the dependency to net/ipv4/tcp.c: tcp_recvmsg() function.
This is where I think my receive is blocking.
Can someone give me a hint where to look?
Thanks and kind regards
Chris
p.s.
This happens only, when socket is in blocking mode.
I am using a simple example like:
s = socket();
connect(s);
while(){
read(s)
}
next reply other threads:[~2007-06-05 15:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-05 15:11 chris schlund [this message]
2007-06-05 17:41 ` Socket hangs in read() when putting interface down Rick Jones
2007-06-06 13:55 ` chris schlund
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=46657D21.3010203@gmx.de \
--to=chrisschlund@gmx.de \
--cc=netdev@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;
as well as URLs for NNTP newsgroup(s).