Where is the implementation of "getaddrinfo" called by InetAddress.java

I recently studied why a browser on Android does not support access to IPv6 websites through IPv6 URLs and I think this is due to the native getaddrinfo method called android/dalvik/libcore/luni/src/main/java/java/net/ InetAddress.java , which is then called by the Browser application, throws a UnknownHostException when trying to convert an IPv6 URL to its addresses.

Start at line 507, InetAddress.java code:

 try { InetAddress[] addresses = bytesToInetAddresses(getaddrinfo(host), host); addressCache.put(host, addresses); return addresses; 

and the native method is declared on line 516 as follows:

 private static native byte[][] getaddrinfo(String name) throws UnknownHostException; 

But I did not find any hint where the implementation of this native method getaddrinfo is - although I found two files called getaddrinfo.c . Does this mean JNI or NDK rules? If therefore the statement System.loadLibary("NameOfTheLibrary") should be, but I did not find it. Anyone could give me a hint about finding an implementation of this own getaddrinfo method?

The full InetAddress.java source file can be found at http://ooowjc.wikispaces.com/Attachments

+4
source share
1 answer

In the Android source tree, libcore / luni / src / main / native / java_net_InetAddress.cpp.

I would include a link to the file in the android-git repository, but the site seems to be closed at the moment.

+3
source

Source: https://habr.com/ru/post/1337946/


All Articles