<div dir="ltr">Hi,<div><br></div><div>Please sent suggested change/fix as a git pull request.</div><div><br></div><div>Thanks</div><div>Marek</div><div><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><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" target="_blank">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 style="white-space:pre-wrap">        </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.: <a href="tel:%2B49%2040%20%2F%2042875%20-%208436" value="+4940428758436" target="_blank">+49 40 / 42875 - 8436</a> </p>
<p style="margin:0px;font-size:11px;font-family:Calibri">Mobil: <a href="tel:%2B49%2040%20%2F%20180%2055%2044%205" value="+494018055445" target="_blank">+49 40 / 180 55 44 5</a></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" target="_blank">http://www.mars-group.org</a></span></p><div><br></div></div>
</div></div>
<br>_______________________________________________<br>
Mono-devel-list mailing list<br>
<a href="mailto:Mono-devel-list@lists.ximian.com">Mono-devel-list@lists.ximian.com</a><br>
<a href="http://lists.ximian.com/mailman/listinfo/mono-devel-list" target="_blank">http://lists.ximian.com/mailman/listinfo/mono-devel-list</a><br>
<br></blockquote></div><br></div></div></div>