Strange behaviour on filtering bgp_large_community ...

Maria Matejka maria.matejka at nic.cz
Mon May 15 13:47:32 CEST 2023


That's fishy. Will try to reproduce and find out what is behind.
Maria

On 5/15/23 13:32, Tim Weippert via Bird-users wrote:
> Hi Maria,
> 
> i think the confusion part is, that it works on CLI in a "symmetric" way
> but not in a function, that was my biggest questionmark :)
> 
> regards,
> tim
> 
> On Mon, May 15, 2023 at 01:21:46PM +0200, Maria Matejka wrote:
>> Hello!
>>
>> The ~ operator is not symmetric. We should probably better check its arguments or maybe even update the syntax. It basically means, when A ~ B, that A is in B.
>>
>> Sorry for that confusion.
>> Maria
>>
>> On 15 May 2023 12:59:11 CEST, Tim Weippert via Bird-users <bird-users at network.cz> wrote:
>>> Hi List,
>>>
>>> maybe i'm doing something wrong, but if i use some quick and dirty
>>> filter on the CLI all is working as expecting:
>>>
>>> show route where bgp_large_community ~ [(65000, 0, 1001)]
>>> show route where (65000, 0, 1001) ~ bgp_large_community
>>>
>>> both get the expected results, show all routes with the specific
>>> community attached.
>>>
>>> If i use it in a filter function to filter the routes out:
>>>
>>> function filter_large(int TestID)
>>> {
>>>   if ( bgp_large_community ~ [(65000, 0, TestID)] ) then { return false; }
>>>   return true;
>>> }
>>>
>>> i get "all" routes, if clause doesn't get catched.
>>>
>>> function filter_large_V2(int TestID)
>>> {
>>>   if ( (65000, 0, TestID) ~ bgp_large_community ) then { return false; }
>>>   return true;
>>> }
>>>
>>> with the V2 function i get what i want, filter out all routes with the
>>> community attached and show all the rest.
>>>
>>> I'm a little confused here, because the first version of the if clause is
>>> used for bgp_ext_community on several functions on my setup and working
>>> as expected, only for bgp_large_community i need to switch to if clause
>> >from version V2, and only in a function?
>>>
>>> Can someone confirm or explain this?
>>>
>>> regards,
>>> tim
>>>
>>> -- 
>>> Tim Weippert
>>> http://weiti.org - weiti at weiti.org
>>> GPG Fingerprint - E704 7303 6FF0 8393 ADB1  398E 67F2 94AE 5995 7DD8
> 


More information about the Bird-users mailing list