From a7937728089acaed3fd2c66a0f6fdc8d1e08f4f3 Mon Sep 17 00:00:00 2001 From: Yuyang Huang Date: Wed, 26 Jun 2024 02:36:20 +0000 Subject: [PATCH] Revert "ClatCoordinator - use SingleWriterBpfMap" This reverts commit I93b8b94dcad8f2bc4d022314372fb97109ed8f2f. Reason for revert: ClatIngress6Value and ClatEgress4Value are written to by the clatd.c program (reference aosp/3002596). Due to this, SingleWriterBpfMap is unsuitable in this scenario, as it can only be used when no BPF program ever writes to the map. Change-Id: I382bbfc8554391c6c83a39bbea155114202b71a8 --- .../com/android/server/connectivity/ClatCoordinator.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/service/src/com/android/server/connectivity/ClatCoordinator.java b/service/src/com/android/server/connectivity/ClatCoordinator.java index b1c770beed..f333dae572 100644 --- a/service/src/com/android/server/connectivity/ClatCoordinator.java +++ b/service/src/com/android/server/connectivity/ClatCoordinator.java @@ -45,7 +45,6 @@ import com.android.net.module.util.BpfDump; import com.android.net.module.util.BpfMap; import com.android.net.module.util.IBpfMap; import com.android.net.module.util.InterfaceParams; -import com.android.net.module.util.SingleWriterBpfMap; import com.android.net.module.util.TcUtils; import com.android.net.module.util.bpf.ClatEgress4Key; import com.android.net.module.util.bpf.ClatEgress4Value; @@ -257,7 +256,7 @@ public class ClatCoordinator { @Nullable public IBpfMap getBpfIngress6Map() { try { - return SingleWriterBpfMap.getSingleton(CLAT_INGRESS6_MAP_PATH, + return new BpfMap<>(CLAT_INGRESS6_MAP_PATH, ClatIngress6Key.class, ClatIngress6Value.class); } catch (ErrnoException e) { Log.e(TAG, "Cannot create ingress6 map: " + e); @@ -269,7 +268,7 @@ public class ClatCoordinator { @Nullable public IBpfMap getBpfEgress4Map() { try { - return SingleWriterBpfMap.getSingleton(CLAT_EGRESS4_MAP_PATH, + return new BpfMap<>(CLAT_EGRESS4_MAP_PATH, ClatEgress4Key.class, ClatEgress4Value.class); } catch (ErrnoException e) { Log.e(TAG, "Cannot create egress4 map: " + e); @@ -281,7 +280,6 @@ public class ClatCoordinator { @Nullable public IBpfMap getBpfCookieTagMap() { try { - // also read and written from other locations return new BpfMap<>(COOKIE_TAG_MAP_PATH, CookieTagMapKey.class, CookieTagMapValue.class); } catch (ErrnoException e) {