-----BEGIN PGP SIGNATURE-----
iF0EABECAB0WIQRDQNE1cO+UXoOBCWTorT+BmrEOeAUCaS5huQAKCRDorT+BmrEO
eIsnAJ9kJ9OjiHpwigt9XwjTrGcbD1hQ0QCfSw2VHyS9TLyzt7DZsQ3AYU+WVVA=
=/SH/
-----END PGP SIGNATURE-----
gpgsig -----BEGIN SSH SIGNATURE-----
U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgPpdpjxPACTIhnlvYz0GM4BR7FJ
+rYv3jMbfxNKD3JvcAAAADZ2l0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5
AAAAQHUBff/oLA1TO7KbbZDsBJZmFVcXgFmG+2K3aaKq9F0tiaT1kiNeHdjXpaLI07p344
TExz9CBvFVft81pJyRBwY=
-----END SSH SIGNATURE-----
Merge tag 'android-16.0.0_r4' into staging/lineage-23.2_merge-android-16.0.0_r4
Android 16.0.0 release 4
# -----BEGIN PGP SIGNATURE-----
#
# iF0EABECAB0WIQRDQNE1cO+UXoOBCWTorT+BmrEOeAUCaS5huQAKCRDorT+BmrEO
# eIsnAJ9kJ9OjiHpwigt9XwjTrGcbD1hQ0QCfSw2VHyS9TLyzt7DZsQ3AYU+WVVA=
# =/SH/
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue Dec 2 05:49:13 2025 EET
# gpg: using DSA key 4340D13570EF945E83810964E8AD3F819AB10E78
# gpg: Good signature from "The Android Open Source Project <initial-contribution@android.com>" [ultimate]
# By Yan Yan (203) and others
# Via Automerger Merge Worker (1173) and others
* tag 'android-16.0.0_r4': (1057 commits)
Use string for CREATE_APP_SPECIFIC_NETWORK permission
bpf: move MSS calculation under CE check to avoid overhead
BpfNetworkStats: use `atomic` for ifindex cache when possible
NetBpfLoad: remove pointless 0 write.
bpf: remove obsolete isAtLeastR/Sv2/25Q3
NetBpfLoad: use global `api_level_full` directly in NetBpfLoad
Log validated underlying network count that's available for VCN underlying network selection
BpfUtils: fix sdk level detection logic for 25Q3+
Add RTMGRP_IPV6_IFINFO
bpf: remove BPFLOADER_MAINLINE_U_QPR3_VERSION
bpf: move BPFLOADER_MAINLINE_S_VERSION into bpf_map_def.h
Reduce log level for BluetoothSocket errors
Bump the min sdk of Tethering
BpfNetworkStats: apparently RiscV isn't actually a 64-bit architecture.
KernelUtils.h: isAtLeastKernelVersion(x,y,z) - default 'z' to 0
bpf_existence_test - update for tcp acc ecn
bpf: tcpAccECN: eliminate header file and move more fully into netd
BpfMap: shorten error strings to enable SSO (on 64-bit)
BpfNetworkStats: enforce that IfaceValue access is lock-free
NetBpfLoad: use libbpf based on mainline beta flag, part 2
...
Conflicts:
bpf/headers/include/bpf/KernelUtils.h
bpf/progs/netd.h
Change-Id: I76a7aadc1405c6621e17f3d1b6b87640d84f5794
-----BEGIN PGP SIGNATURE-----
iF0EABECAB0WIQRDQNE1cO+UXoOBCWTorT+BmrEOeAUCaRO/HAAKCRDorT+BmrEO
eOs9AJ9Yzz2HpDR3pyRIXhvl4k7bNABGvgCeMg5sU16s0CkFIDbZmOsSo4fswZQ=
=1o5/
-----END PGP SIGNATURE-----
gpgsig -----BEGIN SSH SIGNATURE-----
U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgPpdpjxPACTIhnlvYz0GM4BR7FJ
+rYv3jMbfxNKD3JvcAAAADZ2l0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5
AAAAQIRFF5B6T8EGhzDN+1dhvomEkctFjdVr5DZnhgnEIvcCEuzO36RzY3DBG9AIL+EejJ
Z1zz7uAapzWUsyFpbYAQM=
-----END SSH SIGNATURE-----
Merge tag 'android-16.0.0_r3' into staging/lineage-23.0_merge-android-16.0.0_r3
Android 16.0.0 Release 3 (BP3A.250905.014)
# -----BEGIN PGP SIGNATURE-----
#
# iF0EABECAB0WIQRDQNE1cO+UXoOBCWTorT+BmrEOeAUCaRO/HAAKCRDorT+BmrEO
# eOs9AJ9Yzz2HpDR3pyRIXhvl4k7bNABGvgCeMg5sU16s0CkFIDbZmOsSo4fswZQ=
# =1o5/
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed Nov 12 00:56:28 2025 EET
# gpg: using DSA key 4340D13570EF945E83810964E8AD3F819AB10E78
# gpg: Good signature from "The Android Open Source Project <initial-contribution@android.com>" [ultimate]
# By Patrick Rohr (91) and others
# Via Android (Google) Code Review (233) and others
* tag 'android-16.0.0_r3': (377 commits)
Fix netbpfload version info.
NetBpfLoad: add self-check for bpfGetNext{Prog,Map}Id()
Add NetworkTemplate get/set transport type methods
Pass EthernetPort to EthernetNetworkFactory#updateInterfaceLinkState
Pass EthernetPort to updateInterfaceState
Remove spurious VisibleForTesting and change visibility to public
Pass EthernetPort to EthernetNetworkFactory#removeInterface
Pass EthernetPort to removeInterface
Pass EthernetPort to stopTrackingInterface
Add getEthernetPorts and use it in getAllInterfaces
Rename getClientModeInterfaces to getClientModeInterfacesSorted
Rename getAvailableInterfaces to getInterfacesSorted
Pass EthernetPort into NetworkInterfaceState
Pass EthernetPort into EthernetNetworkFactory#addInterface
Use multicast socket for group membership
Test refactoring of DefaultNetworkRematchMetrics
Fix SatisfiedTime initialization
DHCPv6 addr reg: parse IA Address option.
Pass EthernetPort to addInterface
Change tethering interface to EthernetPort
...
Conflicts:
bpf/progs/netd.c
service/src/com/android/server/ConnectivityService.java
staticlibs/testutils/host/python/apf_test_base.py
tests/cts/multidevices/apfv4_test.py
tests/cts/multidevices/apfv6_test.py
tests/cts/multidevices/run_tests.py
tests/unit/java/com/android/server/connectivityservice/CSNetworkAgentTest.kt
Change-Id: Ifedf92aee90cbcc55ef8f9652de8b5faff1c30d9
Currently, the MSS-based packet count calculation is performed for
every packet, regardless of whether the IP ECN field indicates CE
(congestion experienced). Since the computed value is only used
when CE is set, this results in unnecessary per-packet processing.
Move the MSS calculation inside the ip_ecn == 0b11 condition so
that it is only executed when a CE mark is actually present. This
reduces overhead on the fast path while preserving correct CE
accounting.
No functional change in CE handling, only an optimization in
execution flow.
Test: TreeHugger
Flag: EXEMPT PURE_REFACTOR
Signed-off-by: Sandeep <irlanki.s@samsung.corp-partner.google.com>
Change-Id: I5cae40f914473d9f914c826d50dd91c93e047ccc
Sandeepauthored and Maciej Żenczykowskicommited 2025-09-15 02:07:44 -07:00
We no longer support mainline on R,
hence checks for R are not required.
We don't want any S vs Sv2 and 25Q2 vs 25Q3 differentiation.
Test: TreeHugger
Flag: EXEMPT PURE_REFACTOR
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I746b404520ccb12fddf02c6956d7cf1824f21bbd
Maciej Żenczykowskicommited 2025-09-13 03:28:18 -07:00
This change removes the `bpfloader_ver` parameter from several internal functions and replaces its usage with the global `api_level_full` variable, simplifying function signatures.
Test: TreeHugger
Flag: EXEMPT PURE_REFACTOR
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I6165e525d7aa49fbd7d12be0c3ea85015cfc6f3d
Maciej Żenczykowskicommited 2025-09-13 01:57:50 -07:00
This is not used, and it seems unlikely we would ever
want to differentiate based on this.
Test: TreeHugger
Flag: EXEMPT PURE_REFACTOR
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I1ab48e0e4dc7a8979a34509ebc3d901a0bce3840
Maciej Żenczykowskicommited 2025-09-12 12:07:08 -07:00
also while at it renumber things so that in the future
we can autoderive the version from full api level.
Test: TreeHugger
Flag: EXEMPT PURE_REFACTOR
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie12638a3dcbde9db3e50d1736efa37154b22341c
Maciej Żenczykowskicommited 2025-09-12 12:06:45 -07:00
This seems to be the most common usecase.
Test: TreeHugger
Flag: EXEMPT PURE_REFACTOR
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I2de4d067b2f20680539cbddb31555864bcf957b1
Maciej Żenczykowskicommited 2025-09-12 10:14:12 -07:00
(also tested with a hack to make isAtLeast26Q2 true)
Test: TreeHugger
Flag: EXEMPT TEST_ONLY
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Id1ef5b03cdc27b6d74d6b5bd76692186809e9658
Maciej Żenczykowskicommited 2025-09-12 07:29:24 -07:00
This should be a performance improvement, as it avoids both memory
allocation (Short String Optimization fits the strings on the heap)
and string formatting.
Additionally should prevent us from triggering an abort()
on OOM as reported on the linked bug:
F DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0000000000000000 (read)
F DEBUG : Cause: null pointer dereference
F DEBUG : backtrace:
F DEBUG : #00 pc 0000000000000000 <unknown>
F DEBUG : #01 pc 000000000001d008 /apex/com.android.tethering/lib64/libbase.so (fmt::v11::vformat(fmt::v11::basic_string_view<char>, fmt::v11::basic_format_args<fmt::v11::context>)+76) (BuildId: d200bca0044b833c9a13a387041b398a)
F DEBUG : #02 pc 0000000000007108 /apex/com.android.tethering/lib64/libcom.android.tethering.dns_helper.so (android::bpf::BpfMapRO<unsigned int, UidOwnerValue>::readValue(unsigned int) const+152) (BuildId: b20b032f10bd31bb44f969cef38dcd99)
F DEBUG : #03 pc 0000000000006ac8 /apex/com.android.tethering/lib64/libcom.android.tethering.dns_helper.so (android::net::DnsBpfHelper::isUidNetworkingBlocked(unsigned int, bool)+748) (BuildId: b20b032f10bd31bb44f969cef38dcd99)
F DEBUG : #04 pc 0000000000008328 /apex/com.android.tethering/lib64/libcom.android.tethering.dns_helper.so (ADnsHelper_isUidNetworkingBlocked.cfi+60) (BuildId: b20b032f10bd31bb44f969cef38dcd99)
F DEBUG : #05 pc 00000000001c43b0 /apex/com.android.resolv/lib64/libnetd_resolv.so (android::net::DnsProxyListener::GetAddrInfoHandler::run()+284) (BuildId: 9f306d9e52c85087c00931289aa2d7cd)
F DEBUG : #06 pc 00000000001bc888 /apex/com.android.resolv/lib64/libnetd_resolv.so (void* android::netdutils::runAndDelete<android::net::DnsProxyListener::Handler>(void*) (.cfi)+332) (BuildId: 9f306d9e52c85087c00931289aa2d7cd)
F DEBUG : #07 pc 0000000000085580 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*) (.__uniq.67847048707805468364044055584648682506)+232) (BuildId: 9ea0fa19fb5cc316f79c79f922c5a7dc)
F DEBUG : #08 pc 0000000000078248 /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: 9ea0fa19fb5cc316f79c79f922c5a7dc)
Bug: 441416613
Test: TreeHugger
Flag: EXEMPT BUGFIX
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ibdae61b0ec67fd77f0be096ff934c8d424ae1e49
Maciej Żenczykowskicommited 2025-09-12 07:12:57 -07:00
Disable shared version of libtetheringflags
- since the flags are readonly there is no real content to this,
and it should be statically linked for compile/link time optimization
(which should basically optimize the entire library out)
Use C++ magic to compile time verify the macro and flag are in sync.
The way this works:
constexpr auto useLibBpf = COM_ANDROID_TETHERING_READONLY_FLAGS_USE_LIBBPF;
^ this basically requires the macro to resolve to true/false, so that 'auto' resolves to 'const bool'
static_assert(std::is_same<decltype(useLibBpf), const bool>::value, "useLibBpf must be a boolean.");
^ which we check here
static_assert(useLibBpf == com::android::tethering::readonly:🎏:use_libbpf(), "useLibBpf flag mismatch");
^ and this then requires the macro and flag to be identical *and* compile time known
Test: TreeHugger
Flag: EXEMPT PURE_REFACTOR
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Id5cd8c7d91b424765d6f469806434b3e9587f074
Maciej Żenczykowskicommited 2025-09-12 04:04:39 -07:00
They really don't add much to the picture.
The information is already in the exception.
Test: TreeHugger
Flag: EXEMPT mainline, logging
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I91b54814af20e02df11b8d035fa0ee1740cf644a
Maciej Żenczykowskicommited 2025-09-11 13:01:08 -07:00
Vendor/OEM reports of some of their code failing to build due
to larger key/value sizes.
I'd make this check mainline only, but I can't seem to find
a way to actually make that (reliably) work.
So let's just lower the minimum from 256 to 64 - this should
I think still be enough for significant performance benefits
from using bulk operations. Indeed probably even 10 would be
enough for that.
Bug: 442996907
Test: TreeHugger
Flag: EXEMPT mainline/trivial
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I69d53293dd5bb2174af7c814f531a08eba590310
Maciej Żenczykowskicommited 2025-09-11 13:01:08 -07:00
It turns out this doesn't work anyway:
Both our Java and C++ higher level map opening logic on 4.14+
kernels will check key/value sizes match, which will fail due to
the kernel uapi mismatch.
(Note: that the fixup was only ever applied/enabled inside of
the NetBpfLoad process itself, not in any later .so/Java/JNI)
This removes the fixup and simply chooses to not even attempt to
load bpf. This will result in the mainline bpf provided
maps and programs simply not existing. This would/will cause
a failure of 'bpf_existence_test' - but who cares, so long
as things keep on booting.
We need to transition to libbpf, and clearly making this work
isn't worth the considerable effort it would be, since S ebpf
functionality (ie. tethering offload) hasn't worked on the
affected devices in years.
Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ic93a5a9d5b3ba8078500e20dfdf00ef68256874c
Maciej Żenczykowskicommited 2025-09-11 13:01:01 -07:00
by joining two log lines into one with effectively the same info
(the kernel version is already printed during startup)
Test: TreeHugger
Flag: EXEMPT mainline / logging
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ide066edf2d54ffd6a61fdcb115a249bff80cdff9
Maciej Żenczykowskicommited 2025-09-11 11:34:49 -07:00
libbpf ignores BTF load error but this causes boot failure only when BTF
is required for some reasons (e.g. SK_STORAGE).
This CL makes boot fails regardless of the necessity of BTF on 4.19+
kernel
Test: boot kernel on 4.14, 4.19, 5.10, 6.1
Flag: EXEMPT mainline
Change-Id: I0af1e7eedcbea803c22c064ff157700a01307691
The symbol name of a static const variable defined within a function
includes a '.' and old kernel BTF ferifier rejects it.
"""
08-29 15:11:27.825 0 0 W : c3 1287 NetBpfLoad: [377] STRUCT _rodata size=64 vlen=3
08-29 15:11:27.825 0 0 W : c3 1287 NetBpfLoad: tcp_option type_id=343 bits_offset=0
08-29 15:11:27.825 0 0 W : c3 1287 NetBpfLoad: schedcls_ingress_accecn_eth_.new_cnt type_id=346 bits_offset=128 Invalid name
"""
This verifier limitation was relaxed in later kernels by
https://lore.kernel.org/bpf/20230615145607.3469985-1-revest@chromium.org/
Test: Boot on 4.19 kernel && logcat
Bug: 440448408
Bug: 442710894
Flag: EXEMPT tcpAccECN program is not used
Change-Id: If3c993bb6abb1ff8688932d682d909d335f84ca2
Motomu Utsumiauthored and Maciej Żenczykowskicommited 2025-09-04 04:50:13 -07:00
Before this CL, if the ip_ecn is 0b11, program returns without updating
byte_count->ceb
Test: TH
Bug: 440448408
Flag: EXEMPT tcpAccECN program is not used
Change-Id: I37aeddcb6807c43787b4f3ca0db26f47ffe190df
Likely not needed for kernel verifier happiness,
since even 1 'static' constant prevents .rodata from being
entirely empty/automatic and thus BTF-less.
Trivial follow up to go/ag/35341088
Bug: 441356399
Bug: 441436401
Test: TreeHugger
Flag: EXEMPT mainline/bug fix
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I396d1a4f2d47225707348f7c7dc3548cbba125a0
Maciej Żenczykowskicommited 2025-08-27 23:01:24 -07:00
Appear to be failing on pixel 7 U (which is 5.10)
Flag: EXEMPT mainline
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I12d70659a994fd2a9f57597fd4aaa1aea6bbe1c7
Maciej Żenczykowskicommited 2025-08-27 13:06:28 -07:00
As of M-2025-11 mainline is only being pushed to S+
Test: TreeHugger
Flag: EXEMPT test only
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Id0cf9d2cce27fb90ce076fcdd0f6ee0a95ea9741
Maciej Żenczykowskicommited 2025-08-26 09:56:45 -07:00
This CL also sorts bpf targets in Android.bp
Test: m
Bug: 440448408
Flag: EXEMPT tcpAccECN is not used
Change-Id: I4a662870333f3da02d4d6cfcb3fca8c0af452d34
This allows devices pretend they are on a different kernel version in
order to support different bpf features in case kernel backports are in
place.
Test: set ro.bpf.kver_override=5.4.186 in product.prop on sm8150 device
based on 4.14 kernel with 5.4 bpf backported, boot
Change-Id: I50357ee832b01b11e499278244f77244c904e3e9
Bumping again. See I293f99ec498e4ccac98c39f298ba01ba554f2e33.
Reasons are all the same. MEMLOCK_RLIMIT is not a concern anymore
because libbpf will automatically increase it if needed for kernels
not using cgroup accounting.
Issue: calyxos#1249
Change-Id: I0ce50383e210e936696d4294b63342e700081313
Tommy Webbauthored and Michael Bestascommited 2025-08-25 13:02:44 +03:00