________________________________
From: yazan slaila <[email protected]>
Sent: Tuesday, September 2, 2025 7:44 PM
To: Maria Matejka <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: Questions on handling bytestring attributes and using them in 
preference logic
Dear Maria,

Thank you very much for your response. It was very helpful.
Now I've implemented the idea using the extended_community attribute and I was 
able to see and list all the values in the path (to copy the idea of AS_Path) 
successfuly as I wanted.
However, I still have an issue with the process of finding a way to modify the 
routing decision based on the values of the extended_community attribute 
specifically how to dynamically extract the values from ext_community, do 
operations on it, and prefer the lowest total value if you have 2 possible 
paths to the same destination (in my case, I have a ring topology so always I 
will have 2 possible paths), now how to do this?
Thank you,
Yazan.
________________________________
From: Maria Matejka <[email protected]>
Sent: Friday, August 29, 2025 12:10 PM
To: yazan slaila <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: Questions on handling bytestring attributes and using them in 
preference logic


Hello yazan,

On Thu, Aug 28, 2025 at 11:10:10PM +0000, yazan slaila wrote:

Dear BIRD Developers,

I am currently experimenting with custom BGP attributes using bytestring type 
within a topology that consists of 8 routers. My goal is to display and handle 
the newly added custom attributes and be able to see the value for each router 
in all other routers, like the AS_path idea:

router1: 50 router2: 50 35

router2: 50 35 70

I would very much recommend using extended communities or large communities 
instead for this purpose if you wish to experiment with new BGP mechanisms. The 
filter interpreter is not intended to be used for new attribute implementations.

If you really need to go for a new attribute, please do it on the level of BIRD 
source code. You may check e.g. the commit 
c73b5d2d3d94204d2a81d93efd02c4c115859353 which is quite a simple addition of a 
completely new BGP route attribute.

Is there a recommended way to parse, compare, or extract numbers from a 
bytestring attribute within a BIRD filter? And how? Currently, the raw output 
prints hexadecimal sequences (e.g., 31:30). How should these be 
decoded/processed for comparisons? How can I apply this idea using the 
bytestring type to add a value to each router and then advertise it to every 
other router (in the topology of 8 routers) to decide what is the best path to 
take based on the lowest cost value we have?

Please do not do that. It is more cursed than it looks like.

  1.  Preference logic example:
     *   How can a bytestring attribute be integrated into preference 
calculation in a filter?
     *   The documentation shows how to set preference based on integers or 
communities, but I couldn’t find a concrete example for bytestring. Could you 
provide a minimal example filter to illustrate this in order to prefere the 
path that has the lowest values?

Any guidance or best practices on working with bytestring attributes for 
routing decisions would be greatly appreciated.

Best practice is to not do that and either go for extended/large communities or 
do a full-blown attribute implementation in the source code. The bytestring 
mechanism is intended primarily for rogue attribute deletion and for simple 
injections of static data.

I hope this helps.
Maria

–
Maria Matejka (she/her) | BIRD Team Leader | CZ.NIC, z.s.p.o.

Reply via email to