BGP extented communities checks

Arnaud Fenioux afenioux at franceix.net
Thu May 21 23:37:23 CEST 2015


Hi folks!

I have played with extended communities with some of my peers, and have written this function below to facilitate my checks.

On the examples found on github (https://gitlab.labs.nic.cz/labs/bird/wikis/Route_server_with_community_based_filtering_and_multiple_RIBs and https://gitlab.labs.nic.cz/labs/bird/wikis/Route_server_with_community_based_filtering_and_single_RIB) 

I have noticed that RO are used :
if (ro,myas,peeras) ~ bgp_ext_community then return true;
bgp_ext_community.delete([(ro,0,*)]);

But according to my tests, RT should be used.
Did anybody made the same ascertainment?


-----

### Chek if the community or ext_community is present
function is_community(int left; int right)
{
  if right > 65535 then {
    #Check of the extended community for 32b ASN
    if (rt,left,right) ~ bgp_ext_community then return true;
  } else {
    #Check of the extended (and not ext) community for 16b ASN
    if ((left,right) ~ bgp_community) || ((rt,left,right) ~ bgp_ext_community) then return true;
  }
  return false;
}

----

Cheers,

--
Arnaud Fenioux
Network Engineer - FranceIX




More information about the Bird-users mailing list