Skip to content
Snippets Groups Projects
Commit 03ef12cc authored by Maciej Żenczykowski's avatar Maciej Żenczykowski
Browse files

netbpfload: enable on U QPR2 (aka 24Q1)


(this will land in M-2024-05 ie. May mainline tethering module)

Test: TreeHugger
Signed-off-by: default avatarMaciej Żenczykowski <maze@google.com>
Change-Id: I250b691eb03751da05ce10d41d6721f4964dd1d5
parent 2fe0abc9
No related branches found
No related tags found
No related merge requests found
......@@ -44,7 +44,7 @@ cc_binary {
"com.android.tethering",
"//apex_available:platform",
],
// really should be Android 14/U (34), but we cannot include binaries built
// really should be Android 13/T (33), but we cannot include binaries built
// against newer sdk in the apex, which still targets 30(R):
// module "netbpfload" variant "android_x86_apex30": should support
// min_sdk_version(30) for "com.android.tethering": newer SDK(34).
......@@ -54,15 +54,14 @@ cc_binary {
required: ["bpfloader"],
}
// Versioned netbpfload init rc: init system will process it only on api V/35+ devices
// (TODO: consider reducing to T/33+ - adjust the comment up above in line 43 as well)
// Note: S[31] Sv2[32] T[33] U[34] V[35])
// Versioned netbpfload init rc: init system will process it only on api T/33+ devices
// Note: R[30] S[31] Sv2[32] T[33] U[34] V[35])
//
// For details of versioned rc files see:
// https://android.googlesource.com/platform/system/core/+/HEAD/init/README.md#versioned-rc-files-within-apexs
prebuilt_etc {
name: "netbpfload.mainline.rc",
src: "netbpfload.mainline.rc",
filename: "netbpfload.35rc",
filename: "netbpfload.33rc",
installable: false,
}
......@@ -243,9 +243,15 @@ int main(int argc, char** argv, char * const envp[]) {
const bool isAtLeastU = (device_api_level >= __ANDROID_API_U__);
const bool isAtLeastV = (device_api_level >= __ANDROID_API_V__);
ALOGI("NetBpfLoad api:%d/%d kver:%07x platform:%d mainline:%d",
// last in U QPR2 beta1
const bool has_platform_bpfloader_rc = exists("/system/etc/init/bpfloader.rc");
// first in U QPR2 beta~2
const bool has_platform_netbpfload_rc = exists("/system/etc/init/netbpfload.rc");
ALOGI("NetBpfLoad api:%d/%d kver:%07x platform:%d mainline:%d rc:%d%d",
android_get_application_target_sdk_version(), device_api_level,
android::bpf::kernelVersion(), is_platform, is_mainline);
android::bpf::kernelVersion(), is_platform, is_mainline,
has_platform_bpfloader_rc, has_platform_netbpfload_rc);
if (!is_platform && !is_mainline) {
ALOGE("Unable to determine if we're platform or mainline netbpfload.");
......@@ -258,8 +264,28 @@ int main(int argc, char** argv, char * const envp[]) {
ALOGW("exec '%s' fail: %d[%s]", apexNetBpfLoad, errno, strerror(errno));
}
if (!has_platform_bpfloader_rc && !has_platform_netbpfload_rc) {
ALOGE("Unable to find platform's bpfloader & netbpfload init scripts.");
return 1;
}
if (has_platform_bpfloader_rc && has_platform_netbpfload_rc) {
ALOGE("Platform has *both* bpfloader & netbpfload init scripts.");
return 1;
}
logTetheringApexVersion();
if (is_mainline && has_platform_bpfloader_rc && !has_platform_netbpfload_rc) {
// Tethering apex shipped initrc file causes us to reach here
// but we're not ready to correctly handle anything before U QPR2
// in which the 'bpfloader' vs 'netbpfload' split happened
const char * args[] = { platformBpfLoader, NULL, };
execve(args[0], (char**)args, envp);
ALOGE("exec '%s' fail: %d[%s]", platformBpfLoader, errno, strerror(errno));
return 1;
}
if (isAtLeastT && !android::bpf::isAtLeastKernelVersion(4, 9, 0)) {
ALOGE("Android T requires kernel 4.9.");
return 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment