<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=utf-8"><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:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Menlo;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
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:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.apple-tab-span
        {mso-style-name:apple-tab-span;}
span.E-MailFormatvorlage19
        {mso-style-type:personal-reply;
        font-family:"Calibri","serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
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=DE link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","serif";color:#1F497D;mso-fareast-language:EN-US'>I did not change the windows and linux behaviour. I wasn’t aware there were issues as well?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","serif";color:#1F497D;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","serif";color:#1F497D;mso-fareast-language:EN-US'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri","serif"'>Von:</span></b><span style='font-size:11.0pt;font-family:"Calibri","serif"'> Bryan Crotaz [mailto:bryan.crotaz@silvercurve.co.uk] <br><b>Gesendet:</b> Donnerstag, 5. Juni 2014 12:43<br><b>An:</b> Hüning, Christian<br><b>Cc:</b> mono-devel-list@lists.ximian.com<br><b>Betreff:</b> Re: [Mono-dev] Patch for NetworkInformation on OSX<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>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<o:p></o:p></p><div><p class=MsoNormal>Silver Curve<o:p></o:p></p></div></div><div><p class=MsoNormal style='margin-bottom:12.0pt'><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:<o:p></o:p></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><div><p class=MsoNormal><span style='font-size:10.5pt;font-family:"Calibri","serif";color:black'>Hi everybody,<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.5pt;font-family:"Calibri","serif";color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.5pt;font-family:"Calibri","serif";color:black'>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. <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.5pt;font-family:"Calibri","serif";color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.5pt;font-family:"Calibri","serif";color:black'>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 :)<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.5pt;font-family:"Calibri","serif";color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.5pt;font-family:"Calibri","serif";color:black'>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:<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.5pt;font-family:"Calibri","serif";color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span class=apple-tab-span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#009695'>            </span></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#009695'>public</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'> </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#009695'>override</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'> OperationalStatus OperationalStatus {</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>            </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#009695'>get</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'> {</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>                </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#009695'>if</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>(((MacOsInterfaceFlags)_ifa_flags & MacOsInterfaceFlags.IFF_UP) == MacOsInterfaceFlags.IFF_UP){</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>                    </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#009695'>return</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'> OperationalStatus.Up;</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>                }</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>                </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#009695'>return</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'> OperationalStatus.Unknown;</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>            }</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>        }</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>        </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#009695'>public</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'> </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#009695'>override</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'> </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#009695'>bool</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'> SupportsMulticast {</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>            </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#009695'>get</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'> {</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>                </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#009695'>return</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'> ((MacOsInterfaceFlags)_ifa_flags & MacOsInterfaceFlags.IFF_MULTICAST) == MacOsInterfaceFlags.IFF_MULTICAST;</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>            }</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>        }</span><span style='font-size:10.5pt;font-family:"Calibri","serif";color:black'> <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.5pt;font-family:"Calibri","serif";color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.5pt;color:#333333'>MacOsInterfaceFlags is an Enum residing in </span><span style='font-size:10.5pt;color:black'>MacOsNetworkInterfaceMarshal.cs: <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>    </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#009695'>internal</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'> </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#009695'>enum</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'> MacOsInterfaceFlags {</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>        IFF_UP = </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#F57D00'>0x1</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>,                </span><i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#888888'>/* interface is up */</span></i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>        IFF_BROADCAST = </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#F57D00'>0x2</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>,        </span><i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#888888'>/* broadcast address valid */</span></i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>        IFF_DEBUG = </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#F57D00'>0x4</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>,            </span><i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#888888'>/* turn on debugging */</span></i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>        IFF_LOOPBACK = </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#F57D00'>0x8</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>,            </span><i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#888888'>/* is a loopback net */</span></i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>        IFF_POINTOPOINT = </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#F57D00'>0x10</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>,        </span><i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#888888'>/* interface is point-to-point link */</span></i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>        IFF_NOTRAILERS = </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#F57D00'>0x20</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>,        </span><i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#888888'>/* avoid use of trailers */</span></i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>        IFF_RUNNING = </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#F57D00'>0x40</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>,            </span><i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#888888'>/* resources allocated */</span></i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>        IFF_NOARP = </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#F57D00'>0x80</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>,            </span><i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#888888'>/* no address resolution protocol */</span></i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>        IFF_PROMISC = </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#F57D00'>0x100</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>,        </span><i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#888888'>/* receive all packets */</span></i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>        IFF_ALLMULTI = </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#F57D00'>0x200</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>,        </span><i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#888888'>/* receive all multicast packets */</span></i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>        IFF_OACTIVE = </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#F57D00'>0x400</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>,        </span><i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#888888'>/* transmission in progress */</span></i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>        IFF_SIMPLEX = </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#F57D00'>0x800</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>,        </span><i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#888888'>/* can't hear own transmissions */</span></i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>        IFF_LINK0 = </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#F57D00'>0x1000</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>,            </span><i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#888888'>/* per link layer defined bit */</span></i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>        IFF_LINK1 = </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#F57D00'>0x2000</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>,            </span><i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#888888'>/* per link layer defined bit */</span></i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>        IFF_LINK2 = </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#F57D00'>0x4000</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>,            </span><i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#888888'>/* per link layer defined bit */</span></i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>        IFF_MULTICAST = </span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#F57D00'>0x8000</span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>        </span><i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#888888'>/* supports multicast */</span></i><span style='font-size:10.5pt;font-family:"Menlo","serif";color:black'><br></span><span style='font-size:10.5pt;font-family:"Menlo","serif";color:#333333'>    }</span><span style='font-size:10.5pt;color:black'> <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.5pt;font-family:"Calibri","serif";color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:#333333'>So is this a valid solution? It works well in my project and the corresponding test cases. </span><o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><span style='color:#333333'>Cheers,</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='color:#333333'>Christian</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:10.5pt;font-family:"Calibri","serif";color:black'><o:p> </o:p></span></p></div><div><div><p style='margin:0cm;margin-bottom:.0001pt'><span style='font-size:8.5pt;font-family:"Calibri","serif";color:black'>-----------------------------------------------<o:p></o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='font-size:8.5pt;font-family:"Calibri","serif";color:black'>Christian Hüning, BSc.<o:p></o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='font-size:8.5pt;font-family:"Calibri","serif";color:black'>Fakultät Technik und Informatik, Department Informatik<o:p></o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='font-size:8.5pt;font-family:"Calibri","serif";color:black'>Berliner Tor 7<o:p></o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='font-size:8.5pt;font-family:"Calibri","serif";color:black'>20099 Hamburg<o:p></o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='font-size:8.5pt;font-family:"Calibri","serif";color:black'>Tel.: +49 40 / 42875 - 8436 <o:p></o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='font-size:8.5pt;font-family:"Calibri","serif";color:black'>Mobil: +49 40 / 180 55 44 5<o:p></o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='font-size:8.5pt;font-family:"Calibri","serif";color:black'>Web: <a href="http://www.mars-group.org">http://www.mars-group.org</a></span><span style='font-size:8.5pt;font-family:"Calibri","serif";color:#0079CD'><o:p></o:p></span></p><div><p class=MsoNormal><span style='font-size:10.5pt;font-family:"Calibri","serif";color:black'><o:p> </o:p></span></p></div></div></div></div></blockquote><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><p class=MsoNormal>_______________________________________________<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">http://lists.ximian.com/mailman/listinfo/mono-devel-list</a><o:p></o:p></p></div></blockquote></div></body></html>