Nested filters

Nico Schottelius nico.schottelius at ungleich.ch
Thu May 2 09:34:27 CEST 2019


Hey Naoki,

I am also relatively new to bird, however how I would solve the problem
is by nesting functions.

As far as I can see, you can accept/reject in functions, too - you are
not limited to return true/false.

Best,

Nico

amphineko <sukareki at gmail.com> writes:

> Hello there,
>
> I'm a newbie to BIRD, using BIRD 1.6.3 and setting up my first router.
> I have multiple filters which filter different subnets and apply
> different attribute modifications.
>
> Currently I put my subnet checks in a function which returns true if a
> subnet matches, and invoke the function in a filter like this:
>
> function is_asxxxx() {
>     if net ~ [114.51.4.0/24] then return true;
>     return false;
> }
>
> function is_asyyyy() {
>     if net ~ [19.19.81.0/24] then return true;
>     return false;
> }
>
> filter f_customers {
>     if is_asxxxx() then accept;
>     if is_asyyyy() then {
>         bgp_community.add((114514, 191981));
>         accept;
>     }
>     reject;
> }
>
> I'm wondering if I can invoke other filters inside a filter, so the
> is_asxxx can also used as an filter. I can't find an example to
> achieve this.
>
> Regards,
> Naoki Kobayashi


--
Your Swiss, Open Source and IPv6 Virtual Machine. Now on www.datacenterlight.ch.


More information about the Bird-users mailing list