Writing filters that detect intersection between a prefix and a prefix set
Alexander Zubkov
green at qrator.net
Mon Dec 8 20:11:36 CET 2025
Hello,
If you want to match any prefix that intersects (less or more specific)
with some prefix of interest - you can use a prefix set like:
define filter1 = [ 192.168.1.0/24{0,32}, 192.168.2.0/24{0,32} ];
I.e. you need to set the mask range from minimum to maximum - from 0 to 32.
Then you can accept or reject depending on the match result. For example:
if net ~ filter1 then reject;
Regards,
Alexander
On Sat, Dec 6, 2025 at 6:42 AM zx at zxinc.org <zx at zxinc.org> wrote:
> Hello,
>
> I have a prefix set like [ 192.168.1.0/24+, 192.168.2.0/24+ ] and I want
> to write a filter that
> filters all prefixes intersects with the prefix set and accepts all
> others, that is,
> accepts 192.168.0.0/24, 192.168.3.0/24, 10.0.0.0/8,
> rejects 192.168.1.1/32, 192.168.1.0/24, 192.168.2.0/24, 192.168.2.0/23,
> 192.168.0.0/16, 192.0.0.0/8,
>
> Anyone who knows how to write such a filter? Is it possible?
>
> Thanks.
>
> ----
> zx
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20251208/3753bc3e/attachment.htm>
More information about the Bird-users
mailing list