Commit graph android_packages_modules_Co.../staticlibs/device
Message SHA1
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
Merge "DHCPv6 addr reg: parse OPTION_ADDR_REG_ENABLE option." into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-05-14 19:16:54 -07:00
1b2f537953
Merge "DHCPv6 addr reg: add OPTION_ADDR_REG_ENABLE option code." into main
Xiao Ma   authored and   Android (Google) Code Review   commited 2025-05-14 19:12:51 -07:00
a2aaa0bd87
DHCPv6 addr reg: parse OPTION_ADDR_REG_ENABLE option.
Check if the received DHCPv6 message has included this option, if so,
that indicates the DHCPv6 server supports the address registration.

Flag: EXEMPT guarded by an legacy experiment flag
Bug: 293393743
Test: TH
Change-Id: I04370b58e26c09ef764d92d3e211b9619b528cf0

Xiao Ma   commited 2025-05-14 17:32:01 -07:00
f3aa20f112
Merge "Change creation methods in RtNetlinkLinkMessage to take index(1/2)" into main
Chuwei He   authored and   Android (Google) Code Review   commited 2025-05-14 00:15:03 -07:00
38f66bdf9b
DHCPv6 addr reg: add OPTION_ADDR_REG_ENABLE option code.
Flag: EXEMPT define an option code constant
Bug: 293393743
Test: TH
Change-Id: Ib8b33b3c8ef9c568e1e0ef3b7f84d716ae53f130

Xiao Ma   commited 2025-05-14 15:46:19 +09:00
9ace2bc8d1
Change creation methods in RtNetlinkLinkMessage to take index(1/2)
Currently methods to create netlink message in RtNetlinkLinkMessage
take interface name, while interface index is a more deterministic way
to define an interface.

This patch changes these methods from taking interface name to taking
interface index.

Bug: 404378068
Test: NetworkStaticLibTests
Flag: EXEMPT mainline
Change-Id: I0754ee53eb0160e67f24e36340abf91b1e87d0e7

Chuwei He   commited 2025-05-13 12:06:54 +09:00
b1110454bb
Merge "Require DnsResolver M-2025-07 for DDR" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-05-08 17:40:37 -07:00
72f502bbe9
s/IaId/Iaid/ for consistency
rfc8415 calls it IAID, not IA_ID.

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

Patrick Rohr   commited 2025-05-05 12:42:51 -07:00
297945d661
Remove spurious VisibleForTesting annotation
Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: I5104b4875159bb9df6a380c846ec01be67a82d2c

Patrick Rohr   commited 2025-05-02 09:07:03 -07:00
9796d817a8
Expose a getter for mStatusCode
So it is accessible by the test.

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

Patrick Rohr   commited 2025-05-01 11:16:41 -07:00
a2a1295adc
Add Dhcp6*Packet classes to net-utils-networkstack
Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: Ica554c27a648095a23331a9d93cc6bbbcf572cec

Patrick Rohr   commited 2025-05-01 11:16:41 -07:00
f5e80bfb70
Move Dhcp6*Packet.java to staticlibs
For use in tests. This CL won't build by itself

mv NetworkStack/src/android/net/dhcp6/Dhcp6*Packet.java \
Connectivity/staticlibs/device/com/android/net/module/util/dhcp6

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

Patrick Rohr   commited 2025-05-01 11:16:41 -07:00
1ff7c3ef71
Adding IpAddress Struct type to store ip v4 and v6 addresses.
IPv4 addresses will be converted as v4-mapped-v6 address while
writting it to byte form. v4-mapped-v6 addresses in byte form will be
parsed to Inet4Address while converting it back.

Bug: 392509494
Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.StructTest
Flag: EXEMPT refactor
Change-Id: Ia906d2cae7bb7402ff937da267c2552431b2d0f7

Sarup Dalwani   commited 2025-04-30 07:42:25 -07:00
746540b874
Require DnsResolver M-2025-07 for DDR
The DnsResolver needs to support FLAG_TRY_ALL_SERVERS, so this limits
the feature to devices having a new enough version of the resolver.

Test: atest
Bug: 240259333
Flag: EXEMPT legacy flag dns_ddr_version
Change-Id: I30fd55c9c2863857ca477b738ace88712ca01be3

Remi NGUYEN VAN   commited 2025-04-30 18:26:55 +09:00
6f04bb0ef4
Replace Message with related arguments in RealtimeScheduler
This change ensures that the Message object is created and
obtained within RealtimeScheduler, preventing modification
by the caller.

Fix: 386274963
Test: atest ConnectivityCoverageTests NetworkStaticLibTests
Flag: EXEMPT bug fix
Change-Id: I4c919857bcaa2d49717859dca9c88a243cbb7a41

Paul Hu   commited 2025-04-22 01:45:13 -07:00
1dea0d630e
Move ProcfsParsingUtils to staticlibs
net-utils-device-common says:

This library shouldn't be used anymore (no class should be added), and
per-user libraries like net-utils-service-connectivity or
net-utils-framework-wifi should be used instead.

Therefore, this patch adds a new net-utils-networkstack.

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

Patrick Rohr   commited 2025-04-11 15:11:33 -07:00
259c0b4f66
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