Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_packages_modules_Connectivity
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LMODroid
platform_packages_modules_Connectivity
Commits
f54f4241
Commit
f54f4241
authored
1 year ago
by
Maciej Żenczykowski
Committed by
Gerrit Code Review
1 year ago
Browse files
Options
Downloads
Plain Diff
Merge "netbpfload: use apex version whenever available" into main
parents
141f7bbf
2fe2db52
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
netbpfload/NetBpfLoad.cpp
+15
-7
15 additions, 7 deletions
netbpfload/NetBpfLoad.cpp
with
15 additions
and
7 deletions
netbpfload/NetBpfLoad.cpp
+
15
−
7
View file @
f54f4241
...
...
@@ -169,6 +169,10 @@ int writeProcSysFile(const char *filename, const char *value) {
return
0
;
}
const
char
*
const
platformBpfLoader
=
"/system/bin/bpfloader"
;
const
char
*
const
platformNetBpfLoad
=
"/system/bin/netbpfload"
;
const
char
*
const
apexNetBpfLoad
=
"/apex/com.android.tethering/bin/netbpfload"
;
int
main
(
int
argc
,
char
**
argv
,
char
*
const
envp
[])
{
(
void
)
argc
;
android
::
base
::
InitLogging
(
argv
,
&
android
::
base
::
KernelLogger
);
...
...
@@ -176,10 +180,10 @@ int main(int argc, char** argv, char * const envp[]) {
ALOGI
(
"NetBpfLoad '%s' starting..."
,
argv
[
0
]);
// true iff we are running from the module
const
bool
is_mainline
=
!
strcmp
(
argv
[
0
],
"/
apex
/com.android.tethering/bin/n
et
b
pf
l
oad
"
);
const
bool
is_mainline
=
!
strcmp
(
argv
[
0
],
apex
N
et
B
pf
L
oad
);
// true iff we are running from the platform
const
bool
is_platform
=
!
strcmp
(
argv
[
0
],
"/system/bin/n
et
b
pf
l
oad
"
);
const
bool
is_platform
=
!
strcmp
(
argv
[
0
],
platformN
et
B
pf
L
oad
);
const
int
device_api_level
=
android_get_device_api_level
();
const
bool
isAtLeastT
=
(
device_api_level
>=
__ANDROID_API_T__
);
...
...
@@ -195,6 +199,12 @@ int main(int argc, char** argv, char * const envp[]) {
return
1
;
}
if
(
is_platform
)
{
const
char
*
args
[]
=
{
apexNetBpfLoad
,
NULL
,
};
execve
(
args
[
0
],
(
char
**
)
args
,
envp
);
ALOGW
(
"exec '%s' fail: %d[%s]"
,
apexNetBpfLoad
,
errno
,
strerror
(
errno
));
}
if
(
isAtLeastT
&&
!
android
::
bpf
::
isAtLeastKernelVersion
(
4
,
9
,
0
))
{
ALOGE
(
"Android T requires kernel 4.9."
);
return
1
;
...
...
@@ -295,10 +305,8 @@ int main(int argc, char** argv, char * const envp[]) {
ALOGI
(
"done, transferring control to platform bpfloader."
);
const
char
*
args
[]
=
{
"/system/bin/bpfloader"
,
NULL
,
};
if
(
execve
(
args
[
0
],
(
char
**
)
args
,
envp
))
{
ALOGE
(
"FATAL: execve('/system/bin/bpfloader'): %d[%s]"
,
errno
,
strerror
(
errno
));
}
const
char
*
args
[]
=
{
platformBpfLoader
,
NULL
,
};
execve
(
args
[
0
],
(
char
**
)
args
,
envp
);
ALOGE
(
"FATAL: execve('%s'): %d[%s]"
,
platformBpfLoader
,
errno
,
strerror
(
errno
));
return
1
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment