diff --git a/Tethering/Android.bp b/Tethering/Android.bp index 23aa7f8d51..d8557adc61 100644 --- a/Tethering/Android.bp +++ b/Tethering/Android.bp @@ -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 diff --git a/Tethering/jni/android_net_util_TetheringUtils.cpp b/Tethering/jni/android_net_util_TetheringUtils.cpp index 94c871d8a3..7bfb6dab4a 100644 --- a/Tethering/jni/android_net_util_TetheringUtils.cpp +++ b/Tethering/jni/android_net_util_TetheringUtils.cpp @@ -19,8 +19,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -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;