Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Willy TARREAU <willy@w.ods.org>
To: reply2@lucassen.org
Cc: netfilter@lists.netfilter.org
Subject: Re: iptables jump to userdefined chain and ESTABLISHED,RELATED rules
Date: Sun, 12 Oct 2003 13:16:20 +0200	[thread overview]
Message-ID: <20031012111620.GB571@pcw.home.local> (raw)
In-Reply-To: <20031011194527.17273de9.netfilter@lucassen.org>

On Sat, Oct 11, 2003 at 07:45:27PM +0200, CAM IT Solutions wrote:
 
> without mentioning the chain. I *have* to enter:
> 
> /sbin/iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
> /sbin/iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
> 
> I just wonder if these ESTABLISHED,RELATED packets are handled by 1
> overall connection table, or handled by 2 connection tables, 1 for
> INPUT and 1 for FORWARD.
> 
> And what happens if a jump is made from the FORWARD chain to a
> userdefined chain, is the connection table the one of the FORWARD chain?
> And if the answer is "yes", why does iptables accepts the 
> 
> /sbin/iptables -A CH_WWW -m state --state ESTABLISHED,RELATED -j ACCEPT
> 
> rule then? I haven't found any answer to that question on the net yet :(

You can share the user defined chains between several chains as long as
they are in the same table and support the same arguments. Since the
'state' match is valid from INPUT and FORWARD, it will work in a shared
user chain.

However, if you use some illegal information, you'll either get error
messages each time the rule is evaluated or get a never-matching rule.

eg:

  # iptables -A INPUT -j mychain
  # iptables -A FORWARD -j mychain
  # iptables -A mychain -o eth1 -j LOG --log-prefix "out_eth1"

  => Since the output interface (-o) is not defined when starting
     from the INPUT chain, the rule will never match, and possibly
     make the kernel complain.

But in a more general way, user chains are very useful to dissect rules
by addresses, using only DROP, ACCEPT and RETURN. And in this case, it's
easy to share them between different chains without risk.

Willy



  reply	other threads:[~2003-10-12 11:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-10 11:26 iptables jump to userdefined chain and ESTABLISHED,RELATED rules richard lucassen
2003-10-11 16:26 ` Cedric Blancher
2003-10-11 17:45   ` CAM IT Solutions
2003-10-12 11:16     ` Willy TARREAU [this message]
2003-10-12 17:53       ` richard lucassen
2003-10-12 18:54         ` Cedric Blancher
2003-10-12 21:40           ` richard lucassen
2003-10-12 19:02         ` Cedric Blancher
2003-10-12 15:10   ` Joel Newkirk
2003-10-12 15:15     ` Cedric Blancher
  -- strict thread matches above, loose matches on Subject: below --
2003-10-09 20:20 richard lucassen

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=20031012111620.GB571@pcw.home.local \
    --to=willy@w.ods.org \
    --cc=netfilter@lists.netfilter.org \
    --cc=reply2@lucassen.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