Bug:419554480
This is not used in platform code. This code path is only used when the
mDNS stack is used as a library.
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: I94d3c8a8bacf8581f44760d41afba830cdd09252
Diego Valenzuelacommited 2025-06-02 12:31:06 -07:00
Use skb->gso_segs to calculate the number of segments.
This removes the need to estimate the segment count on our own.
This will improve the accuracy of the accounting.
Bug: 263884894
Flag: EXEMPT mainline
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ibc7da2fcd968d6871fca32527cd8c6d694d77452
Maciej Żenczykowskicommited 2025-06-02 07:49:34 -07:00
The previous implementation used a fixed start timestamp for
querying network usage statistics, initialized based on the
device's boot time. This caused the query window to grow
indefinitely as the device uptime increased, leading to
inefficient queries that fetched and processed a large
ever-expanding amount of historical data.
This change refactors the logic to use a rolling start
timestamp. The `mStartTime` is now updated after each
usage report is generated (in `onLost`). By resetting
the start time to a more recent point (current time
minus one bucket duration), we ensure that subsequent
queries for usage snapshots are performed over a small,
manageable time window.
This optimization prevents fetching excessive data
from the NetworkStatsManager, improving the efficiency
of the metrics collector. Dependencies for time and
duration have also been abstracted for better testability.
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.metrics.SatelliteCoarseUsageMetricsCollectorTest \
--update-device
Flag: EXEMPT controlled with kill switch
Bug: 419123367
Change-Id: I49d3b044f0a038093060f5541ea263d2d0d253a2
* changes:
Destroy sockets lacking permission at CS.
Destroy sockets with nlmsg RTM_DELADDR
Destroy sockets with NetworkAgent update event
Add a Map to NetworkAgent list for IP address
Add socket destroying methods to InetDiagMessage.
Sewook Seoauthored and Android (Google) Code Reviewcommited 2025-05-30 16:00:11 -07:00
The failure is caused by a RA packet read race condition. The test
receives a callback that local-only tethering has started and
immediately begins listening for an RA. However, the system's RA daemon
may not have finished initializing.
The test's packet reader times out waiting for an RA and returns a null
packet. The waitForRouterAdvertisement then uses the null packet
checking for RA, causing NPE. Change modifies waitForRouterAdvertisement
to check if a packet is null before processing it.
Flag: EXEMPT bugfix
Bug: 418010532
Test: atest android.net.EthernetTetheringTest#testLocalOnlyTethering
Change-Id: Ic534c53766958ae48a82687a9bd6d09297f074f2
setInterfaceUpState does not need to be in the try / catch block as it
doesn't let any exceptions escape. Also move the call to after checking
whether the returned config is null. In practice, this should never
happen; but if it did, we wouldn't end up doing anything anyways, so
bringing up the interface is pointless.
This also annotates config as final and returns early out of the catch
block (because the second log statement is technically incorrect).
Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: Ic9233784594ead6779caf6267afad7b518a873ea
Figuring out whether an interface is a USB NCM interface requires
calling the ethtool API. In order to ensure the interface does not
change underneath us, it must use the ifindex rather than the interface
name.
This change starts populating EthernetPort, a tuple containing interface
name, MacAddress, and index, using the information received from
rtnetlink.
Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: I3c90bf844304f710ebf0a629d66ebcb487e144e7
In preparation for tracking USB NCM interfaces independent of whether
they were included as part of the regex.
Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: I3d1f08aac20d613db9e845044b11b9484ddba2ed
Onboarding repo to go/alint, which will run ayeaye analyzers locally.
Bug: 419241911
Test: Locally
Flag: NONE, repo change
Change-Id: I78b938222ac73f00438692045e4c062cb5356029
Destroy sockets that matched to netId less than MIN_NET_ID for the non
link local address in RTM_DELADDR.
Destroy sockets on link local address with the corresponding interface
ID.
Bug: 373280981
Bug: 331139818
Flag: android.net.platform.flags.connectivity_service_destroy_socket
Test: atest ConnectivityCoverageTests
Test: device test
Change-Id: I4d8127fc693f8b32f815c5cddbae0b64deeb23e5
Destroy platform managed sockets on the removed IP address based on NetworkAgent update.
Bug: 373280981
Bug: 331139818
Flag: android.net.platform.flags.connectivity_service_destroy_socket
Test: atest ConnectivityCoverageTests
Test: device test
Change-Id: I6a1d2d0c25c130c2747d66bee203b0408e2fa0da
Programs of type raw_tp need the input to be passed in the ctx
instead of the data.
Test: with ag/33648187
Change-Id: I79ac0126d91c9eafd847a0c8709a47a0113a9430
Prep work to allow 5.4+ specific implementation.
Bug: 419747540
Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I8aa40b3e2c068e39b34bff3d8c58cc8feccbf139
Maciej Żenczykowskicommited 2025-05-29 08:50:50 -07:00
The full implementations are targeted for 5.10 kernels (S+), not 5.8.
Let's update the names to reflect that.
Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I2694c55183e5634dec9d752286728b4070178440
Maciej Żenczykowskicommited 2025-05-29 08:06:45 -07:00
(shot in the dark)
checking attr.info.info_len in line 265 could probably be optimized out if we pass by const reference, since one could assume it is still sizeof(info).
Bug: 414570528
Flag: EXEMPT mainline
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I1e5ba472042ecce0260f2e3b60a0a88095734f8d
Maciej Żenczykowskicommited 2025-05-29 02:43:55 -07:00
We sometimes see issues when trying to load BPF maps, it's helpful to know
what errno was set.
Bug: 414570528
Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I8b78ee17ebad076d073d50bfd0f01440fe7187a2
Maciej Żenczykowskicommited 2025-05-29 01:25:26 -07:00
Depending on how the DAD timers align, there could be 1 or 2
onLinkPropertiesChanged callbacks. Furthermore, depending on how the
dice fall, NO_CALLBACK_TIMEOUT is too short (500ms) to account for this.
This CL changes the expectation from expect<Lost> to
eventuallyExpect<Lost> to skip over any onLinkPropertiesChanged
callbacks that might have been received.
Test: atest EthernetManagerTest#testUpdateConfiguration_forAllowedUids
Flag: EXEMPT mainline
Bug: 420648099
Change-Id: Ifa853accdfca2c00de4d7211badc75ae057d948f