<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 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
h2
        {mso-style-priority:9;
        mso-style-link:"Heading 2 Char";
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:18.0pt;
        font-family:"Times New Roman","serif";
        font-weight:bold;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
code
        {mso-style-priority:99;
        font-family:"Courier New";}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
span.Heading2Char
        {mso-style-name:"Heading 2 Char";
        mso-style-priority:9;
        mso-style-link:"Heading 2";
        font-family:"Times New Roman","serif";
        font-weight:bold;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
span.kwd
        {mso-style-name:kwd;}
span.pln
        {mso-style-name:pln;}
span.pun
        {mso-style-name:pun;}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:287200639;
        mso-list-template-ids:1672375450;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></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=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><o:p> </o:p></p><h2 style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;background:white'><span style='font-size:14.5pt;font-family:"Arial","sans-serif";color:#242729;font-weight:normal'>The problem<o:p></o:p></span></h2><p style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:14.65pt;background:white;orphans: auto;widows: 1;-webkit-text-stroke-width: 0px;word-spacing:0px'><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#242729'>On our system running RTEMS 4.9.2 we are experiencing a very odd issue with socket communications. We are setting up a socket and using the following command to bind:<o:p></o:p></span></p><pre style='background:#EFF0F1;max-height: 600px;word-wrap: normal;orphans: auto;widows: 1;-webkit-text-stroke-width: 0px;overflow:auto;word-spacing:0px'><span class=kwd><span style='font-family:Consolas;color:#101094;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>if</span></span><span class=pln><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'> </span></span><span class=pun><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>(</span></span><span class=pln><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>bind</span></span><span class=pun><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>(</span></span><span class=pln><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'> mSocket</span></span><span class=pun><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>,</span></span><span class=pln><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'> </span></span><span class=pun><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>(</span></span><span class=pln><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>sockaddr </span></span><span class=pun><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>*)&</span></span><span class=pln><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>localSocketAddress</span></span><span class=pun><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>,</span></span><span class=pln><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'> </span></span><span class=kwd><span style='font-family:Consolas;color:#101094;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>sizeof</span></span><span class=pun><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>(</span></span><span class=pln><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>sockaddr_in</span></span><span class=pun><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>))</span></span><span class=pln><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'> </span></span><span class=pun><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>==</span></span><span class=pln><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'> SOCKET_ERROR</span></span><span class=pun><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>)</span></span><span class=pln><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'><o:p></o:p></span></span></pre><pre style='background:#EFF0F1'><span class=pun><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>{</span></span><span class=pln><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'><o:p></o:p></span></span></pre><pre style='background:#EFF0F1'><span class=pln><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>    </span></span><span class=kwd><span style='font-family:Consolas;color:#101094;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>int</span></span><span class=pln><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'> errorOut </span></span><span class=pun><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>=</span></span><span class=pln><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'> errno</span></span><span class=pun><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>;</span></span><span class=pln><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'><o:p></o:p></span></span></pre><pre style='background:#EFF0F1'><span class=pln><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>    </span></span><span class=pun><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>...</span></span><span style='font-family:Consolas;color:#393318'><o:p></o:p></span></pre><p style='margin:0in;margin-bottom:.0001pt;line-height:14.65pt;background:white;orphans: auto;widows: 1;-webkit-text-stroke-width: 0px;word-spacing:0px'><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#242729'>And this works for UDP communications except in a strange specific scenario which is explained below. The problem that we experience is a failure of this<span class=apple-converted-space> </span></span><code><span style='font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>bind</span></code><span class=apple-converted-space><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#242729'> </span></span><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#242729'>call even though the setup is correct. We get the error<span class=apple-converted-space> </span></span><code><span style='font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>125</span></code><span class=apple-converted-space><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#242729'> </span></span><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#242729'>which for RTEMS is<span class=apple-converted-space> </span></span><code><span style='font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>EADDRNOTAVAIL</span></code><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#242729'>:<o:p></o:p></span></p><p style='margin:0in;margin-bottom:.0001pt;line-height:14.65pt;background:cornsilk'><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#242729'>A nonexistent interface was requested or the requested address was not local.<o:p></o:p></span></p><h2 style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;background:white;word-wrap: break-word;orphans: auto;widows: 1;-webkit-text-stroke-width: 0px;word-spacing:0px'><span style='font-size:14.5pt;font-family:"Arial","sans-serif";color:#242729;font-weight:normal'><o:p> </o:p></span></h2><h2 style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;background:white'><span style='font-size:14.5pt;font-family:"Arial","sans-serif";color:#242729;font-weight:normal'><o:p> </o:p></span></h2><h2 style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;background:white'><span style='font-size:14.5pt;font-family:"Arial","sans-serif";color:#242729;font-weight:normal'>The Apparent Cause<o:p></o:p></span></h2><p style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:14.65pt;background:white;orphans: auto;widows: 1;-webkit-text-stroke-width: 0px;word-spacing:0px'><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#242729'>At boot of the device we can set up our network in 1 of 2 ways:<o:p></o:p></span></p><p style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:0in;margin-left:22.5pt;margin-bottom:.0001pt;text-indent:-.25in;line-height:14.65pt;mso-list:l0 level1 lfo1;background:white'><![if !supportLists]><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#242729'><span style='mso-list:Ignore'>1.<span style='font:7.0pt "Times New Roman"'>     </span></span></span><![endif]><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#242729'>The Network IP and SUBNET is autoconfigured based on what is in the default bootloader (UBOOT), and is set up through the RTEMS OS.<o:p></o:p></span></p><p style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:0in;margin-left:22.5pt;margin-bottom:.0001pt;text-indent:-.25in;line-height:14.65pt;mso-list:l0 level1 lfo1;background:white'><![if !supportLists]><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#242729'><span style='mso-list:Ignore'>2.<span style='font:7.0pt "Times New Roman"'>     </span></span></span><![endif]><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#242729'>The RTEMS interface function<span class=apple-converted-space> </span></span><code><span style='font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>rtems_bsdnet_ifconfig</span></code><span class=apple-converted-space><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#242729'> </span></span><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#242729'>is called to set up a custom user defined ethernet interface after boot time.<o:p></o:p></span></p><p style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:14.65pt;background:white;orphans: auto;widows: 1;-webkit-text-stroke-width: 0px;word-spacing:0px'><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#242729'>For clarification, option 2 is called like this:<o:p></o:p></span></p><pre style='background:#EFF0F1;max-height: 600px;word-wrap: normal;orphans: auto;widows: 1;-webkit-text-stroke-width: 0px;overflow:auto;word-spacing:0px'><span class=pln><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>rtems_bsdnet_ifconfig</span></span><span class=pun><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>(</span></span><span class=pln><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>eth_interface</span></span><span class=pun><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>,</span></span><span class=pln><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'> SIOCSIFADDR</span></span><span class=pun><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>,</span></span><span class=pln><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'> </span></span><span class=pun><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>&</span></span><span class=pln><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>ipaddr</span></span><span class=pun><span style='font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>);</span></span><span style='font-family:Consolas;color:#393318'><o:p></o:p></span></pre><p style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:14.65pt;background:white;orphans: auto;widows: 1;-webkit-text-stroke-width: 0px;word-spacing:0px'><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#242729'>If the network is set up as indicated by option 1, everything works as expected, but if option 2 is used (even in the case where the setup matches the network options defined by option 1) then the socket bind fails.<o:p></o:p></span></p><p style='margin:0in;margin-bottom:.0001pt;line-height:14.65pt;background:white;orphans: auto;widows: 1;-webkit-text-stroke-width: 0px;word-spacing:0px'><strong><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#242729;border:none windowtext 1.0pt;padding:0in'>Is there a known reason or bug for RTEMS that indicates that this bind would fail if you set up your own IP Alias?</span></strong><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#242729'><o:p></o:p></span></p><h2 style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;background:white;word-wrap: break-word;orphans: auto;widows: 1;-webkit-text-stroke-width: 0px;word-spacing:0px'><span style='font-size:14.5pt;font-family:"Arial","sans-serif";color:#242729;font-weight:normal'><o:p> </o:p></span></h2><h2 style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;background:white'><span style='font-size:14.5pt;font-family:"Arial","sans-serif";color:#242729;font-weight:normal'><o:p> </o:p></span></h2><h2 style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;background:white'><span style='font-size:14.5pt;font-family:"Arial","sans-serif";color:#242729;font-weight:normal'>Additional Information<o:p></o:p></span></h2><p style='margin:0in;margin-bottom:.0001pt;line-height:14.65pt;background:white;orphans: auto;widows: 1;-webkit-text-stroke-width: 0px;word-spacing:0px'><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#242729'>We are setting up an IP alias (option 2) using a method found<span class=apple-converted-space> </span><a href="https://docs.rtems.org/doc-current/share/rtems/pdf/networking.pdf#page=[23]"><span style='color:#005999;border:none windowtext 1.0pt;padding:0in'>here</span></a><span class=apple-converted-space> </span>under IP Alias (<a href="https://docs.rtems.org/doc-current/share/rtems/pdf/networking.pdf">https://docs.rtems.org/doc-current/share/rtems/pdf/networking.pdf</a> ).<o:p></o:p></span></p><p style='margin:0in;margin-bottom:.0001pt;line-height:14.65pt;background:white;orphans: auto;widows: 1;-webkit-text-stroke-width: 0px;word-spacing:0px'><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#242729'>If we bind our socket without specifying a local ADDRESS (ie use<span class=apple-converted-space> </span></span><code><span style='font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>INADDR_ANY</span></code><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#242729'>) then it works in any case.<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>