All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Friesen <cbf123@mail.usask.ca>
To: netdev <netdev@vger.kernel.org>
Subject: unexpected TCP behaviour when deleting local IP addresses
Date: Tue, 16 Oct 2012 15:12:13 -0600	[thread overview]
Message-ID: <507DCDAD.7030209@mail.usask.ca> (raw)


I'm seeing some strange behaviour with local TCP connections.  The 
scenario goes as follows:

1) create new IP address and assign to eth device
2) TCP server starts listening on that IP address
3) TCP client connects to server
4) remove new IP address
5) kill server with ctrl-C.  At this point it appears that because the 
address was removed the shutdown message isn't processed properly. 
netstat shows the server socket as FIN_WAIT1, but the client socket is 
still ESTABLISHED.
6) client writes to the connected socket (this passes with no error)
7) client waits for response from server, and waits forever or until 
keepalive expires

This was originally seen on 2.6.27, but I've verified it on 2.6.35. 
I'll see about trying it on current git.

Is the waiting forever in step 7 a bug, or is this legitimate TCP 
behaviour since the server was basically shut down uncleanly?

If we don't remove the address in step 4, then step 5 results in the 
server socket going to FIN_WAIT2 and the client socket going to 
CLOSE_WAIT and step 7 returns right away with zero bytes.

In the "remove IP address" case I would expect step 6 to cause some sort 
of error since the IP address no longer exists.

The interesting thing is that if you do this sort of scenario with the 
client and server on different hosts then you get a "no route to host" 
error at step 6.

Curious how this is supposed to work...

Chris

                 reply	other threads:[~2012-10-16 21:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=507DCDAD.7030209@mail.usask.ca \
    --to=cbf123@mail.usask.ca \
    --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 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.