pattern matching for bgp communities
Job Snijders
job at instituut.net
Tue Nov 24 12:19:29 CET 2015
Hi all,
Is there a way to do pattern matching or regex matching on the BGP
communities associated with a prefix?
The use-case I have: an eBGP peer attaches communties which inform me
both about the geographical point of origin and the type of relation my
eBGP peer has with the remote network adjacent to them. In their scheme
they treat the lower 16 bits of the BGP community as a string of sorts,
where the first digit represents continent and the second digit the type
of relation:
so "65535:12" might mean (after removnig the '65535' part, "12"
remains), the "1" signifies the continent (say europe), the "2"
signifies the relation (say 'peering').
Should I want to accept all routes where the relation is equals say "3",
I'd have to either create a list of all possible communities matching
where relation is "3", you'd end up with something like this:
function filter_rel_type()
clist l;
{
l = [(65535, 3), (65535, 13), (65535, 23), (65535, 33),
(65535, 43), (65535, 53), (65535, 63), (65535, 73),
(65535, 83), (65535, 93)];
if l ~ bgp_community then return true;
return false;
}
You can imagine that with more complex informational scheme's 'clist l'
would grow to rather large proportions.
Is there a more elegant way to accomplish this style of matching?
Kind regards,
Job
More information about the Bird-users
mailing list