Merge "bpf clatd.c - per RFC 6145 simply use bottom 16 bits of IPv6 frag id."
diff --git a/bpf_progs/netd.c b/bpf_progs/netd.c
index f9484fc..b9df534 100644
--- a/bpf_progs/netd.c
+++ b/bpf_progs/netd.c
@@ -198,6 +198,7 @@
}
static __always_inline inline bool skip_owner_match(struct __sk_buff* skb, bool is_4_19) {
+ uint32_t flag = 0;
if (skb->protocol == htons(ETH_P_IP)) {
uint8_t proto;
// no need to check for success, proto will be zeroed if bpf_skb_load_bytes_net() fails
@@ -211,24 +212,22 @@
// field will also fail, and that failure we already handle correctly
// (we also don't check that ihl in [0x45,0x4F] nor that ipv4 header checksum is correct)
(void)bpf_skb_load_bytes_net(skb, IPPROTO_IHL_OFF, &ihl, sizeof(ihl), is_4_19);
- uint32_t flag;
// if the read below fails, we'll just assume no TCP flags are set, which is fine.
(void)bpf_skb_load_bytes_net(skb, (ihl & 0xF) * 4 + TCP_FLAG32_OFF,
&flag, sizeof(flag), is_4_19);
- return flag & TCP_FLAG_RST; // false on read failure
} else if (skb->protocol == htons(ETH_P_IPV6)) {
uint8_t proto;
// no need to check for success, proto will be zeroed if bpf_skb_load_bytes_net() fails
(void)bpf_skb_load_bytes_net(skb, IPV6_PROTO_OFF, &proto, sizeof(proto), is_4_19);
if (proto == IPPROTO_ESP) return true;
if (proto != IPPROTO_TCP) return false; // handles read failure above
- uint32_t flag;
// if the read below fails, we'll just assume no TCP flags are set, which is fine.
(void)bpf_skb_load_bytes_net(skb, sizeof(struct ipv6hdr) + TCP_FLAG32_OFF,
&flag, sizeof(flag), is_4_19);
- return flag & TCP_FLAG_RST; // false on read failure
+ } else {
+ return false;
}
- return false;
+ return flag & TCP_FLAG_RST; // false on read failure
}
static __always_inline inline BpfConfig getConfig(uint32_t configKey) {
diff --git a/tools/gn2bp/Android.bp.swp b/tools/gn2bp/Android.bp.swp
index 8ea9633..4687c4a 100644
--- a/tools/gn2bp/Android.bp.swp
+++ b/tools/gn2bp/Android.bp.swp
@@ -202,6 +202,7 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -257,6 +258,7 @@
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE64_SOURCE",
"-D_LARGEFILE_SOURCE",
+ "-UANDROID",
],
},
},
@@ -918,6 +920,7 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -931,6 +934,7 @@
],
header_libs: [
"jni_headers",
+ "media_ndk_headers",
],
cpp_std: "c++20",
target: {
@@ -1138,6 +1142,7 @@
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE64_SOURCE",
"-D_LARGEFILE_SOURCE",
+ "-UANDROID",
],
},
},
@@ -1437,6 +1442,7 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -1469,6 +1475,7 @@
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE64_SOURCE",
"-D_LARGEFILE_SOURCE",
+ "-UANDROID",
],
},
},
@@ -1782,6 +1789,7 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -1814,6 +1822,7 @@
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE64_SOURCE",
"-D_LARGEFILE_SOURCE",
+ "-UANDROID",
],
},
},
@@ -1840,6 +1849,7 @@
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -1872,6 +1882,7 @@
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE64_SOURCE",
"-D_LARGEFILE_SOURCE",
+ "-UANDROID",
],
},
},
@@ -1908,6 +1919,7 @@
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -1916,6 +1928,13 @@
"buildtools/third_party/libc++abi/trunk/include",
],
cpp_std: "c++20",
+ target: {
+ host: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //base/third_party/xdg_mime:xdg_mime
@@ -1954,6 +1973,7 @@
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -1962,6 +1982,13 @@
"buildtools/third_party/libc++abi/trunk/include",
],
cpp_std: "c++20",
+ target: {
+ host: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //base/third_party/xdg_user_dirs:xdg_user_dirs
@@ -1995,6 +2022,7 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -2003,6 +2031,13 @@
"buildtools/third_party/libc++abi/trunk/include",
],
cpp_std: "c++20",
+ target: {
+ host: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //base:tracing_buildflags
@@ -2493,6 +2528,18 @@
"-fexceptions",
],
rtti: true,
+ target: {
+ android_x86: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ android_x86_64: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //components/cronet/android:cronet_jni_headers
@@ -3214,6 +3261,18 @@
"jni_headers",
],
cpp_std: "c++20",
+ target: {
+ android_x86: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ android_x86_64: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //crypto:buildflags
@@ -3300,6 +3359,7 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -3349,6 +3409,7 @@
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE64_SOURCE",
"-D_LARGEFILE_SOURCE",
+ "-UANDROID",
],
local_include_dirs: [
"build/linux/debian_bullseye_amd64-sysroot/usr/include/nspr",
@@ -3377,24 +3438,6 @@
"-fvisibility=hidden",
],
stl: "none",
- target: {
- android_x86: {
- export_system_include_dirs: [
- "build/linux/debian_bullseye_i386-sysroot/usr/include",
- ],
- },
- android_x86_64: {
- export_system_include_dirs: [
- "build/linux/debian_bullseye_amd64-sysroot/usr/include",
- "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
- ],
- },
- host: {
- export_system_include_dirs: [
- "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
- ],
- },
- },
}
// GN: //ipc:param_traits
@@ -4699,11 +4742,17 @@
srcs: [
"net/disk_cache/blockfile/mapped_file_posix.cc",
],
+ cflags: [
+ "-UANDROID",
+ ],
},
android_x86_64: {
srcs: [
"net/disk_cache/blockfile/mapped_file_bypass_mmap_posix.cc",
],
+ cflags: [
+ "-UANDROID",
+ ],
},
},
}
@@ -4994,6 +5043,18 @@
"third_party/boringssl/src/include/",
],
cpp_std: "c++20",
+ target: {
+ android_x86: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ android_x86_64: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //net/third_party/quiche:net_quic_proto
@@ -5539,6 +5600,18 @@
"third_party/zlib/",
],
cpp_std: "c++20",
+ target: {
+ android_x86: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ android_x86_64: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //net/traffic_annotation:traffic_annotation
@@ -5634,6 +5707,18 @@
"third_party/boringssl/src/include/",
],
cpp_std: "c++20",
+ target: {
+ android_x86: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ android_x86_64: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //third_party/abseil-cpp:absl
@@ -7483,6 +7568,7 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -7516,6 +7602,7 @@
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE64_SOURCE",
"-D_LARGEFILE_SOURCE",
+ "-UANDROID",
],
},
},
@@ -7638,6 +7725,18 @@
"third_party/brotli/include/",
],
cpp_std: "c++20",
+ target: {
+ android_x86: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ android_x86_64: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //third_party/brotli:dec
@@ -7681,6 +7780,18 @@
"third_party/brotli/include/",
],
cpp_std: "c++20",
+ target: {
+ android_x86: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ android_x86_64: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //third_party/brotli:headers
@@ -7963,6 +8074,7 @@
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -7998,6 +8110,7 @@
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE64_SOURCE",
"-D_LARGEFILE_SOURCE",
+ "-UANDROID",
],
},
},
@@ -8238,6 +8351,7 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -8273,6 +8387,7 @@
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE64_SOURCE",
"-D_LARGEFILE_SOURCE",
+ "-UANDROID",
],
},
},
@@ -8318,6 +8433,7 @@
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -8356,6 +8472,7 @@
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE64_SOURCE",
"-D_LARGEFILE_SOURCE",
+ "-UANDROID",
],
local_include_dirs: [
"third_party/libevent/linux/",
@@ -8526,6 +8643,7 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -8558,6 +8676,7 @@
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE64_SOURCE",
"-D_LARGEFILE_SOURCE",
+ "-UANDROID",
],
},
},
@@ -8683,6 +8802,7 @@
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -8693,6 +8813,13 @@
"third_party/zlib/",
],
cpp_std: "c++20",
+ target: {
+ host: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //third_party/protobuf:protobuf_lite
@@ -8765,6 +8892,18 @@
"third_party/protobuf/src/",
],
cpp_std: "c++20",
+ target: {
+ android_x86: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ android_x86_64: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //third_party/protobuf:protoc
@@ -8813,6 +8952,7 @@
"-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
"-D_LIBCPP_OVERRIDABLE_FUNC_VIS=__attribute__((__visibility__(\"default\")))",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -8827,6 +8967,13 @@
"-fexceptions",
],
rtti: true,
+ target: {
+ host: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //third_party/protobuf:protoc_lib
@@ -8950,6 +9097,7 @@
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -8959,6 +9107,13 @@
"third_party/protobuf/src/",
],
cpp_std: "c++20",
+ target: {
+ host: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //third_party/zlib:zlib
@@ -9011,6 +9166,7 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-UANDROID",
"-mpclmul",
"-mssse3",
],
@@ -9054,6 +9210,7 @@
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE64_SOURCE",
"-D_LARGEFILE_SOURCE",
+ "-UANDROID",
],
},
},
@@ -9252,6 +9409,18 @@
"jni_headers",
],
cpp_std: "c++20",
+ target: {
+ android_x86: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ android_x86_64: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //url:url_jni_headers
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index 3ec96f7..cf8a4fd 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -131,6 +131,9 @@
# that doesn't depend on rtti. undefined symbol: typeinfo 'class' errors appears.
('rtti', True), # go/undefined-symbol-typeinfo
],
+ 'cronet_aml_base_base': [
+ ('header_libs', {"media_ndk_headers"}),
+ ],
}
# Android equivalents for third-party libraries that the upstream project
@@ -960,8 +963,8 @@
# So adding -UANDROID to cancel default -DANDROID if it's not specified.
# This is needed for some targets(e.g. symbolize)
# TODO: Set -UANDROID considering common define
- # if "ANDROID" not in defines:
- # cflags.add("-UANDROID")
+ if "ANDROID" not in defines:
+ cflags.add("-UANDROID")
return cflags
def set_module_flags(module, cflags, defines):
@@ -1219,19 +1222,6 @@
'-Wno-unreachable-code-loop-increment', # needed for icui18n
'-O2',
]
- # TODO: can we get these from somewhere else?
- # TODO: what to do for arm?
- defaults.target['android_x86'].export_system_include_dirs = [
- 'build/linux/debian_bullseye_i386-sysroot/usr/include',
- ]
- defaults.target['android_x86_64'].export_system_include_dirs = [
- 'build/linux/debian_bullseye_amd64-sysroot/usr/include',
- 'build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu',
- ]
- defaults.target['host'].export_system_include_dirs = [
- # TODO: do we need this?
- 'third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include',
- ]
defaults.stl = 'none'
blueprint.add_module(defaults)