mail-archives/mono-osx/2009-June/002383.html

98 строки
4.3 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mono-osx] [Mono-dev] [PATCH] Simple implementation of network interface properties for Mac OS X
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:mono-osx%40lists.ximian.com?Subject=%5BMono-osx%5D%20%5BMono-dev%5D%20%5BPATCH%5D%20Simple%20implementation%20of%20network%0A%20interface%20properties%20for%20Mac%20OS%20X&In-Reply-To=4A0D86D9.50306%40yessoftware.com">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="002382.html">
<LINK REL="Next" HREF="002385.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mono-osx] [Mono-dev] [PATCH] Simple implementation of network interface properties for Mac OS X</H1>
<B>Alex Shulgin</B>
<A HREF="mailto:mono-osx%40lists.ximian.com?Subject=%5BMono-osx%5D%20%5BMono-dev%5D%20%5BPATCH%5D%20Simple%20implementation%20of%20network%0A%20interface%20properties%20for%20Mac%20OS%20X&In-Reply-To=4A0D86D9.50306%40yessoftware.com"
TITLE="[Mono-osx] [Mono-dev] [PATCH] Simple implementation of network interface properties for Mac OS X">alexander.shulgin at yessoftware.com
</A><BR>
<I>Tue Jun 30 11:09:50 EDT 2009</I>
<P><UL>
<LI>Previous message: <A HREF="002382.html">[Mono-osx] Announcing the release of Mono 2.4.2
</A></li>
<LI>Next message: <A HREF="002385.html">[Mono-osx] [Mono-dev] [PATCH] Simple implementation of network interface properties for Mac OS X
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#2383">[ date ]</a>
<a href="thread.html#2383">[ thread ]</a>
<a href="subject.html#2383">[ subject ]</a>
<a href="author.html#2383">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>Alex Shulgin wrote:
&gt;<i> Alex Shulgin wrote:
</I>&gt;&gt;<i> Hi,
</I>&gt;&gt;<i>
</I>&gt;&gt;<i> In the current version System.Net.NetworkInformation.NetworkInterface
</I>&gt;&gt;<i> provides limited information about network interfaces on the system
</I>&gt;&gt;<i> (their names only).
</I>&gt;&gt;<i>
</I>&gt;&gt;<i> The attached patch adds support for NetworkInterfaceType and
</I>&gt;&gt;<i> GetPhysicalAddress() on Mac OS.
</I>&gt;<i>
</I>&gt;<i> Oops, I've almost forgot about IPv6... and missed the added file
</I>&gt;<i> MacOsNetworkInterfaceMarshal.
</I>&gt;<i>
</I>&gt;<i> Please see the fixed patch instead.
</I>
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()?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: macos-network-interfaces-impl-new.patch
Type: text/x-patch
Size: 859 bytes
Desc: not available
Url : <A HREF="http://lists.ximian.com/pipermail/mono-osx/attachments/20090630/c15fc44a/attachment.bin">http://lists.ximian.com/pipermail/mono-osx/attachments/20090630/c15fc44a/attachment.bin</A>
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="002382.html">[Mono-osx] Announcing the release of Mono 2.4.2
</A></li>
<LI>Next message: <A HREF="002385.html">[Mono-osx] [Mono-dev] [PATCH] Simple implementation of network interface properties for Mac OS X
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#2383">[ date ]</a>
<a href="thread.html#2383">[ thread ]</a>
<a href="subject.html#2383">[ subject ]</a>
<a href="author.html#2383">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/mono-osx">More information about the Mono-osx
mailing list</a><br>
</body></html>