Subject: Re: Fw: Re: tcp connections lost on interface down
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Robert Elz <kre@munnari.OZ.AU>
List: tech-net
Date: 08/17/2003 15:42:26
    Date:        Sun, 17 Aug 2003 04:01:22 -0400 (EDT)
    From:        der Mouse <mouse@Rodents.Montreal.QC.CA>
    Message-ID:  <200308170804.EAA24875@Sparkle.Rodents.Montreal.QC.CA>

  | Now, though, I have to wonder what to do when an address _does_ go away
  | "permanently" and thus connections to it _should_ break.  Or is the
  | theory that that's rare enough to not be worth doing anything about?

Not at all, this kind of thing happens all the time.   Happening because of
a local address "vanishing" might not be the most common cause, but
connections that simply "go away without saying goodnight" are a fact
of life (consider what happens at the other end of all of the connections
that your average Wintrash user leaves dangling when the system crashes,
and the user gets so frustrated that they just leave the system turned off,
and go away for a vacation...)

Or even, if you like, what happens at the other end of the connection
with the previous code, when the local end was arbitrarily (silently)
terminated when the address changed (and now assuming that the address
doesn't just come back a second later, which would result in RST's to
the peer, eventually).

There's no one right answer for this - original BSD code had keepalives
enabled for everything, along with a (shortish) timeout, so that
connections would vanish after a couple of minutes of broken connectivity.

That isn't the right solution for everything - but if you're a busy mail
server, it is exactly what you want for your SMTP connections (client
vanished, kill connection, it can just try again if this turned out to be
only a temporary condition).

For some connections, the right thing is to do nothing, and leave it for
the user to eventually kill the application.   For others, you want a
rapid "no packets, by bye" to just happen.

kre

ps: Itojun's change from yesterday was just restoring NetBSD to how it
has been for most of its existence, the "break connections now" change
was a (fairly) recent "innovation".