Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Jeremiah Crockett <jrmhcrcktt@gmail.com>
To: netfilter@vger.kernel.org
Subject: inadequate NEW, INVALID state definitions
Date: Tue, 1 Jun 2010 23:31:06 +0000 (UTC)	[thread overview]
Message-ID: <loom.20100602T012732-376@post.gmane.org> (raw)

I've searched the list archives and googled available iptables documentation,
but haven't yet found satisfactory explanations for iptables states, in
particular for "NEW" and "INVALID".  Does there exist a thorough reference,
short of trying to read the code, about states and transitions? 

An iptables tutorial,
<http://www.frozentux.net/iptables-tutorial/iptablestutorial.html#STATEMACHINE>
says: "The INVALID state means that the packet can't be identified or that it
does not have any state" but "does not have any state" isn't very helpful, since
it applies to initial NEW packets as well.  And "can't be identified", which is
almost identical to the manpage definition, is on a par with "UFO" for
non-descriptiveness.  Because of this, I used to think INVALID effectively meant
NOT(NEW|ESTABLISHED|RELATED), a state for packets that didn't match other
states, but I gather it's not so passive a determination as this.  Posts on this
list indicate INVALID can replace flag combination checks for nonsense
combinations, and the existence of booleans like
netfilter.ip_conntrack_tcp_be_liberal, that control whether out-of-window
packets are INVALID or not, together these hint at considerable complexity in
the actual logic.  If this is so, these packets aren't really "unidentified",
they are in fact identified and marked INVALID for a variety of reasons.  WHAT
are those reasons, is it not possible to list or describe them somewhere?
 
The same tutorial says "The NEW state tells us that the packet is the first
packet that we see."  This of course is also totally inadequate to distinguish
from INVALID.  And it goes on to say the syn flag doesn't have to be set, which
"may lead to certain problems in some instances, but it may also be extremely
helpful when we need to pick up lost connections from other firewalls, or when a
connection has already timed out, but in reality is not closed."  Well,
"pick[ing] up lost connections from other firewalls" sounds like such an edge
case.  And what are the "certain problems" that might arise, what exactly are we
letting through by allowing all NEW traffic?   Conversely, what do we break by
allowing only NEW+syn?  

It seems like connection tracking states and transitions are such a fundamental
concept to netfilter, it's hard to believe there is no clear documentation on
these topics.  Thanks for any references or clarification.

Jeremiah


             reply	other threads:[~2010-06-01 23:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-01 23:31 Jeremiah Crockett [this message]
2010-06-02 16:58 ` inadequate NEW, INVALID state definitions Curby
2010-06-02 19:27   ` Jan Engelhardt
     [not found]     ` <AANLkTikHsAynHO6bSGritJw3a64DVrUG96th58PSfOl1@mail.gmail.com>
2010-06-02 20:48       ` Curby
2010-06-02 21:45         ` Jan Engelhardt
2010-06-02 22:13         ` Jozsef Kadlecsik
2010-06-02 22:33           ` Jan Engelhardt
2010-06-02 23:03           ` Curby
2010-06-03  7:55             ` Jan Engelhardt
2010-06-02 21:06       ` Jan Engelhardt

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=loom.20100602T012732-376@post.gmane.org \
    --to=jrmhcrcktt@gmail.com \
    --cc=netfilter@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