🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: bit.listserv.openbsd-pf
Article #73

Re: double NOT in rules is not working as expected

#73
From: Claudio Jeker
Date: Fri, 08 Apr 2011 11:34
57 lines
2463 bytes
On Fri, Apr 08, 2011 at 01:19:59PM +0300, Bojidara Marinchovska wrote:
> Hello,
> 
> netif="netif"
> test1="1.2.3.4"
> test2="2.3.4.5"
> 
> block in quick on $netif from {!$test1, !$test2} to x.x.x.x - blocks
> the access from the IPs from test1 and test2 macros, BUT it should
> block all other EXCEPT this ones
> 
> --
> block in quick on $netif from {$test1, $test2} to x.x.x.x - this
> rule works as expected
> --
> block in quick on $netif from {!$test1, $test2} to x.x.x.x - this
> rule works as expected

This is complex for
block in quick on $netif from {!$test1} to x.x.x.x

> --
> block in quick on $netif from {$test1, !$test2} to x.x.x.x - this
> rule works as expected

This is again complex for
block in quick on $netif from {!$test2} to x.x.x.x
 
> I know example rule :
> 
> block in quick on $netif from {!$test1, !$test2} to x.x.x.x
> 
> can be replaced with:
> 
> pass in quick on $netif from {$test1, $test2} to x.x.x.x
> block in quick on $netif from any to x.x.x.x

This is wrong. It is expanded to:
 block in quick on $netif from {!$test1} to x.x.x.x
 block in quick on $netif from {!$test2} to x.x.x.x

and this is just a simple
 block in quick on $netif to x.x.x.x

The {foo, bar} notation results in a OR operation so
foo || bar. Now !foo || !bar with foo != bar is always true.
 
> In the example I used macors, also tried with tables or direct
> inserting IP addresses instead of using macros or tables, but it
> does not work as expected
> 
> So it is possible to use {$test, $test1}, but isn't "double
> negation" as following: {!$test1, !$test2} ?
> 

-- 
:wq Claudio
Technical Details
Message-ID: <20110408110426.GA28519@diehard.n-r-g.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!spln!newsgate.newsguy.com!newsp.newsguy.com!mdrn
References: <4D9EE14F.5010400@bobi.gateit.net>

Show Full Headers
Complete Article Headers
X-Google-Thread: ff4ef,d780e65cf81f4123
X-Google-NewGroupId: yes
X-Google-Attributes: gidbffa70e3,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!spln!newsgate.newsguy.com!newsp.newsguy.com!mdrn
From: cjeker@diehard.n-r-g.com (Claudio Jeker)
Newsgroups: bit.listserv.openbsd-pf
Subject: Re: double NOT in rules is not working as expected
Date: 8 Apr 2011 04:34:19 -0700
Organization: None
Lines: 57
Message-ID: <20110408110426.GA28519@diehard.n-r-g.com>
References: <4D9EE14F.5010400@bobi.gateit.net>
NNTP-Posting-Host: localhost.newsguy.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
NNTP-Posting-Date: 8 Apr 2011 11:34:19 GMT