All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben La Monica <ben.lamonica@gmail.com>
To: netfilter-devel@lists.netfilter.org
Subject: Multiple Targets
Date: Sat, 19 Feb 2005 01:05:07 -0700	[thread overview]
Message-ID: <7174b1e405021900052b4545c4@mail.gmail.com> (raw)

Hello,

I'm writing a firewall application for ISPs, and I'm realizing that my
tables could potentially get very long because there is no way to
perform multiple targets on a matched rule. I wanted to get the list's
feedback before I put too much effort into doing something like this.

Basically I have a long list of rules which I am matching mac
addresses against. If the mac is in the list, it is MARKed with a
group number. Based on this mark, the packets go through different
sets of rules and then on to the traffic shaper. Because I am limited
to one target per match, I have to either let the packet continue to
traverse through the entire chain, or put another, identical rule
following the first rule to have it RETURN to the previous chain to
continue processing. This is only an issue on non-terminating targets
(such as MARK, ULOG, LOG, etc)

Example (where n is the number of authorized macs):
iptables -N auth
iptables -A auth -i int+ -m mac --mac-source 00:00:00:00:00:00 -j MARK
--set-mark 1
iptables -A auth -i int+ -m mac --mac-source 00:00:00:00:00:00 -j RETURN
iptables -A auth -i int+ -m mac --mac-source 00:00:00:00:00:01 -j MARK
--set-mark 2
iptables -A auth -i int+ -m mac --mac-source 00:00:00:00:00:01 -j RETURN
... n ...
iptables -A auth -i int+ -m mac --mac-source FF:FF:FF:FF:FF:FF -j MARK
--set-mark n

I had the idea of allowing multiple targets, as long as the targets
before the last were non-terminating. Following on my example above,
it would look something like this:

iptables -N auth
iptables -A auth -i int+ -m mac --mac-source 00:00:00:00:00:00 -j
MARK,RETURN --set-mark 1
iptables -A auth -i int+ -m mac --mac-source 00:00:00:00:00:01 -j
MARK,RETURN --set-mark 2
... n ...
iptables -A auth -i int+ -m mac --mac-source FF:FF:FF:FF:FF:FF -j
MARK,RETURN --set-mark n

This way, you could chain several targets together, and it would
execute them all until it hit a target that would decide the fate of
the packet. You could mark, log, and accept a packet with a single
match if you wanted to. I know you can do this to a certain extent by
creating a user-defined chain and then matching once and sending
packets to that user-defined chain.

If this is too ambitious or will break too many things, perhaps I
could just modify the RETURN target to do what I want it to do
(perform two returns instead of just one).

Please respond, even if it is to say, "That's stupid. Do it another way." :)

Thanks for your time.

-Ben La Monica

             reply	other threads:[~2005-02-19  8:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-19  8:05 Ben La Monica [this message]
2005-02-19  8:28 ` Multiple Targets Patrick Schaaf
2005-02-19  9:23   ` Re[2]: " Maciej Soltysiak
2005-02-19 17:21     ` Jonas Berlin
2005-02-19 17:41       ` Patrick Schaaf
2005-02-19 17:31     ` Re[2]: " Samuel Jean
2005-03-02 22:26 ` Michael Richardson
     [not found] <200502191851.j1JIpOq22471@isis.cs3-inc.com>
2005-02-19 20:54 ` Don Cohen

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=7174b1e405021900052b4545c4@mail.gmail.com \
    --to=ben.lamonica@gmail.com \
    --cc=netfilter-devel@lists.netfilter.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.