This class doesn't actually serve a purpose, it only makes
TestableNetworkCallbck more complex.
Test: CtsNetTestCases ConnectivityCoverageTests
Flag: EXEMPT test-only
Change-Id: I39a598b82a3215384bdfe04980f4b280ab2c2716
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
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
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
This commit corrects a race condition in the RealtimeSchedulerTest. The
fix ensures that when the TestHandler processes a message, it first adds
the message to the executionTimes before calling cv.open(). This change
guarantees the correct order of operations and prevents potential
synchronization issues.
Test: TH
Bug: 403413950
Flag: EXEMPT bugfix
Change-Id: I16dee5475db315b1b40d0779db4ff31407bf54b5
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
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
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
When a terrible error occurs, this change ensures that it is both logged
using Log.wtf() and reported via a dedicated metric. This dual approach
provides comprehensive error information for debugging in dogfood
environments (Log.wtf()) and tracks the occurrence of these errors in
production (via metrics).
Test: TH
Change-Id: Ic376f3789ab0cc9b094e79301849492143ed777c
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
Introduced new helper methods to simplify common array operations:
* Concatenation: Combine multiple arrays into a single array.
* Prepend: Add elements to the beginning of an array.
* Append: Add elements to the end of an array.
Test: TH
Change-Id: I6d9e19d7152c2ae3e75c3d521b4ee994347c4d2e
* changes:
Introduce client-side rate limiting for TrafficStats APIs
Unit test for TrafficStats Rate Limit Cache
Add `putIfAbsent` method to LruCacheWithExpiry
Junyu Laiauthored and Gerrit Code Reviewcommited 2024-12-10 01:55:44 +00:00
This commit introduces a new `putIfAbsent` method to the
`LruCacheWithExpiry` class. The `putIfAbsent` method
creates a new entry if the key is absent or returning the
existing value if the key is already present. This addition
enhances the cache's functionality and flexibility.
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.net.module.util.LruCacheWithExpiryTest
Bug: 343260158
Change-Id: Iff03ce2b6c27fedd71510edaa6bd86885f6df122
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
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
Instead of reporting tryTest errors when the tryTest block throws,
report them in the cleanup block if no catch block has caught it.
This fixes a bug where tests that use tryTest/catch would collect
diagnostics in expected cases.
Test: atest
Change-Id: Ic53ae54f1945a2784becd50e5890fad8e7461474
Moved common handler thread check functions from MdnsUtils.java
to HandlerUtils.java within the staticlib to facilitate reuse by
both Connectivity and NetworkStack modules.
Test: TH
Change-Id: Id96f6558c32c44fbdf2d2ce3e57c14da0cbf3ed7
This CL adds the createGetLinkMessage() method at the
RtNetlinkLinkMessage class, that creates a link message to get the
information of a interface. The functionality is the same as
"ip link show $interface".
Bug: 364501824
Test: atest NetworkStaticLibTests
Change-Id: I87a120f488e5b6f7f24c663c68ba26835fa2157a
This CL mainly adds the createSetLinkNameMessage() method at the
RtNetlinkLinkMessage class, that creates a link message to rename the
network interface. The functionality is the same as
"ip link set $interface name NEW_NAME".
Bug: 364501824
Test: atest NetworkStaticLibTests
Change-Id: I6323bce1ece10f4437483214860d50cb7d29df8d
This CL mainly adds the createSetLinkStateMessage() method at the
RtNetlinkLinkMessage class, that creates a link message to set the
interface up or down. The functionality is the same as
"ip link set $interface up" or "ip link set $interface down".
Bug: 364501824
Test: atest NetworkStaticLibTests
Change-Id: Id9232851f6d9a7f99f857fd5b8d4eae506de2c7c
This CL marks all the fields of RtNetlinkLinkMessage class final. That
means once the instance is created, the instance is immutable.
Also, the CL adds a static create method that verifies the arguments,
and updates the nlmsg_len field of the header before creation.
Bug: 364501824
Test: atest NetworkStaticLibTests
Change-Id: I08af4a6e68df9aee8ae76d953fac5d81f0b02c84