Guidance on using custom BGP attributes for traffic engineering
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; The attribute appears correctly in the routing table as follows: (birdc show route all) 192.168.5.0/24 unicast [router5 15:00:40.321] * (100) [AS5i] via 10.0.51.5 on eth2 Type: BGP univ BGP.origin: IGP BGP.as_path: 5 BGP.next_hop: 10.0.51.5 BGP.local_pref: 100 BGP.c8 [t]: 20 And this is the way I declare it in my bird.conf file: filter export_with_new_attribute { new_attribute = hex:20; accept; } 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. 2. Are the previous things correct to add a custom path attribute that is doing something? 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? 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? I would greatly appreciate any pointers or guidance that could help me move forward because I did not find any clues on that in your documentation. Thank you very much for your time and support. Best regards, Yazan.
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@crfreenet.org) "To err is human -- to blame it on a computer is even more so."
Just out of curiosity... Is this related to some Kubernetes CNI, or some kind of container underlay that somehow bridges from the underlay to BGP engines within the containers? I'm asking this because I've come across similar ideas in the past for deploying PODs that required BGP to fail over to the outside world. For example, Anycasts. Em sáb., 23 de ago. de 2025 às 12:48, yazan slaila <yazan.slaila@hotmail.com> escreveu:
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;
The attribute appears correctly in the routing table as follows: (birdc show route all) 192.168.5.0/24 unicast [router5 15:00:40.321] * (100) [AS5i] via 10.0.51.5 on eth2 Type: BGP univ BGP.origin: IGP BGP.as_path: 5 BGP.next_hop: 10.0.51.5 BGP.local_pref: 100 *BGP.c8 [t]: 20*
And this is the way I declare it in my bird.conf file:
filter export_with_new_attribute { new_attribute = hex:20; accept; } 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. 2. Are the previous things correct to add a custom path attribute that is doing something? 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?* 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?
I would greatly appreciate any pointers or guidance that could help me move forward because I did not find any clues on that in your documentation. Thank you very much for your time and support. Best regards, Yazan.
-- Douglas Fernando Fischer Engº de Controle e Automação
participants (3)
-
Douglas Fischer -
Ondrej Zajicek -
yazan slaila