Commit graph

111,924 commits

Message SHA1
Ensure flag restoration logic is always executed in SetFeatureFlagsRule.
`base.evaluate()` can be interrupted by other rules in the chain, such
as DevSdkIgnoreRule, if an assumption fails. This prevents
SetFeatureFlagsRule from executing its flag value restoration logic,
leading to an inconsistent state. This change ensures the restoration
logic runs regardless of exceptions.

Flag: EXEMPT mainline
Bug: 440618747
Test: TH
Change-Id: Iba4483b45f11aeed8ae565f8080b2bebd299046c

Xiao Ma   commited 2025-08-27 16:55:12 +09:00
bda151cd67
TcUtils: remove dead BPF_FD_JUST_USE_INT hack
Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I311fc585d7c01c9aa5f89a42c2d1e673f7e55ae8

Maciej Żenczykowski   commited 2025-08-07 20:04:43 -07:00
762f83b5fb
Merge "Add VSR annotation to APF multi-device tests" into main
Jimi Chen   authored and   Android (Google) Code Review   commited 2025-08-07 19:31:54 -07:00
283ff389ca
bpf/progs/netd: make 'blocked_ports_map' mmapable
Perhaps not the best example, but virtually free considering
a bitmap of 64K bits is 8KiB no matter what.

Kernel will allocate:
  1 page for internal metadata (rounded up to a full page)
  N pages rounded up from array size, which is:
      number of elements (65536 bits / 64 bits per u64) = 1024
    * element size (u64 rounded up to a multiple of 8) = 8
    = 8192

This rounding up is unique to *mmapable* arrays.

thus on 4KiB page size: 12 KiB - waste is at most a few (<4) KiB
and on 16KiB page size: 32 KiB - which isn't great, but well that's 16KiB...
(presumably 16KiB is being used on devices with a lot of ram,
 where performance matters more than a little ram waste)

Note: AFAICT a kernel bpf program R/W map cannot be mapped R/O
into userspace, as the permissions on the page mapping would conflict.

(and obviously you cannot map R/W if you have only R/O access)

I'm not sure if this is architecture specific,
or simply an implementation limitation, but it is what I observed.

I think it's likely a missing kernel feature (even on 6.12)...

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

Maciej Żenczykowski   commited 2025-08-07 15:54:01 -07:00
12f752aae9
bpf: support for mmapable bpf map array (5.10+)
automatically fall back for older kernels

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

Maciej Żenczykowski   commited 2025-08-07 15:53:42 -07:00
ede2d5fe39
bpf_helpers: change how default map flags are calculated
This is more legible then a series of if's,
although thus require manually adding support for new map types.

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

Maciej Żenczykowski   commited 2025-08-07 15:53:05 -07:00
eb485ae1e9
bpf_helpers: pass map_flags into DEFINE_LIBBPF_MAP() macro
(that this was missing appears to be an oversight)

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

Maciej Żenczykowski   commited 2025-08-07 15:52:52 -07:00
eaf2fea0d2
replace CookieTagMapKey with S64
(mostly autogenerated, with minor tweaks to make it build)

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

Maciej Żenczykowski   commited 2025-08-07 15:52:35 -07:00
9ef3916ba4
replace TetherLimitValue with S64
(mostly autogenerated, with minor tweaks to make it build)

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

Maciej Żenczykowski   commited 2025-08-07 15:51:40 -07:00
84ac5ae4e7
replace UidStatsMapKey with S32
(mostly autogenerated, with minor tweaks to make it build)

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

Maciej Żenczykowski   commited 2025-08-07 15:50:48 -07:00
b28b0c70b9
Merge "replace TetherStatsKey with S32" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-08-07 15:48:52 -07:00
1c9926b4bc
replace TetherStatsKey with S32
(mostly autogenerated, with minor tweaks to make it build)

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

Maciej Żenczykowski   commited 2025-08-07 15:48:28 -07:00
b5f97280d6
replace TetherStatsKey with S32
(mostly autogenerated, with minor tweaks to make it build)

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

Maciej Żenczykowski   commited 2025-08-07 14:02:20 -07:00
b3d91118bd
Merge "Rename network interface to prevent MSVC name clash" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-08-07 13:32:08 -07:00
79c5a7494b
Add VSR annotation to APF multi-device tests
Annotate APFv4 and APFv6 multi-device tests with `@VsrTest`.
This marks these tests for compliance with specific VSR requirements,

Flag: EXEMPT test only
Test: atest CtsConnectivityMultiDevicesTestCases:ApfV4Test
Test: atest CtsConnectivityMultiDevicesTestCases:ApfV6Test
Test: ./cts-tradefed run cts \
      -m CtsConnectivityMultiDevicesTestCases \
      -t ApfV4Test --shard-count 2
Test: ./cts-tradefed run cts \
      -m CtsConnectivityMultiDevicesTestCases \
      -t ApfV6Test --shard-count 2
Change-Id: I864aa65f6f4d584c4f8077f98aac0b0da8e501c8

Jimi Chen   commited 2025-08-07 00:46:08 -07:00
752ea074e9
Merge "Change proto message name for NetworkConfigStoreProto" into main
Chuwei He   authored and   Android (Google) Code Review   commited 2025-08-06 22:28:10 -07:00
7dc6767005
Change proto message name for NetworkConfigStoreProto
This patch add *Proto suffix for some proto message in
NetworkConfigStoreProto to avoid name conflicts with names in
android.net package.

Test: atest ConnectivityCoverageTests
Bug: 397536853
Flag: EXEMPT mainline

Change-Id: I4f826511bcab0fcd3b154bbc349a062fd4841321

Chuwei He   commited 2025-08-06 20:58:53 -07:00
88d424c3b8
Merge "Add EthernetConfigHolderProto to NetworkConfigStoreProto" into main
Chuwei He   authored and   Android (Google) Code Review   commited 2025-08-06 20:37:00 -07:00
dc421c895e
Merge "Adding isLocalRoute parameter to RouteInfoParcel" into main
Lorenzo Colitti   authored and   Android (Google) Code Review   commited 2025-08-06 20:05:22 -07:00
43a7ec601e
Merge "Stabilize flaky tests by adding packet delay" into main
Jimi Chen   authored and   Android (Google) Code Review   commited 2025-08-06 18:26:21 -07:00
a9a7a7c0d2
Add EthernetConfigHolderProto to NetworkConfigStoreProto
This patch Adds EthernetConfigHolderProto to NetworkConfigStoreProto for storing
collective ethernet configurations state.

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

Chuwei He   commited 2025-08-07 10:11:16 +09:00
18a67028d2
Merge "Move #nativeWaitForService into CommonConnectivityJni" into main
Patrick Rohr   authored and   Android (Google) Code Review   commited 2025-08-06 11:12:41 -07:00
2e342c6d9b
Move #nativeWaitForService into CommonConnectivityJni
AServiceManager_waitForService sytem APIs currently only callable
via dlsym(): b/376759605. When built with sdk_version current,
the NDK stubs for "sdk" variants only include NDK APIs,
excluding #systemapi APIs.

Flag: EXEMPT Mechanical refactors
Test: atest ServiceManagerWrapperIntegrationTest
Change-Id: I48f690d771c7905e79e463617ded772f753cc854

Mark Chien   authored and   Patrick Rohr   commited 2025-08-06 10:44:39 -07:00
f250ade6fa
Adding isLocalRoute parameter to RouteInfoParcel
ConnectivityService would be centralized location for deciding local
network so for this effort adding isLocalRoute parameter to RouteInfoParcel

Bug: 394308861
Test: Manually tested.
Test: atest ConnectivityCoverageTests
Flag: EXEMPT Using device config kill-switch
Change-Id: I3ed34f96af1cbd7d8645a6c19e696a75525ce68a

Sarup Dalwani   commited 2025-08-06 15:40:08 +00:00
1bec0d629b
Rename network interface to prevent MSVC name clash
Some builds (e.g. MSVC) use `#define interface struct` which causes
issues with the field or argument name `interface`.

Change-Id: If18b00028818337c9fabe4a271c570f456d62a9a
Test: Build
Flag: EXEMPT PURE_REFACTOR

Ryan Zuklie   commited 2025-08-06 08:04:05 -07:00
da0e1e5ec4
Merge "Make callers of RoutingCoordinatorService pass in RouteInfoParcel" into main
Sarup Dalwani   authored and   Android (Google) Code Review   commited 2025-08-06 07:45:24 -07:00
a4f34a8836
Stabilize flaky tests by adding packet delay
Introduce a 3-second delay in each packet send.
Before sending each packet, wait for 3 seconds to give the
firmware time to turn on the APF.
The firmware may have throughput calculation logic that
depends on a certain time window.

Flag: EXEMPT test only
Bug: 434614102
Test: atest CtsConnectivityMultiDevicesTestCases:ApfV6Test
Test: ./cts-tradefed run commandAndExit cts \
      -m CtsConnectivityMultiDevicesTestCases \
      -t ApfV6Test --shard-count 2
Change-Id: I0807562cd87cbfe90c90d48cf2d0e41673c153b0

Jimi Chen   commited 2025-08-06 13:11:46 +00:00
003403e237
Merge changes Icf1b55f1,I06619743,I9535eac7 into main
* changes:
  bpf: remove KVER_ prefix from k{min,max}_ver macro arguments
  bpf: remove KVER_NONE macro
  bpf: remove uid = AID_ROOT from bpf program specifications

Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-08-06 05:53:22 -07:00
ca6ee1f454
Merge changes I718fca9e,Ieb2be6e5,Iab85fc8e into main
* changes:
  replace TetherLimitKey with S32
  replace TetherDevValue with S32
  replace TetherDevKey with S32

Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-08-06 00:46:33 -07:00
81de39cd42
Merge "Use reported satellite suspended and roaming state" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-08-06 00:29:17 -07:00
2d94e180e7
Make callers of RoutingCoordinatorService pass in RouteInfoParcel
RoutingCoordinatorService's {add,remove,update}Route methods
all end up calling netd's *RouteParcel methods.

Make callers explicitly generate and pass in the parcel to the
manager class instead of having them pass in a RouteInfo and
having the service class convert the RouteInfo to a parcel.

Also remove the {add,remove,update}Route methods from
RoutingCoordinatorManager since they are unused.

This is a no-op refactor that simplifies upcoming changes.

RoutingCoordinator is not a stable interface and is not used
across the platform/mainline boundary, so there are no version
skew considerations.

Bug: 394308861
Test: atest ConnectivityCoverageTests
Flag: EXEMPT no-op refactor
Change-Id: Iedf4c9bc28c3fc8c289db421857acddc8c694990

Lorenzo Colitti   commited 2025-08-06 15:57:36 +09:00
8f8e59abf7
Merge "Include NET_CAPABILITY_NOT_VCN_MANAGED for tethering local network agent" into main
Junyu Lai   authored and   Android (Google) Code Review   commited 2025-08-05 23:07:49 -07:00
1986dec249
Merge changes I26d8e987,Icc00abb6 into main
* changes:
  Use FakeSettingsProvider callbacks to simplify CS tests.
  Don't call ContentObserver#onChange(..., UserHandle) on S.

Lorenzo Colitti   authored and   Android (Google) Code Review   commited 2025-08-05 22:59:00 -07:00
a6cb9b734c
Include NET_CAPABILITY_NOT_VCN_MANAGED for tethering local network agent
Currently, NET_CAPABILITY_NOT_VCN_MANAGED is implicited added for
NetworkRequest built by normal apps.
However, the tethering network agent doesn't have this capability,
which makes the agent being exposed to VcnManager and cannot be
seen by normal apps.

Add NET_CAPABILITY_NOT_VCN_MANAGED to tethering NetworkAgent. Include
NET_CAPABILITY_NOT_VCN_MANAGED in local network capabilities for
metrics and API utilities to ensure correct evaluation of local
network connectivity. Update unit tests to reflect the new capability.

Flag: EXEMPT bug fix
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.CSSatisfiedByLocalNetworkMetricsTest \
      ConnectivityCoverageTests:android.net.connectivity.com.android.metrics.SatisfiedByLocalNetworkMetricsTest \
      --update-device
Test: manual generate request by CTS and statsd_testdrive -e 10247
Bug: 428098173
Change-Id: Ifa9ce0827abd22d887a0e8a2ab6f4d7391b2b8ed

Junyu Lai   commited 2025-08-06 11:24:33 +08:00
fbf102a88b
bpf: remove KVER_ prefix from k{min,max}_ver macro arguments
This is both shorter and allows us to use the stringified
version of these as the automatic section suffix.

Tested: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Icf1b55f1a8f79c517631e121cf4aed6513948957

Maciej Żenczykowski   commited 2025-08-05 19:18:04 -07:00
b20ada72e4
replace TetherLimitKey with S32
(mostly autogenerated, with minor tweaks to make it build)

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

Maciej Żenczykowski   commited 2025-08-05 19:15:35 -07:00
31c8c5b10a
bpf: remove KVER_NONE macro
We require 4.9+ for S, and M-2025-11 requires S+.

Generated via:
  removal of #define KVER_NONE then:
  for f in clatd.c netd.c offload.c include/bpf_helpers.h; do sed -r -i 's/KVER_NONE/KVER_4_9/' $f; done

plus addition of space to make things line up

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

Maciej Żenczykowski   commited 2025-08-05 19:15:35 -07:00
22d6747b28
replace TetherDevValue with S32
(mostly autogenerated, with minor tweaks to make it build)

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

Maciej Żenczykowski   commited 2025-08-05 19:15:35 -07:00
4e3adbd553
bpf: remove uid = AID_ROOT from bpf program specifications
It's superfluous - we never use any other value, and it's unlikely we ever will.

We only run code in:
 - NetBpfLoad/netd/dnsresolver which all run as uid AID_ROOT,
 - System Server which runs as uid AID_SYSTEM,
 - Network Stack which runs as uid AID_NETWORK_STACK,
so any other values would seem wrong.

However, groups serve the purpose better (hence why the programs are group readable),
and we have pre-existing groups to cover the combinations we care about.

Furthermore we already have sepolicy labels in place as well...

Tested: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I9535eac7eb365735fb3a9769c47ffa7067854dad

Maciej Żenczykowski   commited 2025-08-05 19:15:35 -07:00
ae6c74e56a
replace TetherDevKey with S32
(mostly autogenerated, with minor tweaks to make it build)

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

Maciej Żenczykowski   commited 2025-08-05 19:15:35 -07:00
a3f6c5718d
Use reported satellite suspended and roaming state
Bug: 431296970
Test: TH
Flag: EXEMPT mainline
Change-Id: I4d828bad6419aa2d12bff6f1855314c0060af3f7

Motomu Utsumi   commited 2025-08-06 09:53:30 +09:00
f9065b8898
Merge "clatd: remove DEVICEPREFIX single use define" into main
Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-08-05 14:22:36 -07:00
24eea78066
Merge "clatd: no need for argument parsing via getopt" into main
Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-08-05 14:20:48 -07:00
cbf8fa5879
Merge "clatd: x86-32 allow socketcall()" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-08-05 13:52:29 -07:00
c1d8b738dc
Merge "bpf: put canonicalized section name in bpf_prog_def" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-08-05 13:44:14 -07:00
771c07a870
Merge "Make Dhcp6AddrRegInformPacket constructor public" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-08-05 12:46:34 -07:00
24c7ddf8c8
clatd: remove DEVICEPREFIX single use define
Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ibbeb4775f1b8484c7fb8ebb90f2a165af7ad031f

Maciej Żenczykowski   commited 2025-08-05 12:15:16 -07:00
7001d85a89
clatd: no need for argument parsing via getopt
as we always pass in all of them in a well defined order

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

Maciej Żenczykowski   commited 2025-08-05 12:15:03 -07:00
1d2360adec
clatd: x86-32 allow socketcall()
32-bit x86 has a crazy networking calling convention and instead of using
individual system calls has a single multiplexed socketcall()

bionic hasn't finished transitioning to the individual calls yet
which were added to Linux kernels around the 4.10-4.14-ish timeframe.

This does open a bit of security hole, since it effectively allows
all 20-ish networking system calls, but oh well, better than constantly
allowing & logging.

I don't think we'll ever want to enable KILL mode on x86-32 any way.

Test: TreeHugger
Flag: EXEMPT mainline & disabled code
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I7228132cfbf716592607d010f64d5adeeb4419aa

Maciej Żenczykowski   commited 2025-08-05 12:14:42 -07:00
2d26f46559
bpf: put canonicalized section name in bpf_prog_def
Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I8bc5c888f982dc872ac68840ae6c136a798384d9

Maciej Żenczykowski   commited 2025-08-05 12:14:24 -07:00
adb0f9e2a4