diff --git a/Tethering/src/com/android/networkstack/tethering/BpfCoordinator.java b/Tethering/src/com/android/networkstack/tethering/BpfCoordinator.java index 0f777d56bc..74eb87b6b1 100644 --- a/Tethering/src/com/android/networkstack/tethering/BpfCoordinator.java +++ b/Tethering/src/com/android/networkstack/tethering/BpfCoordinator.java @@ -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; diff --git a/Tethering/tests/unit/src/com/android/networkstack/tethering/BpfCoordinatorTest.java b/Tethering/tests/unit/src/com/android/networkstack/tethering/BpfCoordinatorTest.java index ba4ed4701b..f508f692c9 100644 --- a/Tethering/tests/unit/src/com/android/networkstack/tethering/BpfCoordinatorTest.java +++ b/Tethering/tests/unit/src/com/android/networkstack/tethering/BpfCoordinatorTest.java @@ -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();