Hi Stefan,
On Wed, Apr 08, 2026 at 08:54:52AM +0000, Stefan Pisjak wrote:
I’ve searched through the documentation/this mailing list, but I haven’t found anyone trying to build a similar filter so far.
I’m trying to build a filter to only allow BGP routes if the “host part” of
ip frommatches the route that is being announced, e.g.:10.0.1.2 is allowed to announce 10.100.1.2/32 10.0.1.3 is allowed to announce 10.100.1.3/32 […] 10.0.X.Y is allowed to announce 10.100.X.Y/32
The easiest way would probably be to extend the
FI_BITAND and FI_BITOR operators for not only
T_INT but also T_IP. Relevant code is in
filter/f-inst.c, test file is
filter/test.conf, feel free to send a patch.
These two operators are currently in BIRD 3 only because the weren’t needed in BIRD 2; feel free to backport them if needed.
But as far as I can tell, it’s not possible to somehow convert the type ip to type quad or something like that. Is there a better way to build this filter, or can you somehow create a new variable of the type ip and modify it or convert the ip to a quad and then do the manipulations?
Explicit type conversion of this kind is something much harder to implement in a maintainable way.
Happy routing!
Maria
–
Maria Matejka (she/her) | BIRD Team Leader | CZ.NIC, z.s.p.o.