Commit graph

111,214 commits

Message SHA1
Refactor: apply pyformat for coding style consistency
add pyformat for presubmit hook

Flag: EXEMPT mainline
Bug: 419423721
Test: atest CtsConnectivityMultiDevicesTestCases
Change-Id: I9abc5cee454e8c8e21ce7e3c134145857680251f

Jimi Chen   commited 2025-05-28 12:44:57 +00:00
dcbe9b403d
Replace get_apf_counter from apf shell command instead of dumpsys
Flag: EXEMPT mainline
Bug: 419423721
Test: atest NetworkStaticLibHostPythonTests
Change-Id: I6f5f93acb13503ce23066b1541c0843f6d7951d2

Jimi Chen   commited 2025-05-28 04:55:33 +00:00
5e69785de3
Merge "Truncate the additional records if the packet is too large" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-05-23 01:01:05 -07:00
f79d1bd53d
Truncate the additional records if the packet is too large
When the packet is too large to be sent it may cause the socket to throw
an error. This commit truncates the additional records in this case.

Bug: 407609792
Test: CI
Flag: EXEMPT bugfix

Change-Id: I77a979d7f8799f05cbcb14857061a18aecfef657

Handa Wang   commited 2025-05-22 21:38:55 -07:00
8f8c78d56f
Merge "Assumption check should not affect ethernet enabled state" into main
Patrick Rohr   authored and   Android (Google) Code Review   commited 2025-05-22 10:28:59 -07:00
2e62f8a623
Assumption check should not affect ethernet enabled state
setEthernetEnabled() is used as a synchronization mechanism, so don't
let it affect enabled state.

Test: TH
Flag: EXEMPT test
Bug: 10000001
Change-Id: Ib023b7f944a8a84435dcc546aced9b0eab96d364

Patrick Rohr   commited 2025-05-22 10:28:21 -07:00
49c3c92a44
Merge "Ensure requestTetheredInterface() is processed before proceeding" into main
Patrick Rohr   authored and   Android (Google) Code Review   commited 2025-05-22 10:28:00 -07:00
d3295c8747
Delete old BPF compat tests for previous SDKs
R & V+ never needed this as there is no platform
loading of mainline bpf.

On T/U we've been loading via mainline NetBpfLoad
for the past year, so the struct sizes only actually
matter for S.

S switches to mainline NetBpfLoad in M-2025-05
(currently in small canary), at which point the
struct sizes stop mattering.

In M-2025-07 S/T/U still look at the 'min bpf loader'
section of the .o, but don't go any deeper.

In M-2025-08 we no longer ship any bpf .o
files that need to be parsed by platform
bpfloader (as they're in a different subdirectory
in the tethering apex they don't even look in).

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

Maciej Żenczykowski   commited 2025-05-22 02:08:43 -07:00
e8cba91fd5
Merge "Skip APF enforcement check on Wear OS for 25Q2 devices." into main
Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-05-22 01:49:53 -07:00
efc519790b
Skip APF enforcement check on Wear OS for 25Q2 devices.
This commit adjusts the APF enforcement logic to align with 25Q2 GMS-VSR
and GTVS requirements. APFv6 is currently applicable only to handheld
and tablet devices (GMS-VSR) and TV devices (GTVS). For Wear OS devices,
APF enforcement will commence with Wear OS 7; therefore, the APF
enforcement check is skipped for devices launched/upgraded on Wear OS in 25Q2.

Bug: 381819368
Test: TH
Flag: EXEMPT bugfix
Change-Id: I4224738d9658fb4f6b67e491e7cd7d78e9b48748

Yuyang Huang   commited 2025-05-22 12:55:45 +09:00
aceedde4a1
Integrate a fix to better detect local wifi networks for mDNS.
Changes:
 - Use setIncludeOtherUidNetworks(true) to match networks created via WifiNetworkSpecifier (local only hotsposts for other networks - Android Auto Projected).
 - Fallback to ConnectivityManager::getAllNetworks and ConnectivityManager::getLinkProperties
  - If S is not supported in the same way, to catch networks created with WifiNetworkSpecifier by another application.
 - Subscribe to WiFiManager::NETWORK_STATE_CHANGED_ACTION event when not using setIncludeOtherUidNetworks to make sure
   that network changes are being noticed even when the ConnectivityManager::NetworkCallback is not enough.

This is not used in platform code. This code path is only used when the
mDNS stack is used as a library.

Bug: 419329782

Flag: EXEMPT dead code in the platform
Test: - Use a pre-S device to test.
 - Test with the updated library and integration with Cast sample to test.
Change-Id: I82c4cd1923a3fb77468ed0cd609996bcce3d09bc

Diego Valenzuela   commited 2025-05-21 17:54:35 -07:00
f69a211d6f
Ensure requestTetheredInterface() is processed before proceeding
requestTetheredInterface() only returns a callback if an interface for
tethering is available. The previous code timed out after 500ms which
was not enough for some devices. Instead of increasing the timeout, this
change calls setEthernetEnabled() which triggers a callback as soon as
it was processed on the handler thread. Since this event is guaranteed
to be processed after requestTetheredInterface(), the subsequent
expectOnAvailable() does not have to wait at all.

Test: TH
Flag: EXEMPT test
Bug: 418151132
Change-Id: Iff119a8e425d4071bf63fe92815061c7eb36848a

Patrick Rohr   commited 2025-05-21 14:12:31 -07:00
3556c3d7b1
Revert^2 "Check whether CarrierConfigManager is null"
This reverts commit 7b7cfa45a6.

Reason for revert: prevents crash with no carrierConfigManager support
Test: atest ConnectivityCoverageTests

Change-Id: I9e91d2d25d16c0c2a39388f08a49bef7b17fda42

Jimi Chen   commited 2025-05-21 07:24:00 +00:00
232c944de3
Merge "Optimize NetworkStats.filteredClone function." into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-05-20 19:24:17 -07:00
8737133bc1
NetBpfLoad: Remove ignore_on_* directives
`ignore_on_*` directives haven't been used in a while and require a special version of bpfloader. Remove them.

While doing so, pad the `map_def` and `prog_def` structs, to maintain existing size.

Note: The mainline shipped bpf .o files are now in a location
that no platform bpfloader ever looked/looks at.
As such maintaining .o format compatibility with older release
is not needed.

Test: TreeHugger
Flag: EXEMPT dead code removal / mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I485c9645bdece2ad27add08347688d0f1c93e5d2

Maciej Żenczykowski   commited 2025-05-20 15:02:15 -07:00
41d8d63356
Merge "Revert "Check whether CarrierConfigManager is null"" into main
Priyanka Advani (xWF)   authored and   Android (Google) Code Review   commited 2025-05-20 14:22:25 -07:00
730bb0bfe9
Merge "bpf: Remove unused macro definitions" into main
Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-05-20 14:17:54 -07:00
267d71e18c
Merge "NetBpfLoad: abort() on ignore_on_*" into main
Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-05-20 14:17:49 -07:00
aeb8fcc185
Merge "NetBpfLoad: abort if pin_subdir is specified" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-05-20 14:17:43 -07:00
2be0eec88c
Revert "Check whether CarrierConfigManager is null"
This reverts commit b936f0c5fd.

Reason for revert: Droidmonitor created revert due to b/418898788. Will be verifying through ABTD before submission.

Fix: 418898788
Change-Id: Ia47f0cc9a33ed33f9d53064878992081a792f1ad

Priyanka Advani (xWF)   authored and   Android (Google) Code Review   commited 2025-05-20 11:19:03 -07:00
7b7cfa45a6
bpf: Remove unused macro definitions
Remove unused macros.

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

Maciej Żenczykowski   commited 2025-05-20 08:49:10 -07:00
e74c12bfbe
NetBpfLoad: abort() on ignore_on_*
should be unused

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

Maciej Żenczykowski   commited 2025-05-20 08:45:15 -07:00
e445d25af7
NetBpfLoad: crash if we are reusing a map.
This is to identify if it actually happens.

It is expected not to happen, because we now pin every map and are run only once on boot.

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

Maciej Żenczykowski   commited 2025-05-20 06:41:18 -07:00
b71cd4f8cf
NetBpfLoad: abort if pin_subdir is specified
This code should be dead. Abort to see whether it is.

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

Maciej Żenczykowski   commited 2025-05-20 06:38:57 -07:00
10979ef9ec
Merge "Address warnings in TestableNetworkCallback" into main
Jean Chalard   authored and   Android (Google) Code Review   commited 2025-05-19 19:24:05 -07:00
649bbe6720
Merge "Fix a bug in poll(from)" into main
Jean Chalard   authored and   Android (Google) Code Review   commited 2025-05-19 19:23:52 -07:00
307f792ad4
Merge "Remove RecorderCallback." into main
Jean Chalard   authored and   Android (Google) Code Review   commited 2025-05-19 19:23:31 -07:00
0d0fc56209
Merge "Check whether CarrierConfigManager is null" into main
Jimi Chen   authored and   Android (Google) Code Review   commited 2025-05-19 18:48:10 -07:00
87e73ef81a
Merge "NetlinkUtils: bump dump socket recv buffer size to 1MiB" into main
Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-05-19 12:38:51 -07:00
b095aa3fd0
Merge "Tethering: use the correct socket size for conntrack dump" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-05-19 12:31:19 -07:00
f30ea2c8e2
Merge "Log terrible error when tethering type mismatches" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-05-19 11:54:48 -07:00
71947a12d8
Tethering: use the correct socket size for conntrack dump
Offload HAL conntrack sockets are used for conntrack state dumps,
so should use the dump socket buffer size.

Bug: 409212357
Test: TreeHugger
Flag: EXEMPT mainline/trivial
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I73b4bb706efe55505b3646df63330de521a6df3f

Maciej Żenczykowski   commited 2025-05-19 10:49:35 -07:00
7a82293238
NetlinkUtils: bump dump socket recv buffer size to 1MiB
Bump up buffer to 1M to avoid overflow.

Bug: 409212357
Test: TreeHugger
Flag: EXEMPT mainline/trivial
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I6ccca6c577fda080067a9cf8a8efae064ed6df51

Maciej Żenczykowski   commited 2025-05-19 10:49:03 -07:00
d9b2cf9be0
Log terrible error when tethering type mismatches
Today on R and S, it is theoretically possible for WiFi to start
tethering with interface name wlan0, but the tethering regexes to map
wlan0 to type TETHERING_USB, because ifaceNameToType(wlan0) could return
TETHERING_USB and the subsequent call to checkTetherableType() returns
true.

This change adds a telemetry express log to figure out whether this
actually happens in the field.

Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: I59d6665670fc3210ddf8d49dc28917f000751ccd

Patrick Rohr   commited 2025-05-19 10:04:14 -07:00
30c36198c5
Check whether CarrierConfigManager is null
Currently, the CarrierConfigManager is null on several non-phone
projects, e.g. tv, wear devices. This is because CarrierConfigManager
is not supported on these devices.

This change checks whether it is null and improve error handling.

Flag: android.net.platform.flags.avoid_bad_wifi_from_carrier_config
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.MultinetworkPolicyTrackerTest \
      --update-device
Fix: 416654774
Change-Id: I40fa7139a349472b1d5cbd36b5bff286309aebc5

Jimi Chen   commited 2025-05-19 11:56:32 +00:00
b936f0c5fd
Update comments and local variables
PermissionMonitor#startMonitoring() was renamed to initialize().
Update comments and local variables accordingly.

Flag: EXEMPT refactor
Test: TH
Bug: 410731080
Change-Id: I840b5172e1ebc761cade0e6082fec0cab7fe9a3b

Junyu Lai   commited 2025-05-19 02:20:12 -07:00
871e7ea684
Merge "bpf: Update SDK level constants" into main
Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-05-19 01:39:58 -07:00
22f9e7cf85
Address warnings in TestableNetworkCallback
Test: TH
Flag: EXEMPT test-only
Change-Id: Ifcbbc6e5443f619279744be993cce10f4ecd22a5

Chalard Jean   commited 2025-05-19 16:35:55 +09:00
63947668a2
Fix a bug in poll(from)
Test: new test in this patch
Flag: EXEMPT test-only
Change-Id: I00d367ce9db47e3fd30d27816b68280ab418f988

Chalard Jean   commited 2025-05-19 16:35:54 +09:00
f0252b1cf4
Remove RecorderCallback.
This class doesn't actually serve a purpose, it only makes
TestableNetworkCallbck more complex.

Test: CtsNetTestCases ConnectivityCoverageTests
Flag: EXEMPT test-only
Change-Id: I39a598b82a3215384bdfe04980f4b280ab2c2716

Chalard Jean   commited 2025-05-19 16:35:53 +09:00
f2994122c1
Merge "Parcel Network#mPrivateDnsBypass" into main
Jean Chalard   authored and   Android (Google) Code Review   commited 2025-05-19 00:03:32 -07:00
499961d60f
bpf: Update SDK level constants
This is to provide for QPRs and the upcoming future.

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

Maciej Żenczykowski   commited 2025-05-18 01:45:49 -07:00
57db7c5e73
NetBpfLoad: disallow 32-bit userspace on 6.13+ kernels
This is basically a no-op as 32-bit netd already fails on android-mainline @ 6.13 (we're now at 6.14, 6.15 is coming in a few weeks).
I know this because we had to fix ACK 6.12, and didn't port it forward.

Note: AFAIK TV is planning to release on 25Q2 and then 27Q2,
so this 26Q2+ doesn't actually affect them till a year later in 27Q2.

Modern arm cores are dropping 32-bit cpu instruction decode support.
This already happened on Pixel 8+ (Tensor G3+) and is soon coming
to the GCE cloud machines underpinning our cuttlefish VMs
(this is very much an industry wide trend for modern aarch64 cores,
I believe all new application cores since 2023 have been 64-bit only).

Pixel 6a is AFAIK the last pixel with 32-bit application support,
and that is reaching EOL approximately in July 2027.
(while most test coverage is on Pixel 6/6pro which EOLs in Oct 2026)

Note though that this isn't a great example: AFAIK all Pixels
have had 64-bit system userspace (which is what we care about here)
The transition happened in the final Nexus, the year before Pixel 1.

This means we're going to start losing *any* remaining vestiges
of test coverage that we still (might) have.

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

Maciej Żenczykowski   commited 2025-05-17 06:00:03 -07:00
1da1945e26
Merge "bpf: remove unused tethering xdp programs" into main
Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-05-17 05:12:37 -07:00
b8b5edc24d
bpf: remove CRITICAL sections from mainline networking programs
All mainline networking programs are critical by default.

It is still parsed by the platform and uprobestats bpf loaders,
but not by NetBpfLoad, where criticality is simply hardcoded.

You can cs/ for
  ["]critical["] file:bpf
in android and it'll find the relevant:
  ret = readSectionByName("critical", elfFile, critical);
lines.

Test: TreeHugger
Flag: EXEMPT dead code removal
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I983d0072168a89d81aa9a1e79a1e6f94bf8e822b

Maciej Żenczykowski   commited 2025-05-17 03:15:02 -07:00
501c9de9ef
bpf: remove unused tethering xdp programs
We can always trivially add it back if we ever manage
to make XDP work, but that will likely be on at least 6.1+
as that's the minimum kernel version on Pixel 6+ now.

In the mean time, we can just delete it, and very
slightly speed up boot time (less things to verify).

Note: code search in android for
  xdp_tether -file:kernel_logs/
  xdp/tether -file:kernel_logs/
doesn't find any hits outside this one file.

Test: TreeHugger
Flag: EXEMPT dead code removal
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I39c040d79b4f175cafc141e8f0c9e631e372ebd2

Maciej Żenczykowski   commited 2025-05-17 02:53:25 -07:00
1daafe04f1
Merge "Move SSLCertificateSocketFactoryTest out of CtsNetTestCases" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-05-16 04:01:55 -07:00
68d8a44bcf
Merge changes I380d649c,I64734ee7,Ie6f3859e into main
* changes:
  Remove ensureIpServerStartedLegacy.
  Never create IpServers based on interface up for WIFI and WIFI_P2P.
  Rename the methods in the legacy codepath for clarity.

Patrick Rohr   authored and   Android (Google) Code Review   commited 2025-05-16 02:15:46 -07:00
ceb9f3e819
Merge "Add EthernetPortInfo class" into main
Chuwei He   authored and   Android (Google) Code Review   commited 2025-05-16 01:39:54 -07:00
59f8d2b8ed
netbpfload.rc: bump to 25q3
(from https://android-review.git.corp.google.com/c/platform/packages/modules/Connectivity/+/3560067)

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

Maciej Żenczykowski   commited 2025-05-16 01:33:52 -07:00
d1c8cc126e