netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Cc: WGH <wgh@torlan.ru>, Phil Oester <kernel@linuxace.com>,
	netfilter-devel@vger.kernel.org
Subject: Re: conntrack, idle TCP connection and keep-alives
Date: Mon, 28 Oct 2013 09:29:43 +0000	[thread overview]
Message-ID: <20131028092943.GB9612@macbook.localnet> (raw)
In-Reply-To: <alpine.DEB.2.10.1310272141110.7234@blackhole.kfki.hu>

On Sun, Oct 27, 2013 at 09:49:47PM +0100, Jozsef Kadlecsik wrote:
> On Sun, 27 Oct 2013, Jozsef Kadlecsik wrote:
> 
> > On Sun, 27 Oct 2013, Patrick McHardy wrote:
> > 
> > > On Sun, Oct 27, 2013 at 07:32:44PM +0000, Patrick McHardy wrote:
> > > > On Sun, Oct 27, 2013 at 11:23:17PM +0400, WGH wrote:
> > > > > On 27.10.2013 23:20, Patrick McHardy wrote:
> > > > > > On Sun, Oct 27, 2013 at 08:14:19PM +0100, Jozsef Kadlecsik wrote:
> > > > > >> I think a single flag could be sufficient: if the timer in conntrack goes 
> > > > > >> off and the entry is in the ESTABLISHED state and this flag is not set, 
> > > > > >> then send a TCP keepalive packet and start the timer with a short timeout. 
> > > > > >> If we receive the reply packet, then the long ESTABLISHED timeout value 
> > > > > >> can be restored and the flag cleared.
> > > > > > Sure, I think we wouldn't even need that flag, we can just send the keepalive
> > > > > > and set a short timeout. If a RST is received, the connection is killed
> > > > > > anyway, otherwise it will be refreshed with the ESTABLISHED timeout.
> > > > > >
> > > > > > But we do need a timestamp value to pass PAWS.
> > > > > I believe you forgot the third scenario: neither ACK nor RST is received
> > > > > in reply.
> > > > 
> > > > Actually no, "... and set a short timeout ...".
> > > 
> > > Well, OK, we do need a flag to distinguish normal timeout from probe 
> > > timeout. But still I don't see how we can do this without increasing the 
> > > size of every conntrack by at least 4 bytes.
> > 
> > Yes, you're right: PAWS assumes all packets carry timestamps option, an 
> > option-less ACK isn't sufficient. And increasing every conntrack entry 
> > does seem too expensive when the application itself could send keep-alive 
> > packets.
> 
> Looking at the source code, actually, the Linux TCP stack handles 
> gracefully TCP packets without timestamp options when sender originally 
> announced TCP timestamps. So it seems to me we could send a simple, 
> option-less "keep-alive" packet. RFC1323 does not discuss the case but if 
> the option is missing, stacks should fall back to the base handling, 
> isn't it? ;-)

That would be one option. Alternatively we could just make it optional
by putting it into an extend or, looking at the NAT structure, shrink
it a bit more for the NAT case to make up for the size increase by
moving the PPtP helper data to an extend.

  reply	other threads:[~2013-10-28  9:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-26 20:14 conntrack, idle TCP connection and keep-alives WGH
2013-10-27 15:34 ` Phil Oester
2013-10-27 18:01   ` Patrick McHardy
2013-10-27 18:38     ` Patrick McHardy
2013-10-27 19:14       ` Jozsef Kadlecsik
2013-10-27 19:20         ` Patrick McHardy
2013-10-27 19:23           ` WGH
2013-10-27 19:32             ` Patrick McHardy
2013-10-27 19:34               ` Patrick McHardy
2013-10-27 19:50                 ` Jozsef Kadlecsik
2013-10-27 20:49                   ` Jozsef Kadlecsik
2013-10-28  9:29                     ` Patrick McHardy [this message]
2013-10-27 18:22   ` WGH

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=20131028092943.GB9612@macbook.localnet \
    --to=kaber@trash.net \
    --cc=kadlec@blackhole.kfki.hu \
    --cc=kernel@linuxace.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=wgh@torlan.ru \
    /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).