filter in filter

Hans van Kranenburg hans.van.kranenburg at mendix.com
Mon Feb 4 16:47:15 CET 2013


Hi Tapio,

On 02/04/2013 04:29 PM, Tapio Haapala wrote:
> Yaw dawg,
>
> Can I put filter in filter?
>
> I mean that if I have:
> filter own_net
> {
>          if net ~ [1.2.3.0/24] then accept;
>          reject;
> }
>
> Can I somehow include that to:
>
> filter bgp_net
> {
>          if source = RTS_BGP then accept;
>        #some kind reference to own_net filter here.
>          reject;
> }
>
> I try find right syntax from documentation but I did not find it.

You can define functions, which can be used in filters. This way you can 
create the functionality you're looking for.

On this page a bunch of examples are shown:
https://redmine.labs.nic.cz/projects/bird/wiki/BGP_filtering

e.g. (untested):

function own_net
{
     return net ~ [1.2.3.0/24];
}

filter bgp_net
{
     if source = RTS_BGP then accept;
     if own_net() then accept;
     reject;
}

-- 
Hans van Kranenburg - System / Network Engineer
+31 (0)10 2760434 | hans.van.kranenburg at mendix.com | www.mendix.com



More information about the Bird-users mailing list