<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">
<br>
</div>
<div style="margin: 0px auto 0px 0px; padding: 1em; max-width: 36em;" id="appendonsend">
</div>
<div style="margin: 0px auto 0px 0px; padding: 1em; max-width: 36em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<hr style="background-color: black; margin: 1em 0px; display: inline-block; width: 98%; height: 1px;">
<div style="margin: 0px auto 0px 0px; padding: 1em; max-width: 36em;" id="divRplyFwdMsg">
<div style="direction: ltr; font-family: Calibri, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof">
<b>From:</b> yazan slaila <yazan.slaila@hotmail.com><br>
<b>Sent:</b> Tuesday, September 2, 2025 7:44 PM<br>
<b>To:</b> Maria Matejka <maria.matejka@nic.cz><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</div>
</div>
<div style="margin: 0px auto 0px 0px; padding: 1em; max-width: 36em;">
<div style="direction: ltr; margin: 0px auto 0px 0px; padding: 1em; max-width: 36em; 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="direction: ltr; margin: 0px auto 0px 0px; padding: 1em; max-width: 36em; 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="direction: ltr; margin: 0px auto 0px 0px; padding: 1em; max-width: 36em; 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="direction: ltr; margin: 0px auto 0px 0px; padding: 1em; max-width: 36em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thank you,</div>
<div style="direction: ltr; margin: 0px auto 0px 0px; padding: 1em; max-width: 36em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Yazan.</div>
<hr style="direction: ltr; background-color: black; margin: 1em 0px; display: inline-block; width: 98%; height: 1px;">
<div style="margin: 0px auto 0px 0px; padding: 1em; max-width: 36em;" id="x_divRplyFwdMsg">
<div style="direction: ltr; font-family: Calibri, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
<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</div>
<div style="direction: ltr; margin: 0px auto 0px 0px; padding: 1em; max-width: 36em;">
 </div>
</div>
<div style="margin: 0px auto 0px 0px; padding: 1em; max-width: 36em;">
<p style="direction: ltr; margin: 1em 0px;">Hello yazan,</p>
<p style="direction: ltr; margin: 1em 0px;">On Thu, Aug 28, 2025 at 11:10:10PM +0000, yazan slaila wrote:</p>
<blockquote style="margin: 0.5em; padding-left: 0.5em; border-left: 2px solid rgb(230, 230, 230);">
<p style="direction: ltr; margin: 1em 0px;"><span style="color: rgb(68, 68, 68);">Dear BIRD Developers,</span></p>
<p style="direction: ltr; margin: 1em 0px;"><span style="color: rgb(68, 68, 68);">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:</span></p>
<p style="direction: ltr; margin: 1em 0px;"><span style="color: rgb(68, 68, 68);">router1: 50 router2: 50 35</span></p>
<p style="direction: ltr; margin: 1em 0px;"><span style="color: rgb(68, 68, 68);">router2: 50 35 70</span></p>
</blockquote>
<p style="direction: ltr; margin: 1em 0px;">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 style="direction: ltr; margin: 1em 0px;">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 style="margin: 0.5em; padding-left: 0.5em; border-left: 2px solid rgb(230, 230, 230);">
<p style="direction: ltr; margin: 1em 0px;"><span style="color: rgb(68, 68, 68);">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?</span></p>
</blockquote>
<p style="direction: ltr; margin: 1em 0px;">Please do not do that. It is more cursed than it looks like.</p>
<blockquote style="margin: 0.5em; padding-left: 0.5em; border-left: 2px solid rgb(230, 230, 230);">
<ol style="direction: ltr; margin-top: 1em; padding-left: 1.7em;" start="1">
<li style="color: rgb(68, 68, 68); direction: ltr;">Preference logic example:</li><ul style="direction: ltr; margin-top: 0px; padding-left: 1.7em;">
<li style="color: rgb(68, 68, 68); direction: ltr;">How can a bytestring attribute be integrated into preference calculation in a filter?</li><li style="color: rgb(68, 68, 68); direction: ltr;">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>
</ol>
<p style="direction: ltr; margin: 1em 0px;"><span style="color: rgb(68, 68, 68);">Any guidance or best practices on working with bytestring attributes for routing decisions would be greatly appreciated.</span></p>
</blockquote>
<p style="direction: ltr; margin: 1em 0px;">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 style="direction: ltr; margin: 1em 0px;">I hope this helps.<br>
Maria</p>
<p style="direction: ltr; margin: 1em 0px;">–<br>
Maria Matejka (she/her) | BIRD Team Leader | CZ.NIC, z.s.p.o.</p>
</div>
</div>
</body>
</html>