1//
2// Copyright (C) 2020 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17//
18// struct definitions shared with JNI
19//
20package {
21    default_team: "trendy_team_fwk_core_networking",
22    default_applicable_licenses: ["Android-Apache-2.0"],
23}
24
25cc_library_headers {
26    name: "bpf_connectivity_headers",
27    vendor_available: false,
28    host_supported: false,
29    header_libs: [
30        "bpf_headers",
31        "netd_mainline_headers",
32    ],
33    export_header_lib_headers: [
34        "bpf_headers",
35        "netd_mainline_headers",
36    ],
37    export_include_dirs: ["."],
38    cflags: [
39        "-Wall",
40        "-Werror",
41        "-Wextra",
42    ],
43    sdk_version: "30",
44    min_sdk_version: "30",
45    apex_available: [
46        "//apex_available:platform",
47        "com.android.tethering",
48    ],
49    visibility: [
50        "//packages/modules/Connectivity/bpf/dns_helper",
51        "//packages/modules/Connectivity/bpf/netd",
52        "//packages/modules/Connectivity/service",
53        "//packages/modules/Connectivity/service/native/libs/libclat",
54        "//packages/modules/Connectivity/Tethering",
55        "//packages/modules/Connectivity/service/native",
56        "//packages/modules/Connectivity/tests/native/connectivity_native_test",
57        "//packages/modules/Connectivity/tests/native/utilities",
58        "//packages/modules/Connectivity/service-t/native/libs/libnetworkstats",
59        "//packages/modules/Connectivity/tests/unit/jni",
60    ],
61}
62
63//
64// bpf kernel programs
65//
66bpf {
67    name: "dscpPolicy.o",
68    srcs: ["dscpPolicy.c"],
69    sub_dir: "net_shared",
70}
71
72// Ships to Android S, the bpfloader of which fails to parse BTF enabled .o's.
73bpf {
74    name: "offload.o",
75    srcs: ["offload.c"],
76    btf: false,
77}
78
79// This version ships to Android T+ which uses mainline netbpfload.
80bpf {
81    name: "[email protected]",
82    srcs: ["[email protected]"],
83    cflags: ["-DMAINLINE"],
84}
85
86// Ships to Android S, the bpfloader of which fails to parse BTF enabled .o's.
87bpf {
88    name: "test.o",
89    srcs: ["test.c"],
90    btf: false,
91}
92
93// This version ships to Android T+ which uses mainline netbpfload.
94bpf {
95    name: "[email protected]",
96    srcs: ["[email protected]"],
97    cflags: ["-DMAINLINE"],
98}
99
100bpf {
101    name: "clatd.o",
102    srcs: ["clatd.c"],
103    sub_dir: "net_shared",
104}
105
106bpf {
107    // WARNING: Android T's non-updatable netd depends on 'netd' string for xt_bpf programs it loads
108    name: "netd.o",
109    srcs: ["netd.c"],
110    // WARNING: Android T's non-updatable netd depends on 'netd_shared' string for xt_bpf programs
111    sub_dir: "netd_shared",
112}
113