<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Dear Maria,<br>
<br>
Thank you very much for your response. It was very helpful. </div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
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.</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
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?</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Thank you,</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Yazan.</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Maria Matejka <maria.matejka@nic.cz><br>
<b>Sent:</b> Friday, August 29, 2025 12:10 PM<br>
<b>To:</b> yazan slaila <yazan.slaila@hotmail.com><br>
<b>Cc:</b> bird-users@network.cz <bird-users@network.cz><br>
<b>Subject:</b> Re: Questions on handling bytestring attributes and using them in preference logic</font>
<div> </div>
</div>
<style>
<!--
html
{line-height:1.2;
font-family:serif;
font-size:0.9em;
color:black;
background-color:white}
div
{margin:0;
margin-right:auto;
max-width:36em;
padding:1em;
font-kerning:normal}
p
{margin:1em 0}
a
{color:black}
a:visited
{color:black}
img
{max-width:100%}
h1, h2, h3, h4, h5, h6
{margin-top:1.4em}
h5, h6
{font-size:1em;
font-style:italic}
h6
{font-weight:normal}
ol, ul
{padding-left:1.7em;
margin-top:1em}
li > ol, li > ul
{margin-top:0}
blockquote
{margin:0.5em;
padding-left:0.5em;
border-left:2px solid #e6e6e6;
color:#444}
code
{font-family:'Lucida Console',monospace;
font-size:95%;
margin:0}
pre
{margin:1em 0;
overflow:auto;
max-width:unset;
width:fit-content}
pre code
{padding:0;
overflow:visible;
max-width:unset;
white-space:pre-wrap}
pre code span
{white-space:pre}
.x_sourceCode
{background-color:transparent;
overflow:visible}
code.x_diff span.x_kw, code.x_diff span.x_dt
{font-weight:bold}
code.x_diff span.x_va
{background-color:rgba(192,255,192,64);
color:rgb(0,64,0)}
code.x_diff span.x_st
{background-color:rgba(255,192,192,64);
color:rgb(64,0,0)}
pre.x_diff
{background-color:rgb(240,240,240);
padding:0.4em;
border:1pt solid grey}
hr
{background-color:black;
border:none;
height:1px;
margin:1em 0}
table
{margin:1em 0;
border-collapse:collapse;
width:100%;
overflow-x:auto;
display:block;
font-variant-numeric:lining-nums tabular-nums}
table caption
{margin-bottom:0.75em}
tbody
{margin-top:0.5em;
border-top:1px solid black;
border-bottom:1px solid black}
th
{border-top:1px solid black;
padding:0.25em 0.5em 0.25em 0.5em}
td
{padding:0.125em 0.5em 0.25em 0.5em}
header
{margin-bottom:4em;
text-align:center}
code
{white-space:pre-wrap}
span.x_smallcaps
{font-variant:small-caps}
span.x_underline
{text-decoration:underline}
div.x_column
{display:inline-block;
vertical-align:top;
width:50%}
div.x_hanging-indent
{margin-left:1.5em;
text-indent:-1.5em}
ul.x_task-list
{list-style:none}
q
{quotes:"„" "”" "»" "«"}
.x_display.math
{display:block;
text-align:center;
margin:0.5rem auto}
-->
</style>
<div>
<p>Hello yazan,</p>
<p>On Thu, Aug 28, 2025 at 11:10:10PM +0000, yazan slaila wrote:</p>
<blockquote>
<p>Dear BIRD Developers,</p>
<p>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:</p>
<p>router1: 50 router2: 50 35</p>
<p>router2: 50 35 70</p>
</blockquote>
<p>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.</p>
<p>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.</p>
<blockquote>
<p>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?</p>
</blockquote>
<p>Please do not do that. It is more cursed than it looks like.</p>
<blockquote>
<ol start="2" type="1">
<li>Preference logic example:
<ul>
<li>How can a bytestring attribute be integrated into preference calculation in a filter?</li><li>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?</li></ul>
</li></ol>
<p>Any guidance or best practices on working with bytestring attributes for routing decisions would be greatly appreciated.</p>
</blockquote>
<p>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.</p>
<p>I hope this helps.<br>
Maria</p>
<p>–<br>
Maria Matejka (she/her) | BIRD Team Leader | CZ.NIC, z.s.p.o.</p>
</div>
</body>
</html>