[Mono-osx] [Mono-dev] [PATCH] Simple implementation of network interface properties for Mac OS X
Alan McGovern
alan.mcgovern at gmail.com
Tue Jun 30 12:29:44 EDT 2009
Hey,
On Tue, Jun 30, 2009 at 4:09 PM, Alex Shulgin <
alexander.shulgin at yessoftware.com> wrote:
> Alex Shulgin wrote:
>
>> Alex Shulgin wrote:
>>
>>> Hi,
>>>
>>> In the current version System.Net.NetworkInformation.NetworkInterface
>>> provides limited information about network interfaces on the system (their
>>> names only).
>>>
>>> The attached patch adds support for NetworkInterfaceType and
>>> GetPhysicalAddress() on Mac OS.
>>>
>>
>> Oops, I've almost forgot about IPv6... and missed the added file
>> MacOsNetworkInterfaceMarshal.
>>
>> Please see the fixed patch instead.
>>
>
> This worked fine, until one user reported a crash on Array.Copy in
> NetworkInformation.MacOsNetworkInterface.ImplGetAllNetworkInterfaces(). I
> traced this down to that I believe is a problem with non-standard length
> interface name: thus the 12-byte buffer sockaddr_dl.sdl_data is not enough.
>
> I've noticed that sockaddr_dl contains sdl_len member which holds the
> length of the whole sockaddr structure. With that we can use Marshal.Copy
> instead of Array.Copy to access data past default 12-byte data array. A
> patch against trunk is attached.
>
> I didn't have a chance to try it with the problematic user, but still would
> like someone to review the patch and comment on it.
>
> --
> Alex
> PS: is there more appropriate way to increment IntPtr value w/o using
> ToInt64()?
You could use a loop and Marshal.ReadByte (IntPtr ptr, int offset);
Alan.
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-osx/attachments/20090630/d674eee8/attachment.html
More information about the Mono-osx
mailing list