<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<style>
html {
line-height: 1.2;
font-family: serif;
font-size: 0.9em;
color: black;
background-color: white;
}
body {
margin: 0;
margin-right: auto;
max-width: 36em;
padding: 1em;
hyphens: auto;
overflow-wrap: break-word;
text-rendering: optimizeLegibility;
font-kerning: normal;
}
@media print {
body {
background-color: transparent;
color: black;
font-size: 11pt;
}
p, h2, h3 {
orphans: 3;
widows: 3;
}
h2, h3, h4 {
page-break-after: avoid;
}
}
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;
}
pre code {
padding: 0;
overflow: visible;
overflow-wrap: normal;
}
.sourceCode {
background-color: transparent;
overflow: visible;
}
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.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
q { quotes: "„" "”" "»" "«"; }
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
</style>
</head>
<body>
<p>Hello Ramanathan,</p>
<p>On Fri, Apr 12, 2024 at 10:09:34AM +0530, Ramanathan Selvamani
wrote:</p>
<blockquote>
<p>[…]</p>
<p>memcpy(mls.stack, &a->nh.label[a->nh.labels - mls.len],
mls.len * sizeof(u32));</p>
<blockquote>
<p>Here the “mls.stack” is passed directly instead of its address in
memcpy.</p>
</blockquote>
</blockquote>
<ul>
<li><code>a->nh.label</code> is of type <code>u32 []</code>, thus
<code>&a->nh.label[foo]</code> is of type
<code>u32 *</code>.</li>
<li><code>mls.stack</code> is of type <code>u32 []</code>, and even
though we definitely <em>could</em> write
<code>&mls.stack[0]</code>, it’s not worth the bytes, and it means
the same</li>
</ul>
<p>The code is correct, works properly and is regularly tested.</p>
<blockquote>
<blockquote>
<p>I have tried to use mpls_label_stack to keep some meta data for each
route. But the values of meta data were not copied correctly.</p>
</blockquote>
</blockquote>
<p>You should <em>not</em> do it in <em>any situation</em>, unless these
are MPLS labels. And if MPLS labels are behaving weirdly, please report
a bug (here), including how to reproduce it.</p>
<p>For keeping some custom metadata about routes, use custom attributes
instead.</p>
<p>Also if you are modifying BIRD 2 source code, please be aware that
there is BIRD 3 upcoming with substantial modifications of the core,
allowing for multithreaded execution and better extendability. Notably,
the placement of MPLS label stack has changed there. That development is
mostly happening in the branch <code>thread-next</code>, and even though
there has been a significant delay since BIRD 3.0alpha2, the development
is pretty much active and we hope to release alpha3 soon.</p>
<p>Last but not lest, regarding your modifications, feel free to send
your changes upstream, we’ll consider including them. How to do it?</p>
<ul>
<li>you can just send patches to the list</li>
<li>you can publish your forked repo and send just its URL and the
commit hash to the list</li>
</ul>
<p>Or, if you can’t publish your changes, I very much recommend you to
consider having a support contract to ensure that we either don’t break
or let you know advance about changes in our internal API. Ask me
off-list for more information.</p>
<p>Maria</p>
<p>– Maria Matejka (she/her) | BIRD Team Leader | CZ.NIC, z.s.p.o.</p>
</body>
</html>