Commit graph

114,429 commits

Message SHA1
Merge "CCT VPN bypass for Android U and below" into main
Yuyang Huang   authored and   Android (Google) Code Review   commited 2025-09-11 22:20:35 -07:00
9dbdaeaf70
CCT VPN bypass for Android U and below
Implements logic to allow CCT to bypass VPN on Android U (API 34) and
older. On these Android versions, netd's VPN bypass APIs
(networkSetProtectAllow/Deny) operate globally.

Test: TH
Flag: NONE legacy flag protected
Change-Id: I3650c3823d65504046d74cd60485d9cc890937d8

Yuyang Huang   commited 2025-09-12 12:00:35 +09:00
7daab8cc60
Merge "Parse IFLA_INET6_FLAGS attr from the RTM_NEWLINK message." into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-09-11 18:53:12 -07:00
0c8a65ff9a
Merge "Refactor: Introduce Builder for RtNetlinkNeighborMessage" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-09-11 16:08:54 -07:00
5ed9c20ef1
Merge changes I56b28021,I69d53293 into main
* changes:
  BpfMap: remove @CriticalNative from nativeSynchronizeKernelRCU()
  BpfMap: lower min allowed batch size

Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-09-11 14:25:37 -07:00
88308548f5
Merge "NetBpfLoad: eliminate 'bpfCmdFixupIsNeeded'" into main
Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-09-11 14:24:28 -07:00
fed669c16c
Merge "NetBpfLoad: move dir creation ahead of kernel uapi check" into main
Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-09-11 14:22:40 -07:00
2a0a6309c6
Merge "NetBpfLoad: reduce log spam" into main
Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-09-11 14:22:09 -07:00
9bf528adeb
Merge "HACK: fix/disable a broken test." into main
Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-09-11 14:21:29 -07:00
8ac3c80708
BpfMap: remove @CriticalNative from nativeSynchronizeKernelRCU()
There's been some reports that this can cause process termination due
to gc/sleep logic thinking the thread is stuck for >4s.

While this implies that RCU is stuck for >4s, maybe this is something
that can happen on lower power devices.

It seems prudent to (at least temporarily) revert back to the old
non-CriticalNative behaviour.

Test: TreeHugger
Flag: EXEMPT mainline, bugfix
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I56b2802132f252a02411a9a8f762d98ab2f336ad

Maciej Żenczykowski   commited 2025-09-11 13:01:08 -07:00
1e1d336141
BpfMap: lower min allowed batch size
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 Żenczykowski   commited 2025-09-11 13:01:08 -07:00
1476ec1141
NetBpfLoad: eliminate 'bpfCmdFixupIsNeeded'
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 Żenczykowski   commited 2025-09-11 13:01:01 -07:00
db324dfbca
NetBpfLoad: move dir creation ahead of kernel uapi check
Test: TreeHugger
Flag: EXEMPT mainline/refactor
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I395d6f9abe0c0cbd8af662b1c94be16eeac4060b

Maciej Żenczykowski   commited 2025-09-11 12:04:56 -07:00
9611f93131
NetBpfLoad: reduce log spam
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 Żenczykowski   commited 2025-09-11 11:34:49 -07:00
ff505eaaea
Log when VcnGatewayConnection is torn down, with reason
Flag: EXEMPT METRICS
Test: atest FrameworksVcnTests, CtsVcnTestCases
Bug: 288600040
Change-Id: I23b3edf9a2c128a7f8adabef3853fbe0be4a3193

Hnin Naing   commited 2025-09-11 18:26:04 +00:00
7602406ec8
HACK: fix/disable a broken test.
Currently we have the following failure:
  TetheringPrivilegedTests: Passed: 43, Failed: 1, Ignored: 0, Assumption Failed: 1
  android.net.ip.RouterAdvertisementDaemonTest#testSolicitRouterAdvertisement

this is due to netd's NetdNativeService::networkAddRoute being DEPRECATED

Test: TreeHugger
Flag: EXEMPT test
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: If98ebc87bbdec590f0ef166683a590381fabd285

Maciej Żenczykowski   commited 2025-09-11 11:20:17 -07:00
0b4a0d10a8
Refactor: Introduce Builder for RtNetlinkNeighborMessage
This change refactors the creation of `RtNetlinkNeighborMessage` instances by introducing a new `Builder` class. The `newGetNeighborsRequest` and `newNewNeighborMessage` methods now use this builder to construct the messages, improving readability and maintainability.

Bug: 395153629
Test: atest RtNetlinkNeighborMessageTest
Flag: EXEMPT PURE_REFACTOR
Change-Id: I60c277a736266ca0b61f138dd8ef5272c6aa9e5b

Nate Jiang   commited 2025-09-11 10:59:24 -07:00
bc568b753b
Parse IFLA_INET6_FLAGS attr from the RTM_NEWLINK message.
Flag: EXEMPT mainline change
Bug: 293393743
Test: atest NetworkStaticLibTests
Change-Id: I5dc34461a13bd0751d3d7debf1e7412f05958734

Xiao Ma   authored and   Patrick Rohr   commited 2025-09-11 08:35:33 -07:00
d4de245c84
Merge "Fix VPN bypass by updating VPN filter" into main
Yuyang Huang   authored and   Android (Google) Code Review   commited 2025-09-10 21:18:30 -07:00
aa849c4158
Fix VPN bypass by updating VPN filter
This commit addresses an issue where the VPN bypass feature was not
functioning correctly. The VPN filter has been updated to properly
handle bypass rules, ensuring that designated traffic can now bypass the
VPN as intended.

Test: TH, manual
Flag: EXEMPT guarded by default-off legacy flag
Change-Id: Ie6073db4e23a3132042da21c25b696fa3abc4c91

Lorenzo Colitti   authored and   Yuyang Huang   commited 2025-09-11 11:50:05 +09:00
e4f5f85647
Merge "Add util method to convert StaticIpConfiguration from proto" into main
Chuwei He   authored and   Android (Google) Code Review   commited 2025-09-09 20:20:50 -07:00
32d4c35ae8
Merge "Add util method to convert StaticIpConfiguration to proto" into main
Chuwei He   authored and   Android (Google) Code Review   commited 2025-09-09 20:20:06 -07:00
a599e8670e
Add util method to convert StaticIpConfiguration from proto
This patch adds util methods to convert StaticIpConfiguration from its
proto equivalent, and also adds unit tests to test the conversion.

Test: atest ConnectivityCoverageTests
Bug: 397536853
Flag: EXEMPT mainline

Change-Id: Iba4955efac3b854684f0d0f32b6d5667cebdc265

Chuwei He   commited 2025-09-10 10:34:13 +09:00
c77b880d86
Add util method to convert StaticIpConfiguration to proto
This patch adds util methods to convert StaticIpConfiguration to its
proto equivalent, and also adds unit tests to test the conversion.

Test: atest ConnectivityCoverageTests
Bug: 397536853
Flag: EXEMPT mainline
Change-Id: I1bd5683202bc0e144e195b4915721e7f414c95cf

Chuwei He   commited 2025-09-10 10:34:00 +09:00
014ae496d1
Merge "Log VCN network connected and disconnected events." into main
Hnin Naing   authored and   Android (Google) Code Review   commited 2025-09-09 13:53:29 -07:00
d7f61302da
Merge "Make AddrRegReplyPacket constructor public" into main
Patrick Rohr   authored and   Android (Google) Code Review   commited 2025-09-09 13:33:02 -07:00
e3aeb74084
Merge "Log VCN network validated and not validated events." into main
Hnin Naing   authored and   Android (Google) Code Review   commited 2025-09-09 12:58:42 -07:00
4e726a6c7d
Log VCN network connected and disconnected events.
Note that disconnected events are also important for getting correct validated duration metrics. Since they are whenever we teardown the network or VcnConnectionConfig, they will mark the end duration for network validated state also.

Flag: EXEMPT METRICS
Test: atest FrameworksVcnTests, CtsVcnTestCases
Bug: 288600040
Change-Id: I34401568287700e6ab356cff029620b6372354d0

Hnin Naing   commited 2025-09-09 18:51:33 +00:00
af8402b1a0
Merge "Log CHRE NanoApp ID in hexadecimal format." into main
Chris Sabotta   authored and   Android (Google) Code Review   commited 2025-09-09 11:34:50 -07:00
af5ca897dd
Make AddrRegReplyPacket constructor public
So it can be used in tests.

Test: TH
Flag: EXEMPT mainline
Change-Id: Id44e448c1d3c21633fb1ed25a58f663caed61469

Patrick Rohr   commited 2025-09-09 10:56:01 -07:00
93d7c2ae7e
Log VCN network validated and not validated events.
Flag: EXEMPT METRICS
Test: atest FrameworksVcnTests, CtsVcnTestCases
Bug: 288600040
Change-Id: I574db304dc8377e70500f52f52d9b14934e5182a

Hnin Naing   commited 2025-09-09 16:49:17 +00:00
f0c44cb378
Merge "Split switch cases into dedicated handle methods" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-09-08 21:50:11 -07:00
2cb4715d08
Split switch cases into dedicated handle methods
This is a pure refactor to move handling of switch cases in separate
methods. This should make the code easier to follow and reduce
indentation.

Test: atest
Flag: EXEMPT pure refactor
Change-Id: Ie4803ff4de9975314529e4bd3bb92465b2cb7c10

Remi NGUYEN VAN   commited 2025-09-09 11:12:11 +09:00
701b55e20c
Merge "Convert uses of @hide to block tag" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-09-08 04:21:26 -07:00
4910c42dc7
Merge "Remove service-side TrafficStats rate limit cache" into main
Junyu Lai   authored and   Android (Google) Code Review   commited 2025-09-08 01:20:02 -07:00
fe61faa220
Merge "Add conversion util methods for EthernetPortSelector" into main
Chuwei He   authored and   Android (Google) Code Review   commited 2025-09-07 18:37:16 -07:00
54b93bb3c5
Merge "Add conversion util methods for LinkAddress" into main
Chuwei He   authored and   Android (Google) Code Review   commited 2025-09-07 18:36:37 -07:00
41f97eedb2
Merge "Add conversion util methods for MeteredOverride" into main
Chuwei He   authored and   Android (Google) Code Review   commited 2025-09-07 18:36:14 -07:00
1c67fe0789
Merge "Add CTS to validate socket FwMark value" into main
Sewook Seo   authored and   Android (Google) Code Review   commited 2025-09-06 07:11:12 -07:00
7b5ec3e68b
Log CHRE NanoApp ID in hexadecimal format.
Flag: EXEMPT trivial formatting fix
Bug: 443286901
Test: presubmits
Change-Id: I2834ef3e8fa5d10b5e35008c022788092c223479

Chris Sabotta   commited 2025-09-05 12:02:25 -07:00
0879234e61
Merge "Refactor: Use SdkUtil.isAtLeast25Q4 in ConnectivityService" into main
Sarup Dalwani   authored and   Android (Google) Code Review   commited 2025-09-05 08:24:35 -07:00
b7f8fb2557
Fix setDelegateUid unit test.
The assertion that the app was removed from the list was due to
the fact that when adding the same UID twice, the code first
removes it and then re-adds it.

Add a bit more test coverage.

Test: test-only change
Flag: EXEMPT TEST_ONLY
Change-Id: I1eda5be93668ebda7fe2049a2d1ace4e744948e7

Lorenzo Colitti   commited 2025-09-05 19:10:51 +09:00
fb3a754f83
Merge "Add a simple unit test for setDelegateUid." into main
Yuyang Huang   authored and   Android (Google) Code Review   commited 2025-09-05 01:43:41 -07:00
f8741c9611
Add CTS to validate socket FwMark value
Bug: 373280981
Bug: 331139818
Flag: EXEMPT test code
Test: atest android.net.cts.NetworkAgentTest
NO_IFTTT=no change required
Change-Id: I32da9f0c703f4572cd28f85111f199aad3d83541

Sewook Seo   commited 2025-09-04 23:44:51 -07:00
8251949339
Add a simple unit test for setDelegateUid.
This is currently very simple, but should be easy to extend.

Test: test-only change
Flag: EXEMPT TEST_ONLY
Change-Id: Ibcb286dcef0b159f01faf3dd0a17c977a7d60a52

Lorenzo Colitti   authored and   Yuyang Huang   commited 2025-09-05 15:13:23 +09:00
cb91fe2c4a
Merge "Log VCN Gateway Connection safe mode transitions." into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-09-04 15:36:26 -07:00
a1fdea2259
Log VCN Gateway Connection safe mode transitions.
This change adds logging for when a VcnGatewayConnection enters and
exits safe mode.

Flag: EXEMPT METRICS
Test: atest FrameworksVcnTests, CtsVcnTestCases. go/atomtester
Bug: 288600040
Change-Id: I6423b9fe7a1785fe31b363c8acb0b99f8d5f7df3

Hnin Naing   commited 2025-09-04 14:34:38 -07:00
3a3a2376d5
Refactor: Use SdkUtil.isAtLeast25Q4 in ConnectivityService
This change simplifies the code by calling `SdkUtil.isAtLeast25Q4()`
instead of having redundant check in
ConnectivityService.Dependencies#isAtLeast25Q4.

Test: Existing tests pass.
Bug: 443099706
Flag: EXEMPT PURE_REFACTOR
Change-Id: I2c581e24982f8f0df0cb023e2e3e4f37015d2f4a

Sarup Dalwani   commited 2025-09-04 19:05:38 +00:00
acaa7ba313
Merge "Generalize ip address handling in tether4Value bpf structures" into main
Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-09-04 11:26:00 -07:00
1f1f284deb
NetBpfLoad: Fail boot if BTF load fails on 4.19+
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

Motomu Utsumi   commited 2025-09-04 04:59:00 -07:00
8f3cfccf27