About the IPv6 function "getaddrinfo" called by "InetAddress.java"

460 views
Skip to first unread message

ooowjc

unread,
Feb 1, 2011, 6:41:48 AM2/1/11
to Android-x86
I have been recently studying on why the Browser in the android-x86 OS
does not support accessing IPv6 websites through IPv6 URLs and would
like to contribute my results to the android-x86 group.
I think it is due to the native method "getaddrinfo" called by /home/
ubuntu/android-x86/dalvik/libcore/luni/src/main/java/java/net/
InetAddress.java which is then called by the Browser application
throws an UnknownHostException when trying to convert an IPv6 URL to
its addresses.

Begin from line 507, the code of InetAddress.java is:
------------------------------------------------------------------------------------------------------
try {
InetAddress[] addresses =
bytesToInetAddresses(getaddrinfo(host), host);
addressCache.put(host, addresses);
return addresses;
------------------------------------------------------------------------------------------------------

and the native method is declared at line 516 as:
------------------------------------------------------------------------------------------------------
private static native byte[][] getaddrinfo(String name) throws
UnknownHostException;
------------------------------------------------------------------------------------------------------

But I haven't found any hint about where the implementation of this
native method "getaddrinfo" is although i found there are two files
named "getaddrinfo.c". Does here follow the rules of JNI or NDK? If
so, a statement of "System.loadLibary("NameOfTheLibrary")" should be
found but i didn't find it.

Any one could give me a hint on finding the implementation of this
native method "getaddrinfo"??

Suman Saraf

unread,
Feb 1, 2011, 9:54:32 AM2/1/11
to andro...@googlegroups.com
This is a POSIX standard function. Look in:
srcs/bionic/libc/netbsd/net/getaddrinfo.c

--- On Tue, 1/2/11, ooowjc <ee07...@gmail.com> wrote:

> --
> You received this message because you are subscribed to the
> Google Groups "Android-x86" group.
> To post to this group, send email to andro...@googlegroups.com.
> To unsubscribe from this group, send email to
> android-x86...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/android-x86?hl=en.
>
>



Kjaergaard

unread,
Feb 1, 2011, 2:32:18 PM2/1/11
to Android-x86

The implementation of getaddrinfo is in a .h file. Strange. I don't
have the source available right now, but I believe it is called
ifaddrs.h or something similar.

I have also investigated this issue and I don't thing that inspection
of ipv6 interfaces/addresses are implemented.

However I run ipv6 on Android-x86 without problems. Are you sure that
your kernel config has enabled ipv6 and that you have a router that do
ipv6 router advertisement?

Jens kristian
Tieto

On Feb 1, 3:54 pm, Suman Saraf <saraf_su...@yahoo.com> wrote:
> This is a POSIX standard function. Look in:
> srcs/bionic/libc/netbsd/net/getaddrinfo.c
>
> --- On Tue, 1/2/11, ooowjc <ee07b...@gmail.com> wrote:

ooowjc

unread,
Feb 1, 2011, 9:34:55 PM2/1/11
to Android-x86
Are you saying that you are able to access IPv6 websites through both
their URLs and addresses? Where is your android-x86 OS running on? It
is running on a virtual machine in a PC or in your cellphone?
Could you provide me more detailed information about enabling ipv6 in
the kernel config? That would be a great help for me!
Thx very much~

ooowjc

unread,
Feb 1, 2011, 10:37:08 PM2/1/11
to Android-x86
one more thing i care about. After you press Alt + F1 you enter the
shell, could you use "ping6" or "ping -6" command? (assuming your
android-x86 is running on a PC)

On Feb 2, 3:32 am, Kjaergaard <ted...@mail.dk> wrote:

Kjaergaard

unread,
Feb 2, 2011, 4:04:57 PM2/2/11
to Android-x86

I can use URL. I tend to remember that I had some problems when
entering the ipv6 address.

I have been able to use ping for ipv6 and I belive that ipv6 is
enabled in Android-x86 busybox.

Try to issue: cat /proc/net/if_inet6 it should list the ipv6 addresses
of the interfaces, and at least the link local addresses should be
present.

Best regards
Jens kristian

ooowjc

unread,
Feb 5, 2011, 9:28:27 AM2/5/11
to Android-x86
Thx! It is a great help for me to understand the IPv6 support of the
whole OS.
I then built the source code with "CONFIG_IPV6" set and tried IPv6
URLs in the Browser and yes, it works!
But i don't get it. I think the source code of the Browser hasn't been
changed, how it can be that the Browser suddenly support accessing
websites through IPv6 URLs...? Is it somewhere in the source code of
the Browser that loads the kernel config file when it is being built?

Best wishes
Jiechao Wang
Reply all
Reply to author
Forward
0 new messages