Questions on handling bytestring attributes and using them in preference logic

Maria Matejka maria.matejka at nic.cz
Fri Aug 29 11:10:47 CEST 2025


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.

>   2.
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20250829/a204b2b0/attachment.htm>


More information about the Bird-users mailing list