[PATCH] Filter: picking community elements and finding min/max element

Alexander Zubkov green at qrator.net
Thu Dec 16 14:41:28 CET 2021


Hi everyone!

I made a couple of patches to do some interesting stuff with communities.
The first patch allows to pick a component from a standard or a large community:

(10, 20, 30) @ 2 --> 20

And the second patch allows to search for minimum or maximum element
in a community list. This combined allows to do some cool stuff with
communities like this:

bgp_local_pref = filter(bgp_large_community, [(<as>, <localpref_val>,
*)]).min @ 3

This will find us the minimum from our "localpref" communities and get
that number as integer, ready to assign it where we need. Now we use a
series of if's to check all the possible variants and that is not very
convenient. I think this features will greatly boost the possibilities
of working with communities in bird.


More information about the Bird-users mailing list