From: Aleksandar Milivojevic <amilivojevic@pbl.ca>
To: netfilter@lists.netfilter.org
Subject: Re: two negatived parameters
Date: Tue, 07 Sep 2004 10:43:30 -0500 [thread overview]
Message-ID: <413DD722.2010307@pbl.ca> (raw)
In-Reply-To: <7421.1094459312@www2.gmx.net>
Akolinare@gmx.net wrote:
> Hi,
>
> I have a little question with two negatived parameters in one rule.
>
> I create a rule, which should only match if source and destination are not
> the given. I think that it is easy and try the following rule:
>
> iptables -A FORWARD -s ! host1 -d ! host2 -j ACCEPT
>
> But with this rule pakets from host1 to host3 (or from host2 to host3) were
> not affected. It seems like the logical combination is OR and not AND unlike
> the not negatived rule.
> I think that the rule is logical right. Is it a little bug or have I
> misunderstood something?
If src is host1 and dst is host3 you get:
not true and not false = false and true = false
So the rule does not match, and packets from host1 to host3 will not be
affected by it. Also, note that "not host1 and not host2" is logically
the same thing as "not (host1 or host2)". Which was probably the reason
why it looked like an or to you. Double negations in human languages do
not always translate well into negations in computer languages.
--
Aleksandar Milivojevic <amilivojevic@pbl.ca> Pollard Banknote Limited
Systems Administrator 1499 Buffalo Place
Tel: (204) 474-2323 ext 276 Winnipeg, MB R3T 1L7
next prev parent reply other threads:[~2004-09-07 15:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-06 8:28 two negatived parameters Akolinare
2004-09-06 8:49 ` Alistair Tonner
2004-09-06 9:00 ` Cedric Blancher
2004-09-06 20:16 ` Jason Opperisano
2004-09-07 15:43 ` Aleksandar Milivojevic [this message]
2004-09-07 16:36 ` Jason Opperisano
-- strict thread matches above, loose matches on Subject: below --
2004-09-06 11:48 Akolinare
2004-09-07 16:10 ` Aleksandar Milivojevic
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=413DD722.2010307@pbl.ca \
--to=amilivojevic@pbl.ca \
--cc=netfilter@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.