[Mono-dev] [PATCH] Simple implementation of network interface properties for Mac OS X
alan.mcgovern at gmail.com
Tue Jun 30 12:29:44 EDT 2009
On Tue, Jun 30, 2009 at 4:09 PM, Alex Shulgin <
alexander.shulgin at yessoftware.com> wrote:
> Alex Shulgin wrote:
>> Alex Shulgin wrote:
>>> 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
>> 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.
> PS: is there more appropriate way to increment IntPtr value w/o using
You could use a loop and Marshal.ReadByte (IntPtr ptr, int offset);
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-devel-list