<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:DengXian;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:DengXian;
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
text-align:justify;
font-size:10.5pt;
font-family:DengXian;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-ligatures:none;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=ZH-CN link="#0563C1" vlink="#954F72" style='word-wrap:break-word;text-justify-trim:punctuation'><div class=WordSection1><p class=MsoNormal><span lang=EN-US>Hello Bird Development Team:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>We are AS140731, aka TOHUNET, we use bird as our routing program, we have a problem that may be related to the memory address of bird. <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Here are the problem details:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>We designed a function for anycast to balance the unequal length ASPATH between different upstreams and different nodes, it has this structure:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>function anycast(int AS;int Region;int Country;int NodeID) {<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> if net ~ [2406:840:eb8c::/48] then<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> {<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> case NodeID {<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> 1: {<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> case AS {<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> 6939: {bgp_path.prepend(140731);bgp_path.prepend(140731);}<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>}<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Among them, AS represents the peer AS of this session, and NodeID represents the ID of this node. After the conditional statement in the case matches the peer AS, as you can see, it will execute bgp_path.prepend, and it works well when the curly braces of the conditional statement are not empty. But the aspath of some of our nodes is long enough that they don't need to be prepend, so we have the following configuration:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>function anycast(int AS;int Region;int Country;int NodeID) {<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> if net ~ [2406:840:eb8c::/48] then<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> {<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> case NodeID {<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> 1: {<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> case AS {<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> 6939: {}<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>}<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Then the problem occurred. In our example, when the Session at 6939 was established, the conditional statement matched 6939, but the content in the curly braces was empty. At this time, bird will be automatically killed and restarted by Linux due to a memory segment fault. The following is the information we get in journalctl:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>kernel: bird[11433]: segfault at 0 ip 0000559bb2900c28 sp 00007ffcd21d1fc0 error 4 in bird[559bb2886000+9d000]<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>kernel: Code: 8b 7b 04 83 03 01 41 8d 4f ff 0f 1f 84 00 00 00 00 00 89 cd 48 8d 44 6d 00 48 8d 14 c3 4c 8b a2 08 80 01 00 8b 82 10 80 01 00 <41> 3b 04 24 0f ><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>systemd[1]: bird.service: Main process exited, code=killed, status=11/SEGV<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>The version number we are currently using is: v2.13-5-gf8ba8280 debian11, but we have tried to roll back to v2.13 and update to v2.13-10-gf8bcb037, these problems still exist.<o:p></o:p></span></p></div></body></html>