When a query packet is truncated, the responder should defer
the generation of a response until all packets have been received
and processed. If an answer present in the query packet's answer
section also appears in the responder's response, and the
known-answer's TTL exceeds half of the original TTL, suppress
the corresponding response.
Bug: 312657709
Test: atest FrameworksNetTests NsdManagerTest
Passed DISTRIBUTED DUPLICATE SUPPRESSION and \
MULTIPLE QUESTIONS - DISTRIBUTED DUPLICATE SUPPRESSION \
test cases of BCT
Change-Id: I781cd813d46f7d0db267f3fe23a15a81ae319e51
A simple unit test for the SkDestroyListener::dump().
(The follow-up of aosp/2916465)
Bug: 306919485
Bug: 319348954
Test: atest FrameworksNetTests:android.net.connectivity.com.android.serv
er.net.SkDestroyListenerTest
Change-Id: Ica70b2b344ffb2df8047cd936e8edc583e636ceb
Not all SocketTypeClients are cleaned up when their corresponding
sockets are closed. This occurs because the active socket check
for each callback examines the socket from all callbacks, even
those scheduled for removal in later notifications. To fix this,
check the active socket from the current callback only.
Fix: 317461509
Test: atest FrameworksNetTests NsdManagerTest
Manually test with multiple discovery requests and
Wifi on/off.
Change-Id: I2f81bb8e75f2c038d5e9dc025b208dcc6b441112
Implement the TODO to assign priority to services based on an
overlayable configuration.
This changes the default priority from 0 to MAX_VALUE, as higher
priority values are less prioritized, so services not in the priority
list should have a high value. There is currently no user of the API
depending on the priority, so the change should not affect clients.
Test: atest
Change-Id: I3aae9b5fa7756de64c63974c192e4c96b632ce4e
When sockets are destroyed, the SkDestroyListener receives a
NETLINK_INET_DIAG message informing it to delete the socket cookie from
the BPF CookieTagMap. However, under unknown conditions, all 10,000
spaces on the map were still observed to be filled. SkDestroyListener
and its parent classes, NetlinkMonitor, and FdEventsReader will log
errors. But due to the time required to fill the 10,000 fields is long,
traces in the device log are likely to have been overwritten and cannot
be observed.
This commit enables dumpsys netstats to print the last 20 traces of the
SkDestroyListener. If the issue is caused by the SkDestroyListener,
this will help in obtaining further clues when the issue is reported
again.
Bug: 306919485
Bug: 319348954
Test: atest FrameworksNetTests:android.net.connectivity.com.android.serv
er.net.NetworkStatsServiceTest#testDumpSkDestroyListenerLogs
Test: manually add mLog.e(...) in
SkDestroyListener#processNetlinkMessage and check dumpsys netstats
Change-Id: I5bbfe07e05cf959f809f28a7633ee5f99e29f641
Applies multicast routing configs when they are updated in
LocalNetworkConfig, or when local network/upstream network
status changes.
Bug: 281217735
Test: atest CSLocalAgentTests
Change-Id: Ib1c43c645a367d0f91e5cf0a0d9f8e5883be2c40
Added support to apply multicast routing config between network
interfaces in MulticastRoutingCoordinatorService.
Bug: 281217735
Test: atest FrameworksNetTests:android.net.connectivity.com.android.server.connectivity.MulticastRoutingCoordinatorServiceTest
Change-Id: If608b79d4e62a20d2e01755a83a901f6e274d9a2
The original patch (aosp/2891011) incorrectly counted TCP
sockets with keepalive enabled for VPNs. This issue was
caused by the UID range verification. On bypassable VPNs,
the socket mark is always correct. It's possible for an
app that is not in the UID ranges to establish a socket
on the VPN. But that socket should be counted for the
purposes of keepalive. The old code would correctly count
it and the new code will incorrectly not count it. Also,
the UID range verification does not help on non-bypassable
VPNs since the socket mark is always the mark of default
network, not the socket mark of the VPN.
Instead of reverting the entire patch, this commit
removes the UID range mechanism. The code refactoring from
the original commit (which used structured classes to read
socket information) has been kept as it is a valuable
improvement.
Bug: 320842519
Test: atest FrameworksNetTests
Change-Id: I00731796144c982b9fd4d9771f3d0db1f1529a89
Bug: 319532485
Test: Verified the return value on husky(64-bit kernel)
and mokey_go32 (32-bit kernel)
Test: NetworkUtilsTest#testIsKernel64Bit
Change-Id: I929ce23932698b44a72ce4f35e2bd5a41ba472ee
Fix current leaks in CSTest related tests, which leaked the
ConnectivityService and AlarmManager handler threads, and enable
the checks.
Using @DevSdkIgnoreRunner.MonitorThreadLeak ensures that tests properly
cleanup threads (in particular handler threads), as many leaked threads
could affect other tests.
Fix: 308520131
Test: atest ConnectivityCoverageTests
Change-Id: Ia6fb2c97f7a1740bafc0ab549440fdbeb1d5fad6
Instead of (wrongly) looking at the DNS message flags for the Query
Unicast bit, look at the flag in the question record.
The previous bug means that all queries would be replied multicast
instead of sometimes unicast. The fix is flagged off as this is a
behavior change that may affect performance and latency.
Bug: 289482497
Test: atest
Change-Id: I08e30c4ffa747c9073d631e8addca1278ea40648
MulticastPacketReader uses an InetSocketAddress as a buffer that gets
filled for each incoming packet for the source address. Similarly to the
receive buffer, it should not be used outside of the handlePacket
method, as it will be modified on the handler thread when further
packets are received.
Fix the current usage in MdnsInterfaceAdvertiser/MdnsRecordRepository.
Fortunately due to a bug packets are never replied unicast, so today the
MdnsRecordRepository code using the source address never triggers, even
though it may be circulating an incorrect source address instance that
changes over time.
Test: atest
Change-Id: I4cadfa6e54d1b37d9a6b0f8ca0269193a229bc51
Fix current leaks in ConnectivityServiceIntegrationTest, which leaked
the ConnectivityService and CarrierPrivilegeAuthenticator handler
threads, and enable the checks.
Using @DevSdkIgnoreRunner.MonitorThreadLeak ensures that tests properly
cleanup threads (in particular handler threads), as many leaked threads
could affect other tests.
Bug: 310659032
Test: atest --rerun-until-failure 20
Change-Id: Ia62d33d86217fef1d03532bb51c890a90430a70e
ConnectivityServiceTest creates hundreds of NetworkAgentWrapper, without
stopping their HandlerThread. This leaks a lot of threads while tests
are running.
Ensure the threads are stopped in ConnectivityServiceTest, and
integration tests that also use NetworkAgentWrapper.
Test: atest, watch adb shell ps -T [test package pid]
Bug: 310659032
Change-Id: I34f367b2efe3d05e1db5eab4c9fd93ee79c1b683
This change includes:
1. Refactor the logic in Tethering#dump into utils class.
2. Move the utils class to a common place which could be referenced
from other sub-modules.
3. Add @MonitorThreadLeak annotation to enforce
there is no thread leak problem.
Test: atest FrameworksNetTests NetworkStaticLibTests
Test: atest ConnectivityCoverageTests:com.android.networkstack.tethering.TetheringTest#testDumpTetheringLog
Test: adb shell dumpsys tethering (with hardcoded exception)
Fix: 312669345
Change-Id: Ia6fdfeeec2110afa0ec9e056e9db3843748845c3
This reverts commit e3245081b1.
Reason for revert: The change is unsafe as it introduces code with writings to a separate thread whose message queue size is unlimited.
Test: atest FrameworksNetTests
Change-Id: I392a30f77cfbcd17f420e29f0944604fd789b10a
NsdService switched from Netd native solution to Java solution on
Android U. MDNS service provided by Netd will be removed from Android V.
1. Stop registering native mdns service from V.
2. Stop startDaemon() in NsdManager from V.
3. As a double safety, return early in NsdService methods that call the
native mdns service when platform version is V+.
4. Modify NsdManagerTest to cover V+ behavior.
Bug: 298594687
Test: Build. Presubmit.
Change-Id: Ifdac8f7a44aa57d93d453ba482ec473a2b531452
Log.wtf should avoid crashes, while making sure that one can still
notice if there is a problem.
In particular, it may be possible that calling ensureIpServerStopped
and ensureIpServerStarted could start forwarding before the previous
IpServer has stopped it.
Bug: 314260975
Change-Id: I047a673d2fe6f218192d3144fa0bd60ce8739a15
Test: TH
Existing MdnsRecordRepositiry#getReply will send a NSEC RR in the reply
when 1) a query for a unique RR is not found or 2) any unique name which is
included in the answer sections. The second one is not aligned with the
spec:
```
On receipt of a question for a particular name, rrtype, and rrclass,
for which a responder does have one or more unique answers, the
responder MAY also include an NSEC record in the Additional Record
Section indicating the nonexistence of other rrtypes for that name
and rrclass.
```
This commit fixes the issue in 2) by checking that all unique records of
the name are included in the answers before adding a NSEC record.
Bug: 265095929
Test: atest FrameworksNetTests
Change-Id: I0531fbccf98e69a50bb8a45e529caaed3ad80b59
FastDataInput for reading persistent data is currently disabled
by default. This functionality will be gradually enabled through
A/B experiments to assess its impact.
One-shot boot time increase up to 10 second is one expected
outcome in worst case. Currently, the persistent data was loaded
when the first caller query it, but in this change it will be
done twice in the boot stage due to the needs of doing comparison.
Test: adb shell dumpsys netstats
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.net.NetworkStatsServiceTest
Test: manual test against data points under benchmark/assets/dataset
Bug: 313841499
Change-Id: Ia927bd115de5453ca3ee22104f3efbf44a55c2b8
This commit optimizes the mechanism to examine the TCP sockets
based on the VPN UID range.
The automaticOnOffKeepalives will be paused/resumed by checking
the TCP sockets status on the VPN network. The existing design
considers all UIDs, not the UID ranges for the specific VPN
network. This may lead to an inaccurate judgement to not to
stop the keepalive even when there is no socket on the VPN
network.
This commit is also a part of follow-up work from aosp/2354202
to use structized class to parse the TCP sockets.
Bug: 311119352
Bug: 265877161
Test: atest FrameworksNetTests
Change-Id: I4a6b751cb904b9c18ed1df420cc880ea38022d6a
This commit builds upon CL aosp/2817455 by adding a new NsdManager API to
update registered services directly, eliminating the need for exit and
re-announcement messages. This preserves compatibility with existing
apps without requiring an API bump. If an app registers a service with
the same listener and NsdServiceInfo, it's treated as an update request.
Bug: 309372239
Test: TH
Change-Id: Ib84ddf0d92e757eaef225f3e32f5223bc50c8fd6
Yuyang Huangauthored and Remi NGUYEN VANcommited 2023-12-26 13:09:00 +09:00