Guidance on using custom BGP attributes for traffic engineering

Ondrej Zajicek santiago at crfreenet.org
Sun Aug 24 13:59:31 CEST 2025


On Sat, Aug 23, 2025 at 03:44:53PM +0000, yazan slaila wrote:
> Hello there,
> I am currently working on my thesis and experimenting with the BIRD routing daemon. As part of my work, I added a new optional transitive BGP path attribute using the following configuration line:
> 
> attribute bgp 200 bytestring new_attribute;
> 
> ...
>
> But now I would like to use it as part of traffic engineering decisions. Specifically, I would like to understand what steps are required in order to make this new attribute influence the BGP decision-making process for choosing the best path to route the traffic.
> Could you please advise:
> 
> 1. Which files and functions in the BIRD source code are responsible
> for the BGP path selection process that I need to edit to make my new
> attribute come after LOCAL_PREF attribute in the priority list? Or if
> there is a way to do this without the need to edit the source code.

The bgp_rte_better() function.


> 2. Are the previous things correct to add a custom path attribute that is
> doing something?

Well, custom BGP attributes were not really intended for this purpose,
so related features are limited, but yes, you can add the custom BGP
attribute this way.


> 3. Why is it displaying like this: BGP.c8 [t]: 20? Is there a way to
> make it appear like this: BGP.new_attribute [t]: 20?

Implementation limitation. No name lookup, just prints the attribute code
in hexadecimal.


> 4. Is there a standard or recommended way to extend BIRD so that a custom
> attribute can be incorporated into route preference / best path selection,
> and if I want to compare 2 values and choose the lowest path that has this
> value?

IMHO the best way is just to set route preference based on that
attribute, but that will override LOCAL_PREF comparison.


-- 
Elen sila lumenn' omentielvo

Ondrej 'Santiago' Zajicek (email: santiago at crfreenet.org)
"To err is human -- to blame it on a computer is even more so."


More information about the Bird-users mailing list