If we encounter such a device we assign it an empty name followed by index number, so that we can
put any number of such devices in the dictionary and report them to the user.
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=21741
Added code to call Xamarin.Android internal implementation of getifaddrs/freeifaddrs to provide us
with the required information to fulfill the request.
Added a handful of Linux ARP hardware IDs which are considered to be tunnel devices and which may occur
on Android devices.
Part of fix for https://bugzilla.xamarin.com/show_bug.cgi?id=1969
- ADDED: Implemented NetworkInterface property "OperationalStatus" to be UP, in case the IFF_UP flag is set
- ADDED: Implemented NetworkInterface property "SupportsMulticast" to be true, in case the IFF_MULTICAST flag is set
This change is released under the MIT license.
Modulo the GUID in the assembly and the GUID embedded in some
field initializers that use the assembly GUID for their name, the
assemblies are idential before and after the patch.
On my (cursed?) MacBook Pro, calling
System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()
results in an exception:
System.ArgumentException: length
at System.Array.Copy (System.Array sourceArray, Int32 sourceIndex, System.Array destinationArray, Int32 destinationIndex, Int32 length) [0x00000] in <filename unknown>:0
at System.Net.NetworkInformation.MacOsNetworkInterface.ImplGetAllNetworkInterfaces () [0x00000] in <filename unknown>:0
at System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces () [0x00000] in <filename unknown>:0
Some printfs later, and we see why:
Array.Copy(array.Length=12, 3, array.Length=0, 0, 0)
Array.Copy(array.Length=12, 4, array.Length=0, 0, 0)
Array.Copy(array.Length=12, 4, array.Length=0, 0, 0)
Array.Copy(array.Length=12, 3, array.Length=6, 0, 6)
Array.Copy(array.Length=12, 3, array.Length=6, 0, 6)
Array.Copy(array.Length=12, 3, array.Length=8, 0, 4)
Array.Copy(array.Length=12, 4, array.Length=6, 0, 6)
Array.Copy(array.Length=12, 8, array.Length=6, 0, 6)
# BOOM!
(Apparently I have 8 interfaces: lo0, gif0, stf0, en0, en1, fw0, p2p0,
and vboxnet0.)
The problem is readily obvious: we're trying to read 6 bytes of data
when only 4 are available, and Array.Copy() complains appropriately.
The fix -- which looks to almost contradict a02076ba -- is to use
`sockaddrdl.sdl_data.Length - sockaddrdl.sdl_nlen` instead of
`sockaddrdl.sdl_data.Length - macAddress.Length` (or sdl_alen).
sdl_nlen is the offset into the source sockaddrdl.sdl_data array, and
in this case sockaddrdl.sdl_alen (the length of the destination
macAddress) isn't the same as sockaddrdl.sdl_nlen, hence the breakage.
* IPAddressCollection.cs: added an internal method to make the
collection read-only.
* IPInterfaceProperties.cs: read DNS client configuration from
/etc/resolv.conf.
* NetworkInterface.cs: dummy Speed property for linux.
Bug #450211 fixed.
svn path=/trunk/mcs/; revision=120281
* NetworkInterface.cs: special case for loopback interfaces so that
their a physical interface address is PhysicalInterfaceAddress.None.
Fixes bug #422118.
svn path=/trunk/mcs/; revision=114343
* NetworkInterface.cs: implemented support for Linux. Parts
contributed by Eric Butler ([email protected]), thanks!
* GatewayIPAddressInformationCollection.cs,
IPInterfaceProperties.cs, IPAddressInformationCollection.cs: added
support for Linux. Patch contributed by Eric Butler
([email protected]), thanks!
* IPv4InterfaceProperties.cs: implemented support for Linux.
* LinuxNetworkInterfaceMarshal.cs: added. Contains a set of
Linux-specific structures required for accessing the network
information. Patch contributed by Eric Butler
([email protected]), thanks!
* MulticastIPAddressInformation.cs: added support for Linux
multicast information. Patch contributed by Eric Butler
([email protected]), thanks!
* IPv4InterfaceStatistics.cs: use the parent IfacePath to get the
path to the interface description file.
* UnicastIPAddressInformation.cs: added stubs for
LinuxUnicastIPAddressInformation. Patch contributed by Eric Butler
([email protected]), thanks!
* Ping.cs: Use /bin/ping when running as non-root user
(implementation by Jackson Harper <[email protected]>) or use
raw sockets if running as root or if the current process has the
CAP_NET_RAW Linux capability set while running as an unprivileged
user.
svn path=/trunk/mcs/; revision=107890
* NetworkInterface.cs (GetAllNetworkInterfaces): return an empty
array instead of throwing an exception on operating systems where
svn path=/trunk/mcs/; revision=86646