From 98975122a4e27194a031a85d909d9e9f7521d0ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Tue, 14 Jan 2025 14:57:24 -0800 Subject: [PATCH] NetBpfLoad: rename isAtLeastW to isAtLeast25Q2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test: TreeHugger Signed-off-by: Maciej Żenczykowski Change-Id: I485e24663b924bbac97faa6f06156587c8968b81 --- bpf/headers/include/bpf_helpers.h | 4 ++-- bpf/loader/NetBpfLoad.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bpf/headers/include/bpf_helpers.h b/bpf/headers/include/bpf_helpers.h index b994a9f28f..0bd3421d19 100644 --- a/bpf/headers/include/bpf_helpers.h +++ b/bpf/headers/include/bpf_helpers.h @@ -62,8 +62,8 @@ // Android Mainline BpfLoader when running on Android V (sdk=35) #define BPFLOADER_MAINLINE_V_VERSION (BPFLOADER_MAINLINE_U_QPR3_VERSION + 1u) -// Android Mainline BpfLoader when running on Android W (sdk=36) -#define BPFLOADER_MAINLINE_W_VERSION (BPFLOADER_MAINLINE_V_VERSION + 1u) +// Android Mainline BpfLoader when running on Android 25Q2 (sdk=36) +#define BPFLOADER_MAINLINE_25Q2_VERSION (BPFLOADER_MAINLINE_V_VERSION + 1u) /* For mainline module use, you can #define BPFLOADER_{MIN/MAX}_VER * before #include "bpf_helpers.h" to change which bpfloaders will diff --git a/bpf/loader/NetBpfLoad.cpp b/bpf/loader/NetBpfLoad.cpp index 39bf1f7742..3dabd909e1 100644 --- a/bpf/loader/NetBpfLoad.cpp +++ b/bpf/loader/NetBpfLoad.cpp @@ -1417,7 +1417,7 @@ static int doLoad(char** argv, char * const envp[]) { const bool isAtLeastT = (effective_api_level >= __ANDROID_API_T__); const bool isAtLeastU = (effective_api_level >= __ANDROID_API_U__); const bool isAtLeastV = (effective_api_level >= __ANDROID_API_V__); - const bool isAtLeastW = (effective_api_level > __ANDROID_API_V__); // TODO: switch to W + const bool isAtLeast25Q2 = (effective_api_level > __ANDROID_API_V__); // TODO: fix > const int first_api_level = GetIntProperty("ro.board.first_api_level", effective_api_level); @@ -1432,7 +1432,7 @@ static int doLoad(char** argv, char * const envp[]) { if (isAtLeastU) ++bpfloader_ver; // [44] BPFLOADER_MAINLINE_U_VERSION if (runningAsRoot) ++bpfloader_ver; // [45] BPFLOADER_MAINLINE_U_QPR3_VERSION if (isAtLeastV) ++bpfloader_ver; // [46] BPFLOADER_MAINLINE_V_VERSION - if (isAtLeastW) ++bpfloader_ver; // [47] BPFLOADER_MAINLINE_W_VERSION + if (isAtLeast25Q2) ++bpfloader_ver; // [47] BPFLOADER_MAINLINE_25Q2_VERSION ALOGI("NetBpfLoad v0.%u (%s) api:%d/%d kver:%07x (%s) uid:%d rc:%d%d", bpfloader_ver, argv[0], android_get_device_api_level(), effective_api_level, @@ -1477,8 +1477,8 @@ static int doLoad(char** argv, char * const envp[]) { // W bumps the kernel requirement up to 5.4 // see also: //system/netd/tests/kernel_test.cpp TestKernel54 - if (isAtLeastW && !isAtLeastKernelVersion(5, 4, 0)) { - ALOGE("Android W requires kernel 5.4."); + if (isAtLeast25Q2 && !isAtLeastKernelVersion(5, 4, 0)) { + ALOGE("Android 25Q2 requires kernel 5.4."); return 1; }