Use libnetjniutils for JNI File Descriptor info
Drops use of deprecated API in libnativehelper and uses a common helper that will be stable across releases. Bug: 158749603 Test: m Change-Id: Ic1a1811ffb9a1c207f562a180417e99df31e3502
This commit is contained in:
@@ -67,6 +67,9 @@ cc_library {
|
||||
"liblog",
|
||||
"libnativehelper_compat_libc++",
|
||||
],
|
||||
static_libs: [
|
||||
"libnetjniutils",
|
||||
],
|
||||
|
||||
// We cannot use plain "libc++" here to link libc++ dynamically because it results in:
|
||||
// java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
#include <jni.h>
|
||||
#include <linux/filter.h>
|
||||
#include <nativehelper/JNIHelp.h>
|
||||
#include <nativehelper/JNIHelpCompat.h>
|
||||
#include <nativehelper/ScopedUtfChars.h>
|
||||
#include <netjniutils/netjniutils.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/ether.h>
|
||||
#include <netinet/ip6.h>
|
||||
@@ -57,7 +57,7 @@ static void android_net_util_setupIcmpFilter(JNIEnv *env, jobject javaFd, uint32
|
||||
filter_code,
|
||||
};
|
||||
|
||||
int fd = jniGetFDFromFileDescriptor(env, javaFd);
|
||||
int fd = netjniutils::GetNativeFileDescriptor(env, javaFd);
|
||||
if (setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)) != 0) {
|
||||
jniThrowExceptionFmt(env, "java/net/SocketException",
|
||||
"setsockopt(SO_ATTACH_FILTER): %s", strerror(errno));
|
||||
@@ -79,7 +79,7 @@ static void android_net_util_setupRaSocket(JNIEnv *env, jobject clazz, jobject j
|
||||
{
|
||||
static const int kLinkLocalHopLimit = 255;
|
||||
|
||||
int fd = jniGetFDFromFileDescriptor(env, javaFd);
|
||||
int fd = netjniutils::GetNativeFileDescriptor(env, javaFd);
|
||||
|
||||
// Set an ICMPv6 filter that only passes Router Solicitations.
|
||||
struct icmp6_filter rs_only;
|
||||
|
||||
Reference in New Issue
Block a user