Commit graph android_packages_modules_Co.../staticlibs/device
Message SHA1
Enable TETHER_FORCE_RANDOM_PREFIX_BASE_SELECTION by default
Since the feature was fully rolled out via experiment without
regression, this commit replaced with a
kill switch.

Flag: EXEMPT refactor
Test: atest ConnectivityCoverageTests:PrivateAddressCoordinatorTest
Fix: 312647670
Fix: 406955982
Change-Id: I18adcca45fa5f698adc80cea044d8006de097977

Junyu Lai   commited 2025-03-31 02:48:52 -07:00
db75d68801
Revert "Enable TETHER_FORCE_RANDOM_PREFIX_BASE_SELECTION by default on 25Q2+"
This reverts commit 44f2eb6e42.

Reason for revert: Networking mainline release council review feedback at b/406955982

Flag: EXEMPT bugfix
Test: TH
Bug: 406955982
Change-Id: I89bc8f5863c3acb72b5c4af5aadc40d34f2380ce

Junyu Lai   commited 2025-03-31 14:51:42 +08:00
121a4f90ba
Revert "Revert "Remove unnecessary ifindex arg from destroyUdpSo..."
Revert submission 3561690-revert-3538339-SNUWWZJNJZ

Reason for revert: NewAPI error will be fixed by separate CL

Reverted changes: /q/submissionid:3561690-revert-3538339-SNUWWZJNJZ

Change-Id: I2ae43c61c9ba0e0db3202a46e63756a3ea5a6512

Motomu Utsumi   commited 2025-03-27 08:49:10 +09:00
4d4563d62a
Revert "Remove unnecessary ifindex arg from destroyUdpSocket"
Revert submission 3538339

Reason for revert: Likely culprit for b/406432012 - 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:3538339

Change-Id: I70395af68b0f28e5c333333cb03a42f7633b0d5d

Chaitanya Cheemala (xWF)   authored and   Gerrit Code Review   commited 2025-03-26 03:07:07 -07:00
68b852a69c
Remove unnecessary ifindex arg from destroyUdpSocket
Bug: 311792075
Test: m
Change-Id: I0eb70c1248aff347e6f988789f340e117fceea33

Motomu Utsumi   commited 2025-03-26 16:48:43 +09:00
58498d1eee
Merge "Don't crash the system server when a misconfigured agent adds a DSCP policy" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2025-03-19 11:04:57 -07:00
51ac9ff7c4
Don't crash the system server when a misconfigured agent adds a DSCP policy
Additionally, when calling isEthernet(null), throw NPE instead of
SIGSEGV.

Test: New test in this patch
Change-Id: Ie80b860d4befe65a1777d0ebeb18d1807c6375d0

Chalard Jean   authored and   Patrick Rohr   commited 2025-03-19 08:24:45 -07:00
fd3ab6b212
Use NLM_F_REQUEST_ACK in createGetLinkMessage()
This rtnl message is used with sendOneShotKernelMessage() which expects
that kernel returns an ACK. We need to set NLM_F_ACK explicitly for
that.

Bug: 379021505
Test: Manually run and no more exception with EAGAIN.
Change-Id: Iba21fedf60f5eca63eceee9362e252952bb805c1

Chuwei He   commited 2025-03-12 18:30:04 -07:00
03a10fd14d
Merge "Stop using Mockito static mocking in BpfDumpTest" into main
Motomu Utsumi   authored and   Gerrit Code Review   commited 2025-03-06 19:50:26 -08:00
1d1cc3a36d
Merge "Revert^2 "Use timerfd to improve the accuracy of query timing"" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-06 12:52:13 -08:00
c23d94f2cc
Revert^2 "Use timerfd to improve the accuracy of query timing"
This reverts commit a481dc184f.

Reason for revert: Update this change to ensure proper closure of the timerfd object.

Change-Id: I14530ba77a39c77b4c7af6855ec77ba4907ab9f9

Paul Hu   commited 2025-03-06 15:13:12 +00:00
a3a34058fe
Stop using Mockito static mocking in BpfDumpTest
Test: NetworkStaticLibTests
Bug: 399571370
Bug: 397721725
Change-Id: I0d183378b08261ff24485aff4ad636cdae1851c9

Motomu Utsumi   commited 2025-03-06 09:00:18 +09:00
d27097f585
Merge "Enable TETHER_FORCE_RANDOM_PREFIX_BASE_SELECTION by default on 25Q2+" into main
Patrick Rohr   authored and   Gerrit Code Review   commited 2025-03-03 08:45:58 -08:00
dd9451b465
Enable TETHER_FORCE_RANDOM_PREFIX_BASE_SELECTION by default on 25Q2+
Since the feature was fully rolled out via experiment without
regression, this commit removes the flag and the corresponding
logic in PrivateAddressCoordinator. The flag is no longer
necessary and simplifies the code.

Test: atest ConnectivityCoverageTests:PrivateAddressCoordinatorTest
Fix: 312647670
Change-Id: I8781f98b7e99ed0856e9e04112056df5adca2527

Junyu Lai   commited 2025-03-03 16:55:03 +08:00
44f2eb6e42
Add method to destroy UDP socket
Upcoming CL adds feature to close quic connection which requires to
close UDP socket.

Bug: 311792075
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I63b7eb9c31cca9d00297a7a67c0cb18d0aa97a59

Motomu Utsumi   commited 2025-02-25 13:23:38 +09:00
7197820b15
Move SkDestroyListener to under staticlibs
Upcoming CL use SkDestroyListener from ConnectivityService

Bug: 311792075
Test: atest FrameworksNetTests
Change-Id: I96dec7e13aaa574b90e7caf3b559ee5172848e51

Motomu Utsumi   commited 2025-02-21 09:26:11 +09:00
1135975109
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
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
Use NLM_F_REQUEST_ACK in createSetFlagsMessage()
This rtnl message is used with sendOneShotKernelMessage() which expects
that kernel returns an ACK. We need to set NLM_F_ACK explicitly for
that.

Bug: 390722214
Bug: 392491075
Test: Manually run the affected test, no more exception with EAGAIN.
Change-Id: I7ef9497461a8e89e9f7f7fe399562b2d8ede14a9

Jie Jiang   commited 2025-01-27 22:10:31 +09:00
b61913bbb6
Use netlink to set MTU in IpClient(1/2)
Currently IpClient uses netd to set MTU for interfaces while the
usage of netd can bring some unexpected side effects and execute in
slower speed.

This change moves forward with one less usage of netd to use netlink
directly set MTU in IpClient.

This patch adds support in netlink utils to set MTU for interfaces.

Bug: 383663804
Test: Manually call and make sure interface MTU is updated
Test: atest NetworkStaticLibTests

Change-Id: Id73d78156d1a560262e42540a3503d059a172e34

Chuwei He   commited 2025-01-22 17:31:34 -08:00
530db3143a
Increase IO timeout
We have been seeing frequent EAGAIN errors during i/o operations in
tests. This change increases the timeout by 10x to hopefully minimize
these failures.

Per maze@: these methods are dependent on rcu synchronization, which
can take a long time on a busy system. Blocking the thread is
most likely always preferable over failing the operation.

Bug: 390722214
Test: TH
Change-Id: I96aa5a583c0c7558a8ea945eca5e5cb8f1c35c69

Patrick Rohr   commited 2025-01-21 10:57:04 -08:00
df2e6ebed1
Handle POLLERR for RealtimeScheduler
Bug: 386275396
Test: m
Change-Id: Ib2eba5930ef503057b32b702fe32691adad80d9c

Paul Hu   commited 2025-01-17 06:56:54 +00:00
4931bd791f
Fix extra callbacks sent when the timer expires
Several extra callbacks are sent after the first timer expiration
notification. This occurs because data from the FileDescriptor
must be read after the timer expires. Otherwise, expiration
callbacks will continue to be sent, notifying of unread data.

This change also adds TFD_NONBLOCK to timerfd creation to ensure
reading safety.

Test: Manually verify that the callback is sent only once
Change-Id: I30559ed93d0a742b98a58d33d83723f7a155fbd9

Paul Hu   commited 2025-01-17 06:39:48 +00:00
3ad5d4c348
Rename timerfd functions for consistency
Test: TH
Change-Id: I47b6011dcd8a0a66d89ac80e728951004666daa8

Patrick Rohr   commited 2025-01-16 14:28:13 -08:00
2f1627d3c3
Remove native prefix for consistency
Test: builds and boots
Change-Id: I5da28a6dcb9c7b7b06f072a9d92b701228cdde5e

Patrick Rohr   commited 2025-01-16 14:28:13 -08:00
9463cd1387
Move TestNetworkService JNI into ServiceConnectivityJni
Test: builds and boots
Change-Id: Ia15833a163604ddbbb9527dff59174f2643daa61

Patrick Rohr   commited 2025-01-16 14:28:13 -08:00
3c14078435
Move TimerFdUtils JNI functionality into ServiceConnectivityJni
Test: build and boots
Change-Id: Idb9f8c9979aff43e6e5351d190329e823112e005

Patrick Rohr   commited 2025-01-16 13:04:42 -08:00
4971556451
Rename TimerFileDescriptor to RealtimeScheduler
Test: TH
Change-Id: I756cb84425e7701b9340d4f6589da364b7c515f7

Yuyang Huang   commited 2025-01-09 19:38:39 +09:00
1ed836c30f
Enhance TimerFileDescriptor to schedule multiple tasks
Improved the class to allow scheduling and execution of multiple tasks
concurrently.

Test: TH
Change-Id: I79b63c6846e0e0a934f257d4a38d9cab08bd13e8

Yuyang Huang   commited 2025-01-09 19:38:35 +09:00
4d46630219
Revert "Use timerfd to improve the accuracy of query timing"
This reverts commit 3d51a99dc8.

Reason for revert: Does not close the timerfd object properly, which may cause a memory leak.

Change-Id: I25d7da13591696c9dfda60ee0fdd2574dbcdf337

Paul Hu   commited 2024-12-24 09:18:06 +00:00
a481dc184f
Rename id to fd
From feedback on aosp/3309935

Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I283b0df6a6a2a6fed65a71cacedc2b6f4bf30f2c

Maciej Żenczykowski   commited 2024-12-18 10:56:13 -08:00
e4e045305a
Merge "Use netlink to set interface up/down in EthernetTracker(1/2)" into main
Chuwei He   authored and   Gerrit Code Review   commited 2024-12-16 20:10:32 -08:00
51478aa9da
Use netlink to set interface up/down in EthernetTracker(1/2)
Currently EthernetTracker uses netd to interact with interfaces, such as
retrieving all interfaces, updating interface configurations etc.
However, the usage of netd can bring some unexpected side effects, such
as clearing v4 address when toggling on/off interface.

This change moves forward with one less usage of netd to use netlink
directly to set interface up/down in EthernetTracker.

This patch adds support in netlink utils to get/set interface flags and
added related unit test.

Bug: 379021505
Test: atest NetworkStaticLibTests
Change-Id: I5f82781663ba340588450cceea55caec4e3991a8

Chuwei He   commited 2024-12-17 11:04:19 +09:00
0daa52affd
Merge "Use timerfd to improve the accuracy of query timing" into main
Paul Hu   authored and   Gerrit Code Review   commited 2024-12-13 00:16:21 -08:00
69ce1b9f15
Use timerfd to improve the accuracy of query timing
Timerfd can provide more accurate delayed callbacks than
Handler#postDelayed because it accounts for the time the device
spends in deep sleep. Using timerfd allows for more precise query
timing, which reduces the possibility of TTL expiration caused
by inaccurate delayed callbacks.

Bug: 366373064
Test: atest FrameworksNetTests NsdManagerTest
Change-Id: I980ec8fd43f63976ef5387bb57c7ed70a1b68d82

Paul Hu   commited 2024-12-12 02:57:00 +00:00
3d51a99dc8
Merge "Update TimerFileDescriptor to support different task types" into main
Paul Hu   authored and   Gerrit Code Review   commited 2024-12-06 03:20:36 +00:00
97a4977f83
Merge "Build the timerfd wrapper class" into main
Paul Hu   authored and   Gerrit Code Review   commited 2024-12-05 08:54:25 +00:00
e8e32ab330
Update TimerFileDescriptor to support different task types
Introduced ITask and its concrete implementations (e.g.
MessageTask, RunnableTask) for TimerFileDescriptor to enable more
flexible task scheduling.

Bug: 366373064
Test: atest NetworkStaticLibTests
Change-Id: I3a5177b66916f50f3f943d8b63b0c760bece60e4

Paul Hu   commited 2024-12-04 08:32:59 +00:00
2bb40d2849
Build the timerfd wrapper class
Build a wrapper class that allows users to easily use the timerfd
object and trigger delayed callbacks through this class.

Bug: 366373064
Test: atest NetworkStaticLibTests
Change-Id: I8081d29e4874df8b9e59f7fc845b20cbd29aec40

Paul Hu   commited 2024-12-04 08:32:59 +00:00
50c14402f6
Merge "Add RtmNetlinkPrefixMessage class to represent RTM_NEWPREFIX message." into main
Xiao Ma   authored and   Gerrit Code Review   commited 2024-12-04 04:41:43 +00:00
7dd2525646
Add RtmNetlinkPrefixMessage class to represent RTM_NEWPREFIX message.
Bug: 315069348
Test: atest NetworkStaticLibTests
Change-Id: I566fa6fcc85a19dab8edf2dccb356a53fdc8e6b2

Xiao Ma   commited 2024-12-03 19:53:43 +09:00
cb0aabd14c
Merge "Create the timerfd helper class" into main
Paul Hu   authored and   Gerrit Code Review   commited 2024-11-26 08:23:21 +00:00
38bbfa8c82
Create the timerfd helper class
Create a helper class in Java to provide easy access to timerfd
JNI methods.

Bug: 366373064
Test: atest NetworkStaticLibTests
Change-Id: Iea09cd29e2a6ed837ece30c512393be2e27e8c2e

Paul Hu   commited 2024-11-22 07:12:55 +00:00
8c8d2b1bd8
Remove framework-connectivity-shared-srcs from net-utils-all-srcs
Having framework-connectivity-shared-srcs in net-utils-all-srcs is risky because it's also adds classes to other modules like WiFi.

Bug: 376587883
Change-Id: I829cc6f1e9865e6a5fc23ddcfa8d6f45aac27e06

Handa Wang   commited 2024-11-01 09:25:28 +00:00
e12dfea4f0
Split requestDownstreamAddress into two methods
This CL splits requestDownstreamAddress into two methods:  requestStickyDownstreamAddress and requestDownstreamAddress.

- The requestStickyDownstreamAddress is equivalent to the former requestDownstreamAddress when useLastAddress=true.
- The new requestDownstreamAddress method allows allocating an address without providing the interface type and scope, which is Thread NAT64's use case.


Bug: 369282577


Change-Id: Ib839d121c7b46c492f2c4c1c61b52b5d017fa055

Handa Wang   commited 2024-10-18 01:29:53 +00:00
389bc7f13e
Merge "Consolidate handler thread check functions in HandlerUtils" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-10-17 02:25:57 +00:00
b0e3eaf70b
Merge changes from topic "refactor-pac" into main
* changes:
  Update unit tests to reflect the changes to RoutingCoordinator and PrivateAddressCoordinator
  Move PrivateAddressCoordinator from Tethering to staticlibs
  Refator IpServer to allocate IPv4 address via RoutingCoordinatorManager API
  Introduce PrivateAddressCoordinator methods at RoutingCoordinatorManager

Treehugger Robot   authored and   Gerrit Code Review   commited 2024-10-17 01:28:02 +00:00
e2a031b159
Merge "Revert "Add link-related methods at NetlinkUtils"" into main
Yuyang Huang   authored and   Gerrit Code Review   commited 2024-10-17 01:22:59 +00:00
d598ced4a6
Move PrivateAddressCoordinator from Tethering to staticlibs
This CL moves PrivateAddressCoordinator from Tethering to staticlibs
so that RoutingCooridnatorService can create an instance of
PrivateAddressCoordinator.

Bug: 350699020

Change-Id: I13ccd515972243719465c1c9ab844f802bc8884b

Handa Wang   commited 2024-10-16 23:54:29 +00:00
69aee7b055
Introduce PrivateAddressCoordinator methods at RoutingCoordinatorManager
This CL exposes PrivateAddressCoordinator methods at
RoutingCoordinatorManager and implements the methods in
RoutingCoordinatorService.

The objective is to allow a system service like Thread to request an
IPv4 address allocation.

Bug: 350699020

Change-Id: I65dc309f0b503d544e0fddc1168131fa6174796c

Handa Wang   commited 2024-10-16 23:54:25 +00:00
e5e06f9f7c