History log of /dalvik/libcore/luni/src/main/native/ifaddrs-android.h
Revision Date Author Comments
1dd42bb9da388c55191449b848f9d82dc4673229 21-Apr-2010 Elliott Hughes <enh@google.com> Fix NetworkInterface on sholes/ppp.

We need to use IFA_LOCAL to get the interface addresses; IFA_ADDRESS is the
remote address (which is usually the same as IFA_LOCAL, but not in the ppp
case).

Tested on sholes, where it fixes the test used in the bug; also tested on
passion, where it doesn't break the already-working test.

Bug: 2575983
Change-Id: Ib334a002dc099daeeb05cbc341fe233d4d11d2f7
5d26339aed33942ba82bfdb79e1b7e9a832c96a7 26-Nov-2009 Elliott Hughes <enh@google.com> DO NOT MERGE: backport the IPv6 NetworkInterface/multicast fixes.

This is a backport of the minimal changes from master (flan) to fix IPv6
multicasting. Specifically, it fixes NetworkInterface to report IPv6 addresses,
it fixes GenericIPMreq so we pass the interface indexes down to native code,
it replaces our old copy of harmony's MulticastSocketTest with the current
upstream version (to avoid bogus failures), and it brings back one small
"unrelated" fix to OSNetworkSystem.cpp that's necessary to prevent failures
in later parts of tests we used to fail too early to notice secondary
problems.

This passes all the (fixed) MulticastSocketTest tests, causes no regressions
in the whole net.AllTests suite, and fixes the user-submitted application
that started the investigation.

Bug: 1750581
ff90b1aa7ea193379355791ce90bc21c7de17125 23-Nov-2009 Elliott Hughes <enh@google.com> Explicitly ignore non-IPv4/IPv6 addresses from IFA_ADDRESS.

I don't think this can happen (some other calls return hardware addresses too,
but I've never seen a hardware address in an IFA_ADDRESS message), but netlink
is badly documented, and it's better to be safe than sorry.
18090720f97d2fe718f11d0944b623676bf6b78b 20-Nov-2009 Elliott Hughes <enh@google.com> Rewrite NetworkInterface's JNI for IPv6.

The old ioctl SIOCGIFCONF implementation of getNetworkInterfaces only returns
IPv4 addresses. Now we've switched everything over to IPv6, that's not good
enough. This change (a) implements glibc/BSD-like getifaddrs(3)/freeifaddrs(3)
for Android, and (b) rewrites our getNetworkInterfaces to use that method. Of
particular note is that we now do more of the work in Java. The JNI hands back
a Java equivalent of getifaddrs(3)'s linked list of ifaddrs structs. The new
package-private java.net.InterfaceAddress class serves as Java's "struct
ifaddrs".

The old implementation was also broken: SIOCGIFCONF doesn't actually return
interface indexes from the kernel as the old code believed, so we were
pulling the address family out of the IPv4 address it returned, leading
us to assign the index 2 to all network interfaces. This caused all kinds of
weird behavior later.

I also had to fix GenericIPMreq so that its interface index field is actually
set. The native code gets passed one of these objects when setNetworkInterface
is called, so it's kind of important that the object identify which interface
it's supposed to correspond to.

I've also added missing copyright headers.

This fixes all of the harmony tests on the simulator and on the device. It
fixes several but not all of the jtreg MulticastSocket and IPv6 tests.