android_packages_modules_Co.../Android.bp
Hungming Chen f752bb4bb7 [RFCLAT#16] remove drop_root_and_caps
gid and uid of clatd binary has been set by apex
canned_fs_config. don't need drop_root_and_caps()
anymore.

Bug: 212345928
Test: manual test
1. Connect to ipv6-only wifi.
2. Make IPv4 traffic.
   $ ping 8.8.8.8

Check uid and uid is AID_CLAT(1029) in process status:
$ adb shell ps | grep clat
clat          9743   740 10826108  2264 0              0 S clatd-wlan0
$ adb shell cat /proc/9743/status | egrep -i '^(Uid|Gid|Groups):|^Cap'
Uid:	0	1029	1029	1029
Gid:	0	1029	1029	1029
Groups:	3005
CapInh:	00000000000074ef
CapPrm:	00000000000074ef
CapEff:	0000000000000000
CapBnd:	00000000000074ef
CapAmb:	0000000000000000

Change-Id: I8f7a9c50368d5c789621ea39b39d9242adfb0fcc
2022-01-14 18:32:06 +08:00

120 lines
2.6 KiB
Text

package {
default_applicable_licenses: ["external_android-clat_license"],
}
// Added automatically by a large-scale-change
//
// large-scale-change included anything that looked like it might be a license
// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
//
// Please consider removing redundant or irrelevant files from 'license_text:'.
// See: http://go/android-license-faq
license {
name: "external_android-clat_license",
visibility: [":__subpackages__"],
license_kinds: [
"SPDX-license-identifier-Apache-2.0",
],
license_text: [
"LICENSE",
"NOTICE",
],
}
cc_defaults {
name: "clatd_defaults",
cflags: [
"-Wall",
"-Werror",
"-Wunused-parameter",
// Bug: http://b/33566695
"-Wno-address-of-packed-member",
],
}
// Code used both by the daemon and by unit tests.
filegroup {
name: "clatd_common",
srcs: [
"clatd.c",
"dump.c",
"getaddr.c",
"icmp.c",
"ipv4.c",
"ipv6.c",
"logging.c",
"translate.c",
],
}
// The clat daemon.
cc_binary {
name: "clatd",
defaults: ["clatd_defaults"],
srcs: [
":clatd_common",
"main.c"
],
static_libs: [
"libip_checksum",
],
shared_libs: [
"liblog",
],
relative_install_path: "for-system",
// Static libc++ for smaller apex size while shipping clatd in the mainline module.
// See b/213123047
stl: "libc++_static",
// Only enable clang-tidy for the daemon, not the tests, because enabling it for the
// tests substantially increases build/compile cycle times and doesn't really provide a
// security benefit.
tidy: true,
tidy_checks: [
"-*",
"cert-*",
"clang-analyzer-security*",
"android-*",
],
tidy_flags: [
"-warnings-as-errors=clang-analyzer-security*,cert-*,android-*",
],
// Actually not required for clatd itself. See comments in the rc file.
init_rc: [
"vendor-464xlat.rc",
],
sanitize: {
memtag_heap: true,
},
apex_available: [
"com.android.tethering",
"//apex_available:platform",
],
min_sdk_version: "30",
}
// Unit tests.
cc_test {
name: "clatd_test",
defaults: ["clatd_defaults"],
srcs: [
":clatd_common",
"clatd_test.cpp"
],
static_libs: [
"libbase",
"libip_checksum",
"libnetd_test_tun_interface",
],
shared_libs: [
"libcutils",
"liblog",
"libnetutils",
],
test_suites: ["device-tests"],
require_root: true,
}