Merge "Do not start conntrack event monitor when running on R" am: c162fc297f

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1639703

Change-Id: Ib43879926b0b6789025ab2360c8dc0de1f28090f
This commit is contained in:
Treehugger Robot
2021-03-16 08:46:05 +00:00
committed by Automerger Merge Worker
2 changed files with 7 additions and 1 deletions

View File

@@ -426,7 +426,8 @@ public class BpfCoordinator {
* See NetlinkMonitor#handlePacket, NetlinkMessage#parseNfMessage.
*/
public void startMonitoring(@NonNull final IpServer ipServer) {
if (!isUsingBpf()) return;
// TODO: Wrap conntrackMonitor starting function into mBpfCoordinatorShim.
if (!isUsingBpf() || !mDeps.isAtLeastS()) return;
if (mMonitoringIpServers.contains(ipServer)) {
Log.wtf(TAG, "The same downstream " + ipServer.interfaceName()
@@ -447,6 +448,9 @@ public class BpfCoordinator {
* Note that this can be only called on handler thread.
*/
public void stopMonitoring(@NonNull final IpServer ipServer) {
// TODO: Wrap conntrackMonitor stopping function into mBpfCoordinatorShim.
if (!isUsingBpf() || !mDeps.isAtLeastS()) return;
mMonitoringIpServers.remove(ipServer);
if (!mMonitoringIpServers.isEmpty()) return;

View File

@@ -1150,6 +1150,7 @@ public class BpfCoordinatorTest {
}
@Test
@IgnoreUpTo(Build.VERSION_CODES.R)
public void testStartStopConntrackMonitoring() throws Exception {
setupFunctioningNetdInterface();
@@ -1170,6 +1171,7 @@ public class BpfCoordinatorTest {
}
@Test
@IgnoreUpTo(Build.VERSION_CODES.R)
public void testStartStopConntrackMonitoringWithTwoDownstreamIfaces() throws Exception {
setupFunctioningNetdInterface();