adjust for new T bpfloader net_shared location
(this is safe because on pre-T none of these maps and programs are mainlined and thus safe to access from mainline code anyway) Test: TreeHugger, manual Bug: 218408035 Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I23e565d665247f33e084978890a1ee8ffe0fe568
This commit is contained in:
parent
7d7e7cd1fe
commit
0736d7bd91
9 changed files with 19 additions and 18 deletions
|
|
@ -98,7 +98,7 @@ static const int IFACE_STATS_MAP_SIZE = 1000;
|
|||
static const int CONFIGURATION_MAP_SIZE = 2;
|
||||
static const int UID_OWNER_MAP_SIZE = 2000;
|
||||
|
||||
#define BPF_PATH "/sys/fs/bpf/"
|
||||
#define BPF_PATH "/sys/fs/bpf/net_shared/"
|
||||
|
||||
#define BPF_EGRESS_PROG_PATH BPF_PATH "prog_netd_cgroupskb_egress_stats"
|
||||
#define BPF_INGRESS_PROG_PATH BPF_PATH "prog_netd_cgroupskb_ingress_stats"
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public class BpfInterfaceMapUpdater {
|
|||
private static final String TAG = BpfInterfaceMapUpdater.class.getSimpleName();
|
||||
// This is current path but may be changed soon.
|
||||
private static final String IFACE_INDEX_NAME_MAP_PATH =
|
||||
"/sys/fs/bpf/map_netd_iface_index_name_map";
|
||||
"/sys/fs/bpf/net_shared/map_netd_iface_index_name_map";
|
||||
private final IBpfMap<U32, InterfaceMapValue> mBpfMap;
|
||||
private final INetd mNetd;
|
||||
private final Handler mHandler;
|
||||
|
|
|
|||
|
|
@ -218,17 +218,16 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
|||
private static final String NETSTATS_COMBINE_SUBTYPE_ENABLED =
|
||||
"netstats_combine_subtype_enabled";
|
||||
|
||||
// This is current path but may be changed soon.
|
||||
private static final String UID_COUNTERSET_MAP_PATH =
|
||||
"/sys/fs/bpf/map_netd_uid_counterset_map";
|
||||
"/sys/fs/bpf/net_shared/map_netd_uid_counterset_map";
|
||||
private static final String COOKIE_TAG_MAP_PATH =
|
||||
"/sys/fs/bpf/map_netd_cookie_tag_map";
|
||||
"/sys/fs/bpf/net_shared/map_netd_cookie_tag_map";
|
||||
private static final String APP_UID_STATS_MAP_PATH =
|
||||
"/sys/fs/bpf/map_netd_app_uid_stats_map";
|
||||
"/sys/fs/bpf/net_shared/map_netd_app_uid_stats_map";
|
||||
private static final String STATS_MAP_A_PATH =
|
||||
"/sys/fs/bpf/map_netd_stats_map_A";
|
||||
"/sys/fs/bpf/net_shared/map_netd_stats_map_A";
|
||||
private static final String STATS_MAP_B_PATH =
|
||||
"/sys/fs/bpf/map_netd_stats_map_B";
|
||||
"/sys/fs/bpf/net_shared/map_netd_stats_map_B";
|
||||
|
||||
private final Context mContext;
|
||||
private final NetworkStatsFactory mStatsFactory;
|
||||
|
|
|
|||
|
|
@ -754,7 +754,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||
* The BPF program attached to the tc-police hook to account for to-be-dropped traffic.
|
||||
*/
|
||||
private static final String TC_POLICE_BPF_PROG_PATH =
|
||||
"/sys/fs/bpf/prog_netd_schedact_ingress_account";
|
||||
"/sys/fs/bpf/net_shared/prog_netd_schedact_ingress_account";
|
||||
|
||||
private static String eventName(int what) {
|
||||
return sMagicDecoderRing.get(what, Integer.toString(what));
|
||||
|
|
|
|||
|
|
@ -100,11 +100,11 @@ public class ClatCoordinator {
|
|||
private static final String CLAT_INGRESS6_MAP_PATH = makeMapPath("ingress6");
|
||||
|
||||
private static String makeMapPath(String which) {
|
||||
return "/sys/fs/bpf/map_clatd_clat_" + which + "_map";
|
||||
return "/sys/fs/bpf/net_shared/map_clatd_clat_" + which + "_map";
|
||||
}
|
||||
|
||||
private static String makeProgPath(boolean ingress, boolean ether) {
|
||||
String path = "/sys/fs/bpf/prog_clatd_schedcls_"
|
||||
String path = "/sys/fs/bpf/net_shared/prog_clatd_schedcls_"
|
||||
+ (ingress ? "ingress6" : "egress4")
|
||||
+ "_clat_"
|
||||
+ (ether ? "ether" : "rawip");
|
||||
|
|
|
|||
|
|
@ -47,10 +47,11 @@ public class ConnectivityNativeService extends ConnectivityNative.Stub {
|
|||
private static final String TAG = ConnectivityNativeService.class.getSimpleName();
|
||||
private static final String CGROUP_PATH = "/sys/fs/cgroup";
|
||||
private static final String V4_PROG_PATH =
|
||||
"/sys/fs/bpf/prog_block_bind4_block_port";
|
||||
"/sys/fs/bpf/net_shared/prog_block_bind4_block_port";
|
||||
private static final String V6_PROG_PATH =
|
||||
"/sys/fs/bpf/prog_block_bind6_block_port";
|
||||
private static final String BLOCKED_PORTS_MAP_PATH = "/sys/fs/bpf/map_block_blocked_ports_map";
|
||||
"/sys/fs/bpf/net_shared/prog_block_bind6_block_port";
|
||||
private static final String BLOCKED_PORTS_MAP_PATH =
|
||||
"/sys/fs/bpf/net_shared/map_block_blocked_ports_map";
|
||||
|
||||
private final Context mContext;
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public class DscpPolicyTracker {
|
|||
|
||||
private static final String TAG = DscpPolicyTracker.class.getSimpleName();
|
||||
private static final String PROG_PATH =
|
||||
"/sys/fs/bpf/prog_dscp_policy_schedcls_set_dscp";
|
||||
"/sys/fs/bpf/net_shared/prog_dscp_policy_schedcls_set_dscp";
|
||||
// Name is "map + *.o + map_name + map". Can probably shorten this
|
||||
private static final String IPV4_POLICY_MAP_PATH = makeMapPath(
|
||||
"dscp_policy_ipv4_dscp_policies");
|
||||
|
|
@ -61,7 +61,7 @@ public class DscpPolicyTracker {
|
|||
private static final int MAX_POLICIES = 16;
|
||||
|
||||
private static String makeMapPath(String which) {
|
||||
return "/sys/fs/bpf/map_" + which + "_map";
|
||||
return "/sys/fs/bpf/net_shared/map_" + which + "_map";
|
||||
}
|
||||
|
||||
private Set<String> mAttachedIfaces;
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ using android::modules::sdklevel::IsAtLeastT;
|
|||
|
||||
#define PLATFORM "/sys/fs/bpf/"
|
||||
#define TETHERING "/sys/fs/bpf/tethering/"
|
||||
#define SHARED "/sys/fs/bpf/net_shared/"
|
||||
|
||||
class BpfExistenceTest : public ::testing::Test {
|
||||
};
|
||||
|
|
|
|||
|
|
@ -109,9 +109,9 @@ public class ClatCoordinatorTest {
|
|||
new FileDescriptor());
|
||||
|
||||
private static final String EGRESS_PROG_PATH =
|
||||
"/sys/fs/bpf/prog_clatd_schedcls_egress4_clat_rawip";
|
||||
"/sys/fs/bpf/net_shared/prog_clatd_schedcls_egress4_clat_rawip";
|
||||
private static final String INGRESS_PROG_PATH =
|
||||
"/sys/fs/bpf/prog_clatd_schedcls_ingress6_clat_ether";
|
||||
"/sys/fs/bpf/net_shared/prog_clatd_schedcls_ingress6_clat_ether";
|
||||
private static final ClatEgress4Key EGRESS_KEY = new ClatEgress4Key(STACKED_IFINDEX,
|
||||
INET4_LOCAL4);
|
||||
private static final ClatEgress4Value EGRESS_VALUE = new ClatEgress4Value(BASE_IFINDEX,
|
||||
|
|
|
|||
Loading…
Reference in a new issue