Commit graph

108,972 commits

Message SHA1
Revert https://r.android.com/3477936
The CL has caused a memory regression in the Zygote, See: b/396156852

Test: Compile
Bug: 396156852
Change-Id: I0ca4cd430a6537d689a1b04739656afc84c43ce1

Mohannad Farrag   commited 2025-02-18 18:32:23 +00:00
e0b119773c
Merge changes Ic349e0b0,I061733d7 into main
* changes:
  Fix LOHS stealing pending tethered SoftAP requests
  Pre-emptively fail pending pan requests upon opposite request

Quang Luong   authored and   Gerrit Code Review   commited 2025-02-12 19:08:19 -08:00
5817d88cf5
Merge "Use netlink to set MTU in IpClient(1/2)" into main
Chuwei He   authored and   Gerrit Code Review   commited 2025-02-12 17:44:20 -08:00
4940e0b869
Fix LOHS stealing pending tethered SoftAP requests
Currently, WIFI_AP_STATE_CHANGED for LOHS will use any pending Wifi
TetheringRequest to start the IpServer. This is a bug, since pending
Wifi requests are always for tethered SoftAP, not LOHS. This means if
there's already a pending request for tethered SoftAP, we will
mistakenly use the tethered SoftAP request for LOHS. Then, when the
WIFI_AP_STATE_CHANGED event for the tethered SoftAP arrives, the pending
request for it will already be gone.

Fix this by always having LOHS use an implicit LOHS TetheringRequest
instead of taking the request from the pending list.

Bug: 216524590
Test: atest
Change-Id: Ic349e0b0688addf6a41b3de0528d444d716846a2

Quang Anh Luong   commited 2025-02-13 10:25:20 +09:00
860828027a
Pre-emptively fail pending pan requests upon opposite request
If there are pending pan requests for an enable but a disable request
comes (or vice versa), remove all the pending requests and pre-emptively
fail their result listeners. This simplifies the logic and helps us
keep track of which request the future link layer event should be long
to.

Technically this is an app-visible behaviour change. In particular, if
something disables bluetooth tethering while the service is
disconnected and request(s) to enable tethering are queued, then the new
code will immediately send onTetheringFailed to all those requests,
whereas the old code would wait until the service connects, enable
tethering (and send the enabler an onTetheringStarted), and then disable
it. Given that this situation is very rare, and Bluetooth tethering is
itself so uncommon (<1% of total tethering sessions) this is an
acceptable trade-off.

Bug: 216524590
Test: atest TetheringTest
Change-Id: I061733d714894b741e7d686810dd39f054e85476

Quang Anh Luong   commited 2025-02-13 10:24:42 +09:00
9cebb8c3b1
Merge "Use ErrnoException for handling exceptions in JNI functions" into main
Patrick Rohr   authored and   Gerrit Code Review   commited 2025-02-12 08:34:43 -08:00
0cf79aa0ed
Use ErrnoException for handling exceptions in JNI functions
This commit updates the timerfd JNI function calls to use
ErrnoException instead of IOException to handle exceptions
correctly.

Bug: 393169546
Test: m
Change-Id: I56385a0e9f20c778eb2c2d2c4fe43cbf12753d93

Paul Hu   commited 2025-02-12 05:35:53 +00:00
57ab9bf806
Handle RESERVATION requests in updateRequestCounts
RESERVATION requests are effectively equivalent to REQUESTs in
NetworkAgent contexts.

Change-Id: I7534c4755543365153a9348ef7c6d0ada1b70cd5
Test: TH, though I am working on a CSL2capNetworkProviderTest

Patrick Rohr   commited 2025-02-11 15:54:04 -08:00
26b9ec789e
Merge "Add metric to HttpEngine preload" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-02-11 15:13:22 -08:00
02574fa4dc
bpf: don't spam the log with initMaps successfully
We already log on init start, and we log all failures,
we don't need an extra log in the middle of init.

I NetdUpdatable: libnetd_updatable_init: Initializing
I NetdUpdatable: initMaps successfully
E NetdUpdatable: libnetd_updatable_init: Failed: (1) [Operation not permitted] : Failed to change RLIMIT_MEMLOCK to 2 GiB

while success looks like:
  I netd    : netd 1.0 starting
  I netd    : Pid file removed
  I netd    : SIGPIPE is blocked
  I netd    : setCloseOnExec(dnsproxyd)
  I netd    : setCloseOnExec(fwmarkd)
  I NetdUpdatable: libnetd_updatable_init: Initializing
  I NetdUpdatable: BPF programs are loaded
  I NetdUpdatable: initMaps successfully
  I netd    : libnetd_updatable_init success
  I netd    : NetlinkManager instanced

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I8bca9b59363c1f31ecf3de80b9d280a28cce4a14

Maciej Żenczykowski   commited 2025-02-11 14:27:03 -08:00
6fc914642c
Merge "bpf: check _Alignof(u64) == 8 (except i386 where 4)" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2025-02-11 10:53:53 -08:00
e771525f4f
bpf: check _Alignof(u64) == 8 (except i386 where 4)
Make sure _Alignof(unsigned long long) is 4 on i386
and 8 on all other archs.

This should be a no-op, as it should be trivially true on
any 64-bit architectures (aarch64/riscv64/x86-64), and is
also true on 32-bit arm.

btw. currently failing targets if you just == 8 unconditionally
include at least:

cf_gwear_x86-trunk_staging-userdebug:git_main
test_suites_x86_64-trunk_staging:aosp-main
test_suites_x86_64-trunk_staging:git_main
test_suites_x86_64-trunk_staging_coverage:aosp-main
test_suites_x86_64-trunk_staging_coverage:git_main

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I2fac89d552232150b167e9f67fe1bd0cf2c129ee

Maciej Żenczykowski   commited 2025-02-10 22:50:45 -08:00
f6c1f7574d
NetBpfLoad: on 25Q2+ force 64-bit kernel
This intentionally does not block 32-bit userspace,
but it does mean existing 32-on-32 devices will need to
upgrade to 32-on-64 to upgrade to 25Q2+.  Even Wear/TV.

This will allow us to unconditionally start using 64-bit
cli binaries for network admin tasks and avoid the entire
insanity that is 32-bit kernel net admin ABI of
iptables/netfilter & xfrm/ipsec.

Note: on at least x86 there's already code in netd that is outright incorrect if the kernel is not 64-bit.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I9c18f82b38adeb223ffe3c6aebda50f057f3c818

Maciej Żenczykowski   commited 2025-02-10 21:54:34 -08:00
127715a53d
Merge changes I32434588,I61efbedb into main
* changes:
  Mark blanket offer as transport primary
  Add createL2capNetwork helper

Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2025-02-10 20:09:37 -08:00
552038f6c0
Merge changes Icf49147d,I622c86fe,I3e789541 into main
* changes:
  Move reserved offer teardown into a function
  Store reserved offers in a Set instead
  Allocate a BluetoothServerSocket for the ReservedServerOffer

Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2025-02-10 16:54:47 -08:00
37714f553c
Merge "Remove apex_available from libremoteauth_jni_rust_defaults" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-02-10 16:21:16 -08:00
3168fe454b
Merge changes I7b966621,I082c7af8,I8cdc8004,Icfba2964 into main
* changes:
  Move L2capNetworkProvider#start() onto Handler thread
  Mark globals as private
  Move the common set of NetworkCapabilities to the provider class
  Add L2capNetwork class

Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2025-02-10 14:44:22 -08:00
38f428c4a3
Remove apex_available from libremoteauth_jni_rust_defaults
libremotauth_jni_rust doesn't need to be available to an apex.

Bug: 394664568
Test: compare out/soong/installs-${TARGET_PRODUCT}.mk
Change-Id: I16269bf4bc6fd947b7c3efe2848455ccb0ca758f

Colin Cross   commited 2025-02-10 16:25:24 +00:00
dcab86925e
Fix the string encoding issues with logging the signature
The signature should be logged _before_ decoded from the Base64
encoding in order to properly compare with what is published on gstatic.

Bug: 391327942
Bug: 378626065
Flag: com.android.net.ct.flags.certificate_transparency_service
Test: atest NetworkSecurityUnitTests
Change-Id: Ibde2d4f45b998f764e2cb8d0772a0536ff763a4a

Bessie Jiang   commited 2025-02-10 15:31:42 +00:00
20293a86ef
Merge "Add logging of the log list timestamp" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-02-10 06:42:26 -08:00
2ed9d0027d
Add logging of the log list timestamp
This CL adds the parsed log list timestamp from the JSON log list, as
well as logging a SUCCESS event (with timestamp and signature) when the
log list has been successfully updated.

Fixes: 391327942
Fixes: 394278886
Bug: 378626065
Flag: com.android.net.ct.flags.certificate_transparency_service
Test: atest NetworkSecurityUnitTests

Change-Id: I8f0d96ca96cd89dce5da588cb478f9332537df48

Bessie Jiang   commited 2025-02-10 13:32:48 +00:00
ae659ace56
Add CTS coverage for TetheringInterface with SoftApConfiguration
Cover TetheringInterface constructor with SoftApConfiguration and
TetheringInterface#getSoftApConfiguration.

Bug: 394510260
Test: atest TetheringManagerTest
Change-Id: I61d111bdea72b911b85e129ded93cfc02ce6ef2f

Quang Anh Luong   authored and   Quang Luong   commited 2025-02-09 22:23:53 -08:00
9c698d26ec
Merge "Add CTS test for ConnectivityManager#tether exception after V" into main
Quang Luong   authored and   Gerrit Code Review   commited 2025-02-09 22:04:43 -08:00
0e480b7857
Merge "Add constant for IPv6 node-local scope all nodes multicast address" into main
Jimi Chen   authored and   Gerrit Code Review   commited 2025-02-09 18:56:38 -08:00
5683c68a3f
Merge "try-catch when calling createContextAsUser" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-02-09 17:52:28 -08:00
592b489e14
Add constant for IPv6 node-local scope all nodes multicast address
Bug: 394689846
Test: TH
Change-Id: I0481fd56b70acbcf1dfe5c49fd083ff96c99e588

Jimi Chen   commited 2025-02-08 09:53:01 +00:00
76c7775121
Mark blanket offer as transport primary
This is done to ensure the blanket offer is always needed. Marking it as
primary should ensure it always outranks the server network created by
the reserved offer. If the blanket offer receives an onNetworkUnneeded,
the associated reservation is torn down.

Test: TH
Change-Id: I324345884fcf805a06e3251fc51b0ea9ea52b3b7

Patrick Rohr   commited 2025-02-07 15:55:04 -08:00
07bad0cf27
Add createL2capNetwork helper
Adds a function to create a tun interface configured for blocking i/o.
Also adds a helper function to create an L2capNetwork which calls
createTunInterface(). createL2capNetwork() requires the caller to pass a
*connected* BluetoothSocket and will be used for both server and client
networks.

Note that this split isn't particularly logical (because this function
does not get called yet), but was the easiest way to make the code more
reviewable.

Test: atest L2capNetworkProviderTest
Change-Id: I61efbedbf56fe9b4ba6d0050eaa29ead3023da3f

Patrick Rohr   commited 2025-02-07 15:55:04 -08:00
c72191f62a
Move reserved offer teardown into a function
This function will also be called from the ReservedServerOffer itself
when it encounters an error that should release the reservation.

Test: TH
Change-Id: Icf49147dd5f1335e9a3b8706da5bbba03c556758

Patrick Rohr   commited 2025-02-07 15:03:36 -08:00
62fc9d478c
Store reserved offers in a Set instead
ReservedOffers should be identified by the reservationId, not the
requestId. Furthermore, a reserved offer can be torn down outside of
onNetworkUnneeded() at which point there is not request to reference.

This change replaces the Map of requestId -> reservedOffer to a Set of
reservedOffers.

Test: TH
Change-Id: I622c86fe238b2412664add55ce491eb5baf6033f

Patrick Rohr   commited 2025-02-07 15:02:45 -08:00
53bdcd713d
Allocate a BluetoothServerSocket for the ReservedServerOffer
This change allocates a BluetoothServerSocket as a response to the
reservation. The resulting PSM is used to create the reserved
capabilities stored in ReservedServerOffer.

Test: TH
Change-Id: I3e789541474a492bb1c015d6316db12a3c995995

Patrick Rohr   commited 2025-02-07 14:27:00 -08:00
466bff2833
Merge "Revert^2 "Fix apex_available value in Connectivity"" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-02-07 13:19:24 -08:00
78206ee640
Merge "Add L2capPacketForwarder" into main
Patrick Rohr   authored and   Gerrit Code Review   commited 2025-02-07 12:58:48 -08:00
297793e2d2
Move L2capNetworkProvider#start() onto Handler thread
To prevent having to use locking or memory synchronization mechanisms
later on.

Test: TH
Change-Id: I7b966621012030ab78e7a7e21e49ddc5df37df75

Patrick Rohr   commited 2025-02-07 12:57:10 -08:00
195e65db5d
Mark globals as private
Otherwise, they may conflict with other definitions in the same package.

Test: TH
Change-Id: I082c7af8aa186b6101ec08714d1ace5d64c1c95e

Patrick Rohr   commited 2025-02-07 12:57:10 -08:00
735afa97d3
Move the common set of NetworkCapabilities to the provider class
These will be used in the blanket, reserved, and client offers and any
associated networks.

Test: TH
Change-Id: I8cdc80042ff08385f3d333c894c7c325768b7ed0

Patrick Rohr   commited 2025-02-07 12:57:10 -08:00
0dbd622eb1
Add L2capNetwork class
The L2capNetwork class keeps track of the IpClient (configured in IPv6
link-local only mode), NetworkAgent, and L2capPacketForwarder.

Test: mm
Change-Id: Icfba2964dec7e8260973591395a391d30bbae6c2

Patrick Rohr   commited 2025-02-07 12:57:10 -08:00
20eff7b35d
Adding access methods for local_net_access_map and
local_net_blocked_uid_map

Test: Manually tested this using dumpsys commands
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.BpfNetMapsTest
Bug: 392855578

Change-Id: I61522f3282aa502f20641d3c2692a66638edf706

Sarup Dalwani   authored and   Jacque Li   commited 2025-02-07 15:10:49 -05:00
448eb43f28
Merge "Listen to permission changes in permission monitor" into main
Jacque Li   authored and   Gerrit Code Review   commited 2025-02-07 12:09:53 -08:00
ddf74d8f90
Listen to permission changes in permission monitor
Bug: 369646309
Test: atest
ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.PermissionMonitorTest

Change-Id: I23c524baaee6b9b06a855fb811906e5189ef03fd

Jacque Li   commited 2025-02-07 15:08:09 -05:00
2003e6ee49
Add L2capPacketForwarder
L2capPacketForwarder forwards packets between an L2CAP BluetoothSocket
and a tun fd.

It uses blocking i/o to do so, since the BluetoothSocket API does not
expose a file descriptor to poll() on.

It remains to be seen whether shutdown() on a tun interface fd is
actually implemented. Currently, the test uses a pair of SOCK_SEQPACKET
sockets which require to be shutdown to interrupt the blocking read.

Test: L2capPacketForwarderTest
Change-Id: I03d2a2dd76ec2b71fdb9e3ea7008daa6d1d124fe

Patrick Rohr   commited 2025-02-07 10:50:48 -08:00
65dc1295dc
Revert^2 "Fix apex_available value in Connectivity"
45f0845bd1

Change-Id: I4a059f61fdc30ccc55b11570e679d192aaebd7a9

Colin Cross   authored and   Gerrit Code Review   commited 2025-02-07 07:13:07 -08:00
202eef1789
Merge "Revert "Fix apex_available value in Connectivity"" into main
Colin Cross   authored and   Gerrit Code Review   commited 2025-02-07 07:11:38 -08:00
19ee705439
Revert "Fix apex_available value in Connectivity"
Revert submission 3477737-move_apex_shortcut

Reason for revert: Likely culprit for b/394990888 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.

Reverted changes: /q/submissionid:3477737-move_apex_shortcut

Change-Id: I8acc4fe8628cdef2f58f3423576fe5c582fcb023

Chaitanya Cheemala (xWF)   authored and   Gerrit Code Review   commited 2025-02-07 01:38:05 -08:00
45f0845bd1
Add CTS test for ConnectivityManager#tether exception after V
Current test was mistakenly added to the unit test version of
ConnectivityManagerTest instead of the CTS test. Move this to the CTS
test instead.

Bug: 392986269
Test: atest android.net.cts.ConnectivityManagerTest
Change-Id: Id64d21929fb6b6c42f46a821a3cd28bbcaf77cda

Quang Anh Luong   commited 2025-02-07 12:42:12 +09:00
6c478ee215
Merge "Fix apex_available value in Connectivity" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-02-06 18:21:00 -08:00
d7db8b5ea6
Fix apex_available value in Connectivity
com.android.remoteauth doesn't exist, but the value wasn't being
checked because no apexes depended on the module, triggering a shortcut
that skipped the apex_available check.

Bug: 394664568
Test: builds
Change-Id: I25fd078093fd71a0e0df01fb31be9f2b811108ff

Colin Cross   commited 2025-02-06 13:05:25 -08:00
8ce1a1a403
TcUtils: allow ignoring netlink error code ENOENT
Ignore this error code during DEL operations.

It is returned when the specific thing to be deleted
is not found and is therefore a valid response.

Gets rid of 30+ logs worth of:
  E TcUtils : NLMSG_ERROR message return error: -2
during netd startup (cleanup phase).

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie542f8ff418dbed604eea5b31b87f9b974ccdbcb

Maciej Żenczykowski   commited 2025-02-06 12:56:09 -08:00
f31a45416c
Merge "Add MLD type offset definition" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2025-02-06 12:25:46 -08:00
7805afe418
Merge "Prevent calling requestTetheredInterface when using adb over ethernet" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-02-06 09:12:16 -08:00
cab97196d6