Hi,

That is exactly what "filter" function does. Something like this:
bgp_community.filter([(64511,*)]);


On Wed, Jul 19, 2023, 17:15 Marek Küthe <m-k-mailling-list@mk16.de> wrote:
Hello,

I recently discovered a new filter for myself on
https://bgpfilterguide.nlnog.net/guides/many_communities/#bird. In my
eyes it also makes sense to keep the routing table as small as
possible. But now I don't want to delete all communities, but keep a
single one. How can I implement something like that?
```
function strip_too_many_communities() {
    if ( ( bgp_community.len + bgp_ext_community.len +
bgp_large_community.len ) >= 100 ) then {
        bgp_community.empty.except((64511, *));
        bgp_ext_community.empty;
        bgp_large_community.empty;
    }
}
```

The background is that these serve in the
[dn42](https://dn42.dev/howto/Bird-communities) as information, how
good the connection to the destination is. Therefore I would like to
keep these.
Does anyone have any ideas on how to do something like this?

Greetings
Marek Küthe

--
Marek Küthe
m.k@mk16.de
er/ihm he/him