<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Does it work on Linux and windows? Or does it fall back to the old behaviour? Or does it throw nasty errors?<br><br>
Bryan Crotaz<div>Silver Curve</div></div><div><br>On 5 Jun 2014, at 11:41, "Hüning, Christian" <<a href="mailto:Christian.Huening@haw-hamburg.de">Christian.Huening@haw-hamburg.de</a>> wrote:<br><br></div><blockquote type="cite">
<div>
<meta http-equiv="CONTENT-TYPE" content="text/html; charset=utf-8">
<meta name="GENERATOR" content="Mono Text Editor">
<div style="color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">Hi everybody,</div><div style="color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif"><br></div><div style="color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
I just ran into a problem regarding the usage of System.Net.NetworkInformation.NetworkInterface.cs on OSX. Especially the Properties „SupportsMulticast“ and „OperationalStatus“ were not implemented properly (always returning false / unknown). So I just fixed that. </div>
<div style="color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif"><br></div><div style="color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">On <a href="http://mono-project.com/Contributing#Ways_to_Contribute">http://mono-project.com/Contributing#Ways_to_Contribute</a> it’s written to post patches to this mailing list, so I do :)</div>
<div style="color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif"><br></div><div style="color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">My solution basically works by extracting the ifa_flags via getifaddrs and storing the flags in the MacOsNetworkInterface class inside of NetworkInterface.cs. I can then implement the two properties like so:</div>
<div style="color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif"><br></div><div style="color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif"><font face="Menlo"><span style="color:#009695"><span class="Apple-tab-span" style="white-space:pre">    </span>public</span><span style="color:#333333"> </span><span style="color:#009695">override</span><span style="color:#333333"> OperationalStatus OperationalStatus </span><span style="color:#333333">{</span><br>

<span style="color:#333333">            </span><span style="color:#009695">get</span><span style="color:#333333"> </span><span style="color:#333333">{</span><br>
<span style="color:#333333">                </span><span style="color:#009695">if</span><span style="color:#333333">(((</span><span style="color:#333333">MacOsInterfaceFlags</span><span style="color:#333333">)</span><span style="color:#333333">_ifa_flags </span><span style="color:#333333">&</span><span style="color:#333333"> MacOsInterfaceFlags</span><span style="color:#333333">.</span><span style="color:#333333">IFF_UP</span><span style="color:#333333">)</span><span style="color:#333333"> </span><span style="color:#333333">==</span><span style="color:#333333"> MacOsInterfaceFlags</span><span style="color:#333333">.</span><span style="color:#333333">IFF_UP</span><span style="color:#333333">){</span><br>

<span style="color:#333333">                    </span><span style="color:#009695">return</span><span style="color:#333333"> OperationalStatus</span><span style="color:#333333">.</span><span style="color:#333333">Up</span><span style="color:#333333">;</span><br>

<span style="color:#333333">                </span><span style="color:#333333">}</span><br>
<span style="color:#333333">                </span><span style="color:#009695">return</span><span style="color:#333333"> OperationalStatus</span><span style="color:#333333">.</span><span style="color:#333333">Unknown</span><span style="color:#333333">;</span><br>

<span style="color:#333333">            </span><span style="color:#333333">}</span><br>
<span style="color:#333333">        </span><span style="color:#333333">}</span><br>
<br>
<span style="color:#333333">        </span><span style="color:#009695">public</span><span style="color:#333333"> </span><span style="color:#009695">override</span><span style="color:#333333"> </span><span style="color:#009695">bool</span><span style="color:#333333"> SupportsMulticast </span><span style="color:#333333">{</span><br>

<span style="color:#333333">            </span><span style="color:#009695">get</span><span style="color:#333333"> </span><span style="color:#333333">{</span><br>
<span style="color:#333333">                </span><span style="color:#009695">return</span><span style="color:#333333"> </span><span style="color:#333333">((</span><span style="color:#333333">MacOsInterfaceFlags</span><span style="color:#333333">)</span><span style="color:#333333">_ifa_flags </span><span style="color:#333333">&</span><span style="color:#333333"> MacOsInterfaceFlags</span><span style="color:#333333">.</span><span style="color:#333333">IFF_MULTICAST</span><span style="color:#333333">)</span><span style="color:#333333"> </span><span style="color:#333333">==</span><span style="color:#333333"> MacOsInterfaceFlags</span><span style="color:#333333">.</span><span style="color:#333333">IFF_MULTICAST</span><span style="color:#333333">;</span><br>

<span style="color:#333333">            </span><span style="color:#333333">}</span><br>
<span style="color:#333333">        </span><span style="color:#333333">}</span></font>

</div><div style="color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif"><font face="Menlo"><span style="color:#333333"><br></span></font></div><div style="color:rgb(0,0,0);font-size:14px"><span style="color:rgb(51,51,51)">MacOsInterfaceFlags is an Enum residing in </span>MacOsNetworkInterfaceMarshal.cs: </div>
<div style="color:rgb(0,0,0);font-size:14px">



<font face="Menlo">
<span style="color:#333333">    </span><span style="color:#009695">internal</span><span style="color:#333333"> </span><span style="color:#009695">enum</span><span style="color:#333333"> MacOsInterfaceFlags </span><span style="color:#333333">{</span><br>

<span style="color:#333333">        IFF_UP </span><span style="color:#333333">=</span><span style="color:#333333"> </span><span style="color:#f57d00">0x1</span><span style="color:#333333">,</span><span style="color:#333333">                </span><span style="font-style:italic;color:#888888">/*</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">interface</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">is</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">up</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">*/</span><br>

<span style="color:#333333">        IFF_BROADCAST </span><span style="color:#333333">=</span><span style="color:#333333"> </span><span style="color:#f57d00">0x2</span><span style="color:#333333">,</span><span style="color:#333333">        </span><span style="font-style:italic;color:#888888">/*</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">broadcast</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">address</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">valid</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">*/</span><br>

<span style="color:#333333">        IFF_DEBUG </span><span style="color:#333333">=</span><span style="color:#333333"> </span><span style="color:#f57d00">0x4</span><span style="color:#333333">,</span><span style="color:#333333">            </span><span style="font-style:italic;color:#888888">/*</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">turn</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">on</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">debugging</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">*/</span><br>

<span style="color:#333333">        IFF_LOOPBACK </span><span style="color:#333333">=</span><span style="color:#333333"> </span><span style="color:#f57d00">0x8</span><span style="color:#333333">,</span><span style="color:#333333">            </span><span style="font-style:italic;color:#888888">/*</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">is</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">a</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">loopback</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">net</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">*/</span><br>

<span style="color:#333333">        IFF_POINTOPOINT </span><span style="color:#333333">=</span><span style="color:#333333"> </span><span style="color:#f57d00">0x10</span><span style="color:#333333">,</span><span style="color:#333333">        </span><span style="font-style:italic;color:#888888">/*</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">interface</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">is</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">point</span><span style="font-style:italic;color:#888888">-</span><span style="font-style:italic;color:#888888">to</span><span style="font-style:italic;color:#888888">-</span><span style="font-style:italic;color:#888888">point</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">link</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">*/</span><br>

<span style="color:#333333">        IFF_NOTRAILERS </span><span style="color:#333333">=</span><span style="color:#333333"> </span><span style="color:#f57d00">0x20</span><span style="color:#333333">,</span><span style="color:#333333">        </span><span style="font-style:italic;color:#888888">/*</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">avoid</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">use</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">of</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">trailers</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">*/</span><br>

<span style="color:#333333">        IFF_RUNNING </span><span style="color:#333333">=</span><span style="color:#333333"> </span><span style="color:#f57d00">0x40</span><span style="color:#333333">,</span><span style="color:#333333">            </span><span style="font-style:italic;color:#888888">/*</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">resources</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">allocated</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">*/</span><br>

<span style="color:#333333">        IFF_NOARP </span><span style="color:#333333">=</span><span style="color:#333333"> </span><span style="color:#f57d00">0x80</span><span style="color:#333333">,</span><span style="color:#333333">            </span><span style="font-style:italic;color:#888888">/*</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">no</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">address</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">resolution</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">protocol</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">*/</span><br>

<span style="color:#333333">        IFF_PROMISC </span><span style="color:#333333">=</span><span style="color:#333333"> </span><span style="color:#f57d00">0x100</span><span style="color:#333333">,</span><span style="color:#333333">        </span><span style="font-style:italic;color:#888888">/*</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">receive</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">all</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">packets</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">*/</span><br>

<span style="color:#333333">        IFF_ALLMULTI </span><span style="color:#333333">=</span><span style="color:#333333"> </span><span style="color:#f57d00">0x200</span><span style="color:#333333">,</span><span style="color:#333333">        </span><span style="font-style:italic;color:#888888">/*</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">receive</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">all</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">multicast</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">packets</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">*/</span><br>

<span style="color:#333333">        IFF_OACTIVE </span><span style="color:#333333">=</span><span style="color:#333333"> </span><span style="color:#f57d00">0x400</span><span style="color:#333333">,</span><span style="color:#333333">        </span><span style="font-style:italic;color:#888888">/*</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">transmission</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">in</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">progress</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">*/</span><br>

<span style="color:#333333">        IFF_SIMPLEX </span><span style="color:#333333">=</span><span style="color:#333333"> </span><span style="color:#f57d00">0x800</span><span style="color:#333333">,</span><span style="color:#333333">        </span><span style="font-style:italic;color:#888888">/*</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">can</span><span style="font-style:italic;color:#888888">'</span><span style="font-style:italic;color:#888888">t</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">hear</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">own</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">transmissions</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">*/</span><br>

<span style="color:#333333">        IFF_LINK0 </span><span style="color:#333333">=</span><span style="color:#333333"> </span><span style="color:#f57d00">0x1000</span><span style="color:#333333">,</span><span style="color:#333333">            </span><span style="font-style:italic;color:#888888">/*</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">per</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">link</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">layer</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">defined</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">bit</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">*/</span><br>

<span style="color:#333333">        IFF_LINK1 </span><span style="color:#333333">=</span><span style="color:#333333"> </span><span style="color:#f57d00">0x2000</span><span style="color:#333333">,</span><span style="color:#333333">            </span><span style="font-style:italic;color:#888888">/*</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">per</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">link</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">layer</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">defined</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">bit</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">*/</span><br>

<span style="color:#333333">        IFF_LINK2 </span><span style="color:#333333">=</span><span style="color:#333333"> </span><span style="color:#f57d00">0x4000</span><span style="color:#333333">,</span><span style="color:#333333">            </span><span style="font-style:italic;color:#888888">/*</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">per</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">link</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">layer</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">defined</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">bit</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">*/</span><br>

<span style="color:#333333">        IFF_MULTICAST </span><span style="color:#333333">=</span><span style="color:#333333"> </span><span style="color:#f57d00">0x8000</span><span style="color:#333333">        </span><span style="font-style:italic;color:#888888">/*</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">supports</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">multicast</span><span style="font-style:italic;color:#888888"> </span><span style="font-style:italic;color:#888888">*/</span><br>

<span style="color:#333333">    </span><span style="color:#333333">}</span></font>

</div><div style="color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif"><font face="Menlo"><span style="color:#333333"><br></span></font></div><div><font><font color="#333333">So is this a valid solution? It works well in my project and the corresponding test cases. </font></font></div>
<div><font><font color="#333333"><br></font></font></div><div><font><font color="#333333">Cheers,</font></font></div><div><font><font color="#333333">Christian</font></font></div><div style="color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
<br></div><div style="color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif"><div><p style="margin:0px;font-size:11px;font-family:Calibri">-----------------------------------------------</p>
<p style="margin:0px;font-size:11px;font-family:Calibri">Christian Hüning, BSc.</p>
<p style="margin:0px;font-size:11px;font-family:Calibri">Fakultät Technik und Informatik, Department Informatik</p>
<p style="margin:0px;font-size:11px;font-family:Calibri">Berliner Tor 7</p>
<p style="margin:0px;font-size:11px;font-family:Calibri">20099 Hamburg</p>
<p style="margin:0px;font-size:11px;font-family:Calibri">Tel.: +49 40 / 42875 - 8436 </p>
<p style="margin:0px;font-size:11px;font-family:Calibri">Mobil: +49 40 / 180 55 44 5</p>
<p style="margin:0px;font-size:11px;font-family:Calibri;color:rgb(0,121,205)"><span style="color:#000000">Web: <a href="http://www.mars-group.org">http://www.mars-group.org</a></span></p><div><br></div></div></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Mono-devel-list mailing list</span><br><span><a href="mailto:Mono-devel-list@lists.ximian.com">Mono-devel-list@lists.ximian.com</a></span><br>
<span><a href="http://lists.ximian.com/mailman/listinfo/mono-devel-list">http://lists.ximian.com/mailman/listinfo/mono-devel-list</a></span><br></div></blockquote></body></html>