Merge changes from topics "rename-libbpfmapjni", "rename-libtetherutiljni"
* changes: Rename libbpfmapjni and include bpf common util library Rename tethering jni and get the jni by its package name
This commit is contained in:
@@ -32,6 +32,7 @@ import static com.android.networkstack.tethering.BpfUtils.DOWNSTREAM;
|
||||
import static com.android.networkstack.tethering.BpfUtils.UPSTREAM;
|
||||
import static com.android.networkstack.tethering.TetheringConfiguration.DEFAULT_TETHER_OFFLOAD_POLL_INTERVAL_MS;
|
||||
import static com.android.networkstack.tethering.UpstreamNetworkState.isVcnInterface;
|
||||
import static com.android.networkstack.tethering.util.TetheringUtils.getTetheringJniLibraryName;
|
||||
|
||||
import android.app.usage.NetworkStatsManager;
|
||||
import android.net.INetd;
|
||||
@@ -99,7 +100,7 @@ public class BpfCoordinator {
|
||||
// TetherService, but for tests it needs to be either loaded here or loaded by every test.
|
||||
// TODO: is there a better way?
|
||||
static {
|
||||
System.loadLibrary("tetherutilsjni");
|
||||
System.loadLibrary(getTetheringJniLibraryName());
|
||||
}
|
||||
|
||||
private static final String TAG = BpfCoordinator.class.getSimpleName();
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.android.networkstack.tethering;
|
||||
import static android.system.OsConstants.ETH_P_IP;
|
||||
import static android.system.OsConstants.ETH_P_IPV6;
|
||||
|
||||
import static com.android.networkstack.tethering.util.TetheringUtils.getTetheringJniLibraryName;
|
||||
|
||||
import android.net.util.InterfaceParams;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -31,7 +33,7 @@ import java.io.IOException;
|
||||
*/
|
||||
public class BpfUtils {
|
||||
static {
|
||||
System.loadLibrary("tetherutilsjni");
|
||||
System.loadLibrary(getTetheringJniLibraryName());
|
||||
}
|
||||
|
||||
// For better code clarity when used for 'bool ingress' parameter.
|
||||
|
||||
@@ -21,6 +21,7 @@ import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.android.net.module.util.JniUtil;
|
||||
import com.android.networkstack.tethering.TetherStatsValue;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
@@ -37,13 +38,18 @@ import java.util.Objects;
|
||||
*/
|
||||
public class TetheringUtils {
|
||||
static {
|
||||
System.loadLibrary("tetherutilsjni");
|
||||
System.loadLibrary(getTetheringJniLibraryName());
|
||||
}
|
||||
|
||||
public static final byte[] ALL_NODES = new byte[] {
|
||||
(byte) 0xff, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
|
||||
};
|
||||
|
||||
/** The name should be com_android_networkstack_tethering_util_jni. */
|
||||
public static String getTetheringJniLibraryName() {
|
||||
return JniUtil.getJniLibraryName(TetheringUtils.class.getPackage());
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures a socket for receiving and sending ICMPv6 neighbor advertisments.
|
||||
* @param fd the socket's {@link FileDescriptor}.
|
||||
|
||||
Reference in New Issue
Block a user