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

This commit is contained in:
Treehugger Robot
2021-03-16 08:03:46 +00:00
committed by Gerrit Code Review
2 changed files with 7 additions and 1 deletions

View File

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

View File

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