Rename dscp_policy.o to dscpPolicy.o

Underscore character may cause bpf prog/map naming collision. For
example, x.o with map y_z and x_y.o with map z both result in x_y_z
prog/map name, which should be prevented during compile-time.

aosp/2147825 will prohibit underscore character in bpf source name
(source name derives the obj name). Existing bpf modules with underscore
characters in source name need to be updated accordingly.

Bug: 236706995
Test: atest bpf_existence_test
Test: adb root; adb shell ls -l sys/fs/bpf/net_shared | grep dscpPolicy
Change-Id: Ibe98944d09d42bd11b78b5e9ae35ded48c70416d
This commit is contained in:
Ken Chen
2022-07-14 16:46:39 +08:00
parent e8bc257597
commit 74ff3ee501
6 changed files with 18 additions and 18 deletions

View File

@@ -85,7 +85,7 @@ apex {
bpfs: [
"block.o",
"clatd.o",
"dscp_policy.o",
"dscpPolicy.o",
"netd.o",
"offload.o",
"offload@btf.o",
@@ -209,7 +209,7 @@ override_apex {
bpfs: [
"block.o",
"clatd.o",
"dscp_policy.o",
"dscpPolicy.o",
"netd.o",
"offload@inprocess.o",
"test@inprocess.o",

View File

@@ -72,8 +72,8 @@ bpf {
}
bpf {
name: "dscp_policy.o",
srcs: ["dscp_policy.c"],
name: "dscpPolicy.o",
srcs: ["dscpPolicy.c"],
btf: true,
cflags: [
"-Wall",

View File

@@ -31,7 +31,7 @@
#define BPFLOADER_MIN_VER BPFLOADER_T_BETA3_VERSION
#include "bpf_helpers.h"
#include "dscp_policy.h"
#include "dscpPolicy.h"
#define ECN_MASK 3
#define IP4_OFFSET(field, header) (header + offsetof(struct iphdr, field))

View File

@@ -52,12 +52,12 @@ public class DscpPolicyTracker {
private static final String TAG = DscpPolicyTracker.class.getSimpleName();
private static final String PROG_PATH =
"/sys/fs/bpf/net_shared/prog_dscp_policy_schedcls_set_dscp";
"/sys/fs/bpf/net_shared/prog_dscpPolicy_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");
"dscpPolicy_ipv4_dscp_policies");
private static final String IPV6_POLICY_MAP_PATH = makeMapPath(
"dscp_policy_ipv6_dscp_policies");
"dscpPolicy_ipv6_dscp_policies");
private static final int MAX_POLICIES = 16;
private static String makeMapPath(String which) {
@@ -213,7 +213,7 @@ public class DscpPolicyTracker {
}
/**
* Add the provided DSCP policy to the bpf map. Attach bpf program dscp_policy to iface
* Add the provided DSCP policy to the bpf map. Attach bpf program dscpPolicy to iface
* if not already attached. Response will be sent back to nai with status.
*
* DSCP_POLICY_STATUS_SUCCESS - if policy was added successfully

View File

@@ -87,13 +87,13 @@ static const set<string> MAINLINE_FOR_T_PLUS = {
SHARED "map_block_blocked_ports_map",
SHARED "map_clatd_clat_egress4_map",
SHARED "map_clatd_clat_ingress6_map",
SHARED "map_dscp_policy_ipv4_dscp_policies_map",
SHARED "map_dscp_policy_ipv4_socket_to_policies_map_A",
SHARED "map_dscp_policy_ipv4_socket_to_policies_map_B",
SHARED "map_dscp_policy_ipv6_dscp_policies_map",
SHARED "map_dscp_policy_ipv6_socket_to_policies_map_A",
SHARED "map_dscp_policy_ipv6_socket_to_policies_map_B",
SHARED "map_dscp_policy_switch_comp_map",
SHARED "map_dscpPolicy_ipv4_dscp_policies_map",
SHARED "map_dscpPolicy_ipv4_socket_to_policies_map_A",
SHARED "map_dscpPolicy_ipv4_socket_to_policies_map_B",
SHARED "map_dscpPolicy_ipv6_dscp_policies_map",
SHARED "map_dscpPolicy_ipv6_socket_to_policies_map_A",
SHARED "map_dscpPolicy_ipv6_socket_to_policies_map_B",
SHARED "map_dscpPolicy_switch_comp_map",
NETD "map_netd_app_uid_stats_map",
NETD "map_netd_configuration_map",
NETD "map_netd_cookie_tag_map",
@@ -126,8 +126,8 @@ static const set<string> MAINLINE_FOR_T_5_4_PLUS = {
// Provided by *current* mainline module for T+ devices with 5.15+ kernels
static const set<string> MAINLINE_FOR_T_5_15_PLUS = {
SHARED "prog_dscp_policy_schedcls_set_dscp_ether",
SHARED "prog_dscp_policy_schedcls_set_dscp_raw_ip",
SHARED "prog_dscpPolicy_schedcls_set_dscp_ether",
SHARED "prog_dscpPolicy_schedcls_set_dscp_raw_ip",
};
void addAll(set<string>* a, const set<string>& b) {