Writing filters that change output depending on peer
Maria Matejka
maria.matejka at nic.cz
Sat Sep 13 23:40:45 CEST 2025
Hola!
On Sat, Sep 13, 2025 at 09:14:33AM +0200, Alexander Zubkov via Bird-users wrote:
> I remembered some related question around a year ago:
> https://trubka.network.cz/pipermail/bird-users/2024-September/017839.html
>
> AFAIK such feature hasn't been implemented yet.
Hasn't been implemented yet but it may finally be time to look at it
soon.
On Sat, Sep 13, 2025, 00:44 Nico Schottelius via Bird-users wrote:
> > string proto_to_or_destination_or_better_name
> >
> > The name of the protocol in which the filter or function is being
> > called in. Allows to match on the destination.
Let's have a configuration like this:
```
function foo() { return proto_to_or_destination_or_better_name = "bar"; }
protocol bgp bar from yippie {
ipv6 { import where foo(); export where foo(); };
ipv4 { import where foo(); export where foo(); };
}
```
and some more irrelevant boilerplate, like the `protocol device`.
Now, a bunch of more and more cursed questions because I have an evil mind.
- CLI: `show route export bar`
- CLI: `show route where foo()`
- CLI: `eval foo`
- Conf: `protocol bgp yay { require graceful restart ( foo() ); }`
- Conf: `template bgp yippie { require graceful restart ( foo() ); }`
- Conf: `ipv6 table bastu { sorted ( foo() ); };`
- Conf: `function meow() { if foo() then return 1; else return 2; } router id ( meow() );`
I hope that I haven't botched the syntax, I'm too lazy to try it out.
My questions are basically how BIRD would be expected to behave in these
situations with this feature.
I'm not trying to down the requested feature, and I have a bunch of
ideas how this kind of feature may actually behave and what should be
implemented … but before I disclose that, I wanna see whether the
community has something maybe better or easier.
Thank you for opening this topic!
Maria
--
Maria Matejka (she/her) | BIRD Team Leader | CZ.NIC, z.s.p.o.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20250913/5435bb70/attachment.htm>
More information about the Bird-users
mailing list