aosp/3218864 fixed the crash when ranges are removed from a
destroyed network, but did not fix the case where the ranges are
added to a destroyed network.
This can happen if a multilayer request is filed when a network
has already been destroyed.
Fix: 368989698
Test: updated existing tests for this bug
Change-Id: I7184eaa01141f56b7ad774277c7dee03d5812298
Lorenzo Colitticommited 2024-10-22 11:41:21 +00:00
Move this utility method buildMdnsServiceInfoFromResponse from
MdnsServiceTypeClient to MdnsUtils so it can be used by other
classes.
Bug: 355421878
Test: atest FrameworksNetTests NsdManagerTest
Change-Id: I8ce1028de325da46f112a5ec58516453727151fe
The removeServices() is running on a different handler, which
might take some time to complete. Therefore, the verification
should include a timeout to wait longer and prevent test flake.
Bug: 367429622
Test: atest MdnsDiscoveryManagerTests#testRemoveServicesAfter\
SocketDestroyed --iteration
Change-Id: I79626bad680a62993c3e7d6b356acc10755257e3
The services in the cache are no longer useful after the network
is disconnected. Because either the Network object or the
interface index will change after the network is reconnected,
these cached services won't be used for any discovery/resolution/
service info callback requests. Therefore, these cached services
should be removed after the network is disconnected. Otherwise,
these useless cached services will occupy memory until the device
is rebooted.
In addition, the cached service may not be reliable after the
last listener is unregistered. Because the socket is
disconnected, the service type client won't receive any updates
for the services. Therefore, remove these cached services after
exceeding the keeping time.
Bug: 355421878
Test: atest FrameworksNetTests NsdManagerTest
Change-Id: I06ff320fec84f71dc2ed742c50fa46f25c284170
Rename TrafficStatsRateLimitCache related
variables to TrafficStatsServiceRateLimitCache.
This is needed since client side cache
would be added.
Test: TH
Bug: 343260158
Change-Id: I12ae977ce33cfb5815aa908d719543d5c8e46f11
Prepare for implementation of client side
TrafficStats rate limit cache.
1. Write Typeless versions of getIfaceStats,
getUidStats, getTotalStats in INetworkStatsService.aidl
that returns NetworkStats instead of Long.
This is needed because in follow-up changes,
the NetworkStats instead of indiviual numbers will
be stored as a cache entry
2. Move some utils from NetworkStatsService
to TrafficStats. This is needed because in the follow-up
changes, these utils would be both accessed by TrafficStats
and NetworkStatsService.
Test: CtsNetTestCases:android.net.cts.TrafficStatsTest
Test: CtsNetTestCases:android.net.cts.NetworkStatsBinderTest
Test: FrameworksNetIntegrationTests:com.android.server.net.\
integrationtests.NetworkStatsIntegrationTest
Test: FrameworksNetTests:android.net.connectivity.com.android.\
server.net.NetworkStatsServiceTest
Test: FrameworksNetTests:android.net.connectivity.\
android.net.TrafficStatsTest
Test: ConnectivityCoverageTests:android.net.connectivity.\
android.net.TrafficStatsTest
Bug: 343260158
Change-Id: Iace251e1495fd3b81e072526e92ca97cbc7246eb
This method can execute the task after the specified amount of
time elapses.
Bug: 355421878
Test: atest FrameworksNetTests NsdManagerTest
Change-Id: I9d749393bd5435cdba5072d48242cd0d17332b67
This is needed to cleanly flag on/off DDR and to ensure that
when it is flagged on, DnsResolver ignores the hardcoded list of
DoH providers and only uses DDR.
Bug: 240259333
Test: updated existing tests
Change-Id: I84c103a5a4d18294b6a4cc3301d0037d1a6673a4
Lorenzo Colitticommited 2024-08-23 18:23:42 +09:00
networkRemoveUidRangesParcel throws ServiceSpecificException if the
native network is already destroyed.
This can happen when
1) per-app default network request is satisfied by network1
2) unregisterAfterReplacement is called to the network1. This calls
netd.networkDestroy and network is removed from netd.
3) per-app default network request is removed. This calls
netd.networkRemoveUidRangesParcel but netd does not know about this
netid anymore.
This CL fixes this issue by skip calling networkRemoveUidRangesParcel if
the request satisfier is already destroyed.
Bug: 336961452
Bug: 357974842
Test: CSSatelliteNetworkTest
Change-Id: Id775cca6fffd03545f1c4bc5016d0de4813f17df
A service record exists in the cache, and a query transmission
with a long duration has been scheduled because the service
information was recently updated. However, the query will be sent
immediately if a new discovery/resolution/service info callback
listener is registered. Therefore, to reduce unnecessary queries
in aggressive query mode, if a service exists in the cache, the
query timing should either reuse the scheduled run or use a
backoff time if there is no scheduled run.
Fix: 345146854
Test: atest FrameworksNetTests NsdManagerTest
Change-Id: I3335a0f6e0018526a8677dfbfbf053dd0dc906e5
Add unit test to test feature
BROADCAST_NETWORK_STATS_UPDATED_RATE_LIMIT_ENABLED_FLAG.
When feature is on, broadcast message should be delivered
with the designated interval(b/343844995),
When feature is off, each message should be delivered
regardless of previous intent.
Test: atest FrameworksNetTests:android.net.connectivity.com.android\
.server.net.NetworkStatsServiceTest\
#testNetworkStatsUpdatedIntentSpam_rateLimitOn
Test: atest FrameworksNetTests:android.net.connectivity.com.android\
.server.net.NetworkStatsServiceTest\
#testNetworkStatsUpdatedIntentSpam_rateLimitOff
Bug: 343844995
Change-Id: I4b89497c336a310c6959db579ca9ae3c572ff70c
OEM VPNs might need to receive packets to VPN address via
non-VPN interface.
Bug: 352424251
Test: CsIngressDiscardRuleTest
Change-Id: Ia9000bcbb5b3b9e1e0d396ba78946be36e2fc5ba
This method can remove all services that match the given
CacheKey.
Bug: 355421878
Test: atest FrameworksNetTests NsdManagerTest
Change-Id: I83e1a0cbdd4355d92510b5f9a550f96ef0154682
"Shrinked" should actually be "shrunk" or "shrunken"; in any case
"minimized" is simpler and possibly more accurate (it's the minimum size
required to hold the values).
Test: atest
Change-Id: If787d3f3d6e1046338d4e89ed924bce183e74bd6
To avoid filling the binder buffers, and sending unnecessary callbacks
when apps are unfrozen (for example successive LinkProperties changes or
onAvailable+onLost are not useful), queue and aggregate callbacks for
apps that are suspended.
Test: atest
Bug: 327038794
Bug: 279392981
Change-Id: I6de357ac2834f1f7e960dfbaa63adfc3825f2a82
Some legacy VPNs need to receive packets to VPN address via
non-VPN interface.
Bug: 352424251
Test: CsIngressDiscardRuleTest
Change-Id: Iad06dc69c5bf5ccda476e89ed9b0fc1bc63d2ebe
Obtained with:
prebuilts/ktlint/ktlint.py --format --no-verify-format --file FILE
--no-verify-format is used to ignore checks that are performed by ktfmt
(see ktlint.py).
Test: m
Change-Id: Ief2c146833e43492d0333b05f1c2b67bbfbc16e0
Empty TXT records should not be sent when advertising as per RFC 6763
6.1, although it also specifies that in case they are sent, they must be
treated the same as TXT records with an empty String.
Some recent discovery implementations seem to not be able to find
services that send empty TXT records; ensure MdnsAdvertiser sends TXT
records with an empty attribute instead.
Test: atest
Bug: 351250155
Change-Id: If928e5f7c371faa456535160f10880adb1449b92
This is a no-op refactor. Move some parameters from
QueryTaskConfig to QueryTask, or bring them from public methods.
Bug: 345146854
Test: atest FrameworksNetTests NsdManagerTest
Change-Id: I47d420842c4f9cec3fe25b5e2febc84a1e495f40
Moved common DNS label comparison functions from MdnsUtils.java to
DnsUtils.java within the staticlib to facilitate reuse by both
Connectivity and NetworkStack modules.
Test: TH
Change-Id: Ie839c5621d2c4b74e41987a0c6d1141d0d6e24f8
Add a flag to be used for an optimization to queue callbacks while apps
are frozen, instead of filling the binder buffer.
Bug: 327038794
Bug: 279392981
Test: atest
Change-Id: I6cc2507de88fae3d0866f9831e1e9026200297e4
The class will be used to build memory-efficient objects (int arrays)
used to queue ConnectivityService callbacks while an app is frozen.
This is very similar to an ArrayList<Pair<Short, Short>>, but avoids
object boxing which would use a lot more memory.
This is intended to be used by ConnectivityService both as a builder,
and as a utility to read lists of callbacks that it stores. Long-lived
references to the CallbackQueue would not be kept to minimize memory
usage; only the array returned by toArray needs to be stored.
Test: atest
Bug: 327038794
Bug: 279392981
Change-Id: I187ea15d14dfd160e577e9e9e87b1aded27b1938
- This CL puts RoutingCoordinator into staticlibs to make it usable by
both Tethering and ConnectivityService on R.
- This CL also changes the return type of
ConnectivityInternalApi#getRoutingCoordinatorManager() to IBinder so
it has fewer dependencies.
Bug: 350699020
Test: CI
Change-Id: Iba096e940795cd33e61c5141721394ad39e5ce6d
Instead of printing the flags as hex, use flag names for known flags.
Bug: 327038794
Bug: 279392981
Test: atest
Change-Id: I11ba4de1e8e60d5468a72b275cd724be669b32bc
Address review comment on aosp/3027487
This CL also adds test for enforceMeteredApnPolicy
Test: CSBlockedReasonsTest
Bug: 344800107
Change-Id: Ib531bf5b34566fc91fec9f977c5257b332189706
The MdnsSocketclient#sendMdnsPacket() uses the address of the
first packet only. Since there's no guarantee that all packets
have the same address, skip sending packets if any have a
different address.
Fix: 335125073
Test: atest FrameworksNetTests NsdManagerTest
Change-Id: Ief0fd81eacf46b33bb2e8c0fcc4da7981ac2972d
Most users of NetworkCallback do not override all methods, so callbacks
from ConnectivityService end up being unused by the app.
To save resources, check which callback methods are overridden in
ConnectivityManager, and inform ConnectivityService so it can skip
preparing and sending the corresponding binder calls when the callback
is not used by the app.
This is flagged off by default.
Test: flag enabled: atest CtsNetTestCases ConnectivityCoverageTests
Bug: 327038794
Bug: 279392981
Change-Id: Iaf490f416fb6e1437d40497fba1a40a899a9f523
The check is_system_uid should mirror the definition of core_uids in
UserHandle.isCore until it is available to be read from mainline code.
isUidNetworkingBlocked should also do the same.
Test: All existing tests should pass.
Test: atest CtsHostsideNetworkPolicyTests
Test: atest FrameworksNetTests
Bug: 348316140
Change-Id: Id5e01289b301a725b162ef249062e0f2806876dc