Skip to content
Snippets Groups Projects
Commit e36d77c3 authored by Maciej Żenczykowski's avatar Maciej Żenczykowski Committed by Gerrit Code Review
Browse files

Revert "24Q2: use mainline netbpfload from apex"

This reverts commit 13b5e1ff.

Reason for revert: wasn't sent for review

Change-Id: Ibbf514e0ce506e2720f3d98f12beab7c4d14e133
parent 13b5e1ff
No related branches found
No related tags found
No related merge requests found
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
on load_bpf_programs on load_bpf_programs
exec_start bpfloader exec_start bpfloader
service bpfloader /apex/com.android.tethering/bin/netbpfload service bpfloader /system/bin/netbpfload
# netbpfload will do network bpf loading, then execute /system/bin/bpfloader # netbpfload will do network bpf loading, then execute /system/bin/bpfloader
capabilities CHOWN SYS_ADMIN NET_ADMIN capabilities CHOWN SYS_ADMIN NET_ADMIN
# The following group memberships are a workaround for lack of DAC_OVERRIDE # The following group memberships are a workaround for lack of DAC_OVERRIDE
......
...@@ -72,17 +72,6 @@ public class BpfLoaderRcUtils { ...@@ -72,17 +72,6 @@ public class BpfLoaderRcUtils {
"updatable" "updatable"
); );
private static final List<String> BPF_LOADER_RC_UQPR3 = List.of(
"service bpfloader /apex/com.android.tethering/bin/netbpfload",
"capabilities CHOWN SYS_ADMIN NET_ADMIN",
"group root graphics network_stack net_admin net_bw_acct net_bw_stats net_raw system",
"user root",
"rlimit memlock 1073741824 1073741824",
"oneshot",
"reboot_on_failure reboot,bpfloader-failed",
"updatable"
);
private static final String BPF_LOADER_RC_FILE_PATH = "/etc/init/bpfloader.rc"; private static final String BPF_LOADER_RC_FILE_PATH = "/etc/init/bpfloader.rc";
private static final String NET_BPF_LOAD_RC_FILE_PATH = "/etc/init/netbpfload.rc"; private static final String NET_BPF_LOAD_RC_FILE_PATH = "/etc/init/netbpfload.rc";
...@@ -143,31 +132,30 @@ public class BpfLoaderRcUtils { ...@@ -143,31 +132,30 @@ public class BpfLoaderRcUtils {
+ " exist."); + " exist.");
return false; return false;
} }
// Check bpf rc file in U QPR2 and U QPR3 // Check bpf rc file in U QPR2
return compareBpfLoaderRc(bpfRcFile, List.of(BPF_LOADER_RC_UQPR2, BPF_LOADER_RC_UQPR3)); return compareBpfLoaderRc(bpfRcFile, BPF_LOADER_RC_UQPR2);
} }
if (SdkLevel.isAtLeastU()) { if (SdkLevel.isAtLeastU()) {
// Check bpf rc file in U // Check bpf rc file in U
return compareBpfLoaderRc(bpfRcFile, List.of(BPF_LOADER_RC_U)); return compareBpfLoaderRc(bpfRcFile, BPF_LOADER_RC_U);
} }
// Check bpf rc file in S/T // Check bpf rc file in S/T
return compareBpfLoaderRc(bpfRcFile, List.of(BPF_LOADER_RC_S_T)); return compareBpfLoaderRc(bpfRcFile, BPF_LOADER_RC_S_T);
} }
private static boolean compareBpfLoaderRc(@NonNull File bpfRcFile, private static boolean compareBpfLoaderRc(@NonNull File bpfRcFile,
@NonNull List<List<String>> templates) { @NonNull List<String> template) {
List<String> actualContent;
try { try {
actualContent = loadExistingBpfRcFile(new FileInputStream(bpfRcFile)); List<String> actualContent = loadExistingBpfRcFile(new FileInputStream(bpfRcFile));
if (!actualContent.equals(template)) {
Log.wtf(TAG, "BPF rc file is not same as the template files " + actualContent);
return false;
}
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
Log.wtf(bpfRcFile.getPath() + " doesn't exist.", e); Log.wtf(bpfRcFile.getPath() + " doesn't exist.", e);
return false; return false;
} }
for (List<String> template : templates) { return true;
if (actualContent.equals(template)) return true;
}
Log.wtf(TAG, "BPF rc file is not same as the template files " + actualContent);
return false;
} }
} }
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