There are multiple independent reasons a keepalive can stop. Some
are software (e.g. the app stops the keepalive) and some are hardware
(e.g. the SIM card gets removed). Therefore, there is a very low
probability that both of these happen at the same time, which would
result in the first stop attempt returning SUCCESS and the second
stop attempt returning NO_SUCH_SLOT. Such a race condition can be
ignored with a log, not to crash the system. Change to wtf log so
that the issue could still be visible since this implies possible
bugs in the system.
Also update the javadoc for SocketKeepalive.ERROR_NO_SUCH_SLOT.
Bug: 281484381
Test: atest FrameworksNetTests
Change-Id: I316a2193fc7302b04e074ff0b03dc43946fe5ce6
To do this we register a UidFrozenStateChangedCallback with
ActivityManager. The callback then queues up work on the Handler thread
to consume the original callback args and kill appropriate sockets.
Test: atest ConnectivityServiceTests
Bug: 277100090
Change-Id: I93f174811aef726145a18ea90443ddfc1456478e
Currently, native networks for non-VPN networks are created only
when the NetworkAgent goes into the CONNECTED state. This is not
ideal, because until the network is connected:
- Nothing routes to the network, so no IP packets can be sent on
it (except via packet sockets).
- Many network configuration changes (e.g., routes and DNS
servers) fail to apply because the network does not exist yet.
These cause ENONET errors in the logs.
Fix this starting in U by creating the native network as soon as
the agent registers. This should not impact apps because
NetworkCallbacks are not sent until networks are connected.
Bug: 143158421
Test: new coverage in NetworkAgentTest
Change-Id: I26bfa8630c085422175558645c47a6c64be96ae6
Lorenzo Colitticommited 2023-05-10 20:01:07 +09:00
This is not a substantially new test, as VTS has already required
either reno or cubic, and reno is ancient and obsolete (and was
only ever included because it's builtin to the kernel), so in
practice everything should have already always been using cubic.
Bug: 281477097
Test: TreeHugger, atest ProcNetTest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I04622ae37265361f648bbcf46c0a10e22be3b24f
Maciej Żenczykowskicommited 2023-05-09 18:16:52 +00:00
If the network is null in MdnsServiceTypeClient, it should use
MdnsSocketClient for single socket only. So it's expected to
process any response from only the socket (network).
Move the stopDiscovery outside the listener check loop.
Because the stop should only be called once.
Add a test to verify the response processing with a non-null
network MdnsServiceTypeClient
Bug: 265787401
Test: atest FrameworksNetTests
Change-Id: I76965302037f050e0ac3b2cfdbaa5a855e2283c7
CtsNetUtils#connectToCell can fail if the device does not have a cell
network available in which case the allow bad wifi setting was not reset.
Test: TH
Change-Id: I2dc20c8982a427379f94a4b92774e149a78628d5
As per RFC 1034/1035, the max size of the label is 63 bytes. It should
also be guaranteed when the serviceName is renamed due to the conflict.
Bug: 265865456
Test: atest FrameworksNetTests
Change-Id: I077d8abdb91071db62b9618d9918e3a12682aaf4
For a template with MATCH_TEST, since the wifi network key is
just a placeholder to identify a specific test network, it is
not related to track user location. Hence the check is not
really needed.
Test: 1. atest NetworkStatsIntegrationTest with use location turned off
2. atest FrameworksNetTests:android.net.connectivity.com.android.server.net.NetworkStatsServiceTest
Fix: 280686048
Change-Id: Ic128cfbbb2d03c427c9030c99bf205eb65a33e58
This includes:
1. Specify a read timeout: At present, the test only specifies
a connect timeout and terminates if the timeout is exceeded.
However, if the connection takes a long time to establish,
there may be very little time left for the test to perform
a read operation.
2. Read only the initial bytes: Since the exact amount of data
is not important for the test, it is preferable to read only
a small amount of data at the beginning rather than reading
the entire content.
Test: atest CtsNetTestCases:android.net.cts.NetworkStatsManagerTest \
--rerun-until-failure 100
Fix: 274835045
Change-Id: If53a8db7ab6c5df462757d80b563de89531c3c3f
BpfNetMaps needs to go through netd before T and must *never* use the
JNI methods. BpfNetMaps already throws if this code path is called
before T.
Test: TH
Change-Id: I5f69c3673cfe86ef02f9b8e35a1db63f39c3da7e
ConntrackSocketTest#testIpv4ConntrackSocket always fail in cuttlefish
because it gets NullPointerException when accessing tupleOrig in
ConntrackMessage. tupleOrig can be null if it doesn't have source IP.
This situation happens when dumping the following conntrack entry:
vsoc_x86_64:/ # cat /proc/net/nf_conntrack
ipv4 2 unknown 2 570 src=0.0.0.0 dst=224.0.0.22 [UNREPLIED] \
src=224.0.0.22 dst=0.0.0.0 mark=0 secctx=u:object_r:unlabeled:s0 use=2
Bug: 280203901
Test: atest TetheringPrivilegedTests (on cuttlefish)
Change-Id: Iddc8cb390a4369190d535f4694e0e5fa4b6e590f
This will fail 'boot_test_rvc_pixel5' due to the pixel 5
RVC image's 4.19 kernel failing U VTS (and indeed likely
even earlier and other xTS tests as well),
due to not including:
https://android-review.git.corp.google.com/c/kernel/common/+/1881533
UPSTREAM: security: selinux: allow per-file labeling for bpffs
Additionally expecting us to support 4 OS upgrades (R->S->T->U->V)
is simply unreasonable.
Bug: 258879079
Bug: 280411222
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I8f5009e772a0efbb0401ad466c0405e53a172ce6
Maciej Żenczykowskicommited 2023-05-02 11:48:17 +00:00
Some tests flake because the previous test networks are
still registered. It's not very clear how this can happen
considering `tearDown` is waiting for each agent to be
torn down, but logs suggest that the array of agents may
not contain all agents at `tearDown` time, and `tearDown`
does not run on the same thread as the test. It's hard
to imagine that there isn't a memory barrier between the
end of the test and the start of `tearDown`, but that's
the only hypothesis at this point.
Also add logs that will help diagnose further in case
the (admittedly hard to believe) hypothesis is wrong.
Fixes: 280035560
Test: ran a few hundred times without failures, though
I can't repro even without this change anyway
Change-Id: I620df32c43c855ca882e2e21201fe5b23b71a65a
The tests do not need to run on devices where the module is not updated
or updatable.
Tests that are not in presubmit were missed when annotating keepalive
tests in a previous change.
Change-Id: I11ef44987b5a9cbcdf5b892807f65c4f9d04812f
Test: atest
Fixes: 280131407
Add ping test with full MTU size and minimal IPv6 MTU size probes.
This helps to diagnose possible MTU issue in the bugreport.
Bug: 277376698
Test: adb shell dumpsys connectivity --diag
Change-Id: I0650de1f07fadcac189a40817bcc1a70be2e2b6c
It is just a constant source of bugs, with no real tests,
let's stop pretending this is a supported configuration.
The only tested configuration is out-of-process tethering
updatable apex.
Test: TreeHugger
Bug: 279942846
Change-Id: I4b659a3cd32b89a65549b56006b926a5ac755f7b
Maciej Żenczykowskicommited 2023-04-28 20:11:14 +00:00
From service-connectivity, NAMESPACE_TETHERING must be used, as
NAMESPACE_CONNECTIVITY is used for the NetworkStack module. Also the
isFeatureEnabled with module name must be used, otherwise the "android"
package version is queried instead of the tethering module version.
BpfNetMaps is using flag value 1 to workaround this issue.
flags in NsdService, AutomaticOnOffKeepaliveTracker, and ConnectivityFlags
were not pushed currently.
So, this change has no effect to devices.
Bug: 279108992
Test: TH
Change-Id: I2b4b6a13c048c20beef52b1f43b9e21aca0c637a
Address a TODO in TetheringConfiguration to use a dependency object
instead of static mocking on DeviceConfig.
This avoids TetheringConfiguration dependencies on internal
implementation of DeviceConfigUtils, unblocking changes in
DeviceConfigUtils.
Bug: 279108992
Test: atest TetheringTests
Change-Id: I252eaadff85fa47b894e989b4f2527b00c5dca56
Remi NGUYEN VANauthored and Motomu Utsumicommited 2023-04-28 19:18:43 +09:00
De-duplicate the code by using
DeviceConfigUtils.getConnectivityResourcesPackageName.
Bug: 279108992
Test: atest
Change-Id: I54733016a9b902d5c209010161363c41bc8f1cce
Remi NGUYEN VANauthored and Motomu Utsumicommited 2023-04-28 19:18:43 +09:00
The ConnectivityResources class is only usable with QUERY_ALL_PACKAGES
permission, so it is not generally usable in framework-connectivity. It
is also backed by the ServiceConnectivityResources APK, which is
intended as resources for service-connectivity.
Move the class to service-connectivity and update callers. CTS needs a
way to determine the supported keepalive count as it used the
resources from KeepaliveUtils as @hide API, so provide a
ConnectivityManager @hide API for testing.
Bug: 279108992
Test: atest
Change-Id: I3c9a77c580b5ab87c922c32778bce15dc33b4d1d
Remi NGUYEN VANauthored and Motomu Utsumicommited 2023-04-28 19:18:39 +09:00
ICMP test does not support larger size probing currently. This
is a preliminary commit to support length parameter to config ICMP
packets size for the subsequent commit.
Bug: 277376698
Test: adb shell dumpsys connectivity --diag
Change-Id: Idf90ad716327f889630b943f8fb3452fc5bf5cfc