Commit Graph

66134 Commits

Author SHA1 Message Date
Aaron Huang
827dbd9277 Merge "Rename expect* methods that are used in NetworkStatsServiceTest" 2022-08-26 14:18:43 +00:00
Nucca Chen
d046f81ee2 Merge "TetheringTester: Extend PACKET_READ_TIMEOUT_MS from 100ms to 500ms" 2022-08-26 10:54:34 +00:00
Hungming Chen
008adcd004 TetheringTester: Extend PACKET_READ_TIMEOUT_MS from 100ms to 500ms
No DHCPACK received in DHCP process. Because previous DISCOVER/OFFER
steps have done, it implies that DHCP server is launched and
client/server can transmit data to each other. Assume that DHCP server
can reply DHCPACK and CF may need more than 100ms.

Extend the timeout from 100ms to 500ms. Monitor if receiving DHCPACK
timeout is found.

Bug: 243314243
Test: atest EthernetTetheringTest
Change-Id: Id8bb0e03ae1e853beb6242a1c35b977ace9ca190
2022-08-26 16:52:29 +08:00
Remi NGUYEN VAN
27676e146e Merge "Run R8 with necessary Tethering classpath classes" 2022-08-26 07:26:57 +00:00
Mark
f8371fef0f Fix EthernetTetheringTest flaky
The tracking interface of EthernetTracker(mTetheringInterface) is
stopped to track only when it is removed. There is race condition in
EthernetTetheringTest that the new test start ethernet tethering with
previous test interface name because EthernetTracker still tracking
previous test interface.
Destroy test interface then listen untether callback without calling
stopTethering. If EthernetTracker stop tracking test interface, it would
call onUnavailable callback to stop tethering. So the test can check
whether tethering is stopped to ensure the test interface is not tracked
anymore before test finish.

Bug: 191826409
Bug: 243222655
Test: atest TetheringIntegrationTests

Change-Id: I618983d981cd3a707dcb7723cdbb20ba5bf8bd2e
2022-08-26 14:10:54 +08:00
Motomu Utsumi
9785a681d7 Merge "Add wtf log for the case that should not happen" 2022-08-26 01:33:01 +00:00
Motomu Utsumi
7631d15ff8 Merge "Convert int array to Integer Set without stream" 2022-08-26 01:32:17 +00:00
Patrick Rohr
02a58cf292 Merge changes I1239e797,I4b1d3e25,Iefccc931,I122dc886,I1650bbc2
* changes:
  ethernet: disable ipv6 provisioning delays
  ethernet: improve test failure readability
  ethernet: wait for the interface listener to be registered
  ethernet: read running flag before bringing up interface
  ethernet: remove buggy test expectations for compatibility
2022-08-25 22:26:03 +00:00
Patrick Rohr
c6ff4de7e0 ethernet: disable ipv6 provisioning delays
Disabling RS delay and DAD speeds up tests and makes them more reliable.

Test: atest EthernetManagerTest
Change-Id: I1239e7974e9b62be4f43f009a24d752c51371270
2022-08-25 12:27:23 -07:00
Patrick Rohr
5d3eef2733 ethernet: improve test failure readability
Test: atest EthernetManagerTest
Change-Id: I4b1d3e25d9e902d2292c3661f1be85ea7fc47777
2022-08-25 12:08:50 -07:00
Patrick Rohr
ef61c582f5 ethernet: wait for the interface listener to be registered
If an interface is created before the interface state listener is
registered with the ethernet service, callbacks can get missed.
Specifically, createInterface() expects a down before an up callback. If
the listener registration executes after the event, the listener only
receives the final state event (up in this case).

This was a common source of flakiness in the EthernetManagerTests.

Test: EthernetManagerTest
Change-Id: Iefccc9318a9ea2f929d34a52b7b275bf7a23f443
2022-08-25 12:08:32 -07:00
Remi NGUYEN VAN
0bd90f10b9 Use conventional args style for gen_jarjar
gen_jarjar supported multi-valued arguments via space-separated lists,
like "--apistubs foo bar". This is unusual, as "bar" would generally be
interpreted as a positional argument instead.

Change the usage to "--apistubs foo --apistubs bar", which is more
conventional. Also remove the "--jars" switch to have the jars be
positional arguments instead, and change the "--unsupportedapi"
arguments to be a column-separated list (like java classpath), instead
of space-separated. For --unsupportedapi, this allows providing a list
of files via minimal modifications in the genrule usage.

Test: m
Change-Id: Id67ad16de2ea6682fee402540f464ed3b5b0cca9
2022-08-25 06:42:54 +00:00
Junyu Lai
ec2b24784f [ST02.2] Use the getters of DnsHeader
Bug: 139774492
Test: atest DnsPacketTest DnsResolverTest
Change-Id: Ib5616c65cce9668e7c6a00571c34ece7b4d8ab39
2022-08-25 14:06:30 +08:00
Lucas Lin
e87c1e0187 Merge "Revert "Test if VPN app can grant ACTIVATE_PLATFORM_VPN with CON..."" 2022-08-25 05:41:01 +00:00
Junyu Lai
822ab28a9b [ST02.1] Add TYPE_CNAME constant to DnsResolver
This would be needed for subsequent patches that synthesizing DNS
packets for testing purpose.

Bug: 139774492
Test: atest DnsPacketTest DnsResolverTest
Change-Id: I5e58f99b09b693f167178e56f008be8b42d9417a
2022-08-25 11:11:52 +08:00
Patrick Rohr
f360e458fc ethernet: read running flag before bringing up interface
Previously, the "running" flag was checked right after calling
setInterfaceUp(), which caused an updateInterfaceState(UP) event to be
generated at the end of addInterface(). This "artificial" link up
notification is only needed for interfaces that already had link before
being added (as in this case, no RTM_NEWLINK callbacks are received, and
link state needs to "manually" be set to UP to start configuring the
interface). This could happen when system server crashes and gets
restarted, or when ethernet is temporarily disabled via the
EthernetManager API.

Reading the running flag before bringing up the interface ensures the
updateInterfaceState(UP) event is not generated for interfaces that were
just brought up.
This fix gets rid of the up/up/down/up callback when a new interface is
added.

Test: atest EthernetManagerTest
Change-Id: I122dc886a94222c575f44182b943e64b435c03e8
2022-08-24 13:14:33 -07:00
Patrick Rohr
8b983158dc ethernet: remove buggy test expectations for compatibility
EthernetManagerTest#testCallbacks() should not enforce up/up/down/up
callbacks, so this bug can be fixed in mainline without breaking CTS13.

Test: atest EthernetManagerTest
Change-Id: I1650bbc2a5883a874b92ecf2bcc7a56d01f4a905
2022-08-24 12:36:28 -07:00
Patrick Rohr
62f8f6d0fb Merge "ethernet: skip tests on devices without support" 2022-08-24 19:33:17 +00:00
Patrick Rohr
734e357556 Merge "ethernet: assert updateConfiguration result" 2022-08-24 19:31:57 +00:00
Patrick Rohr
f37e7c645b Merge changes Id6ae7929,I70474ef5,I4958df65,Ifc0e1ba2
* changes:
  ethernet: remove callback from factory updateInterfaceLinkState
  ethernet: updateConfiguration result should not rely on ip provisioning
  ethernet: remove callback boilerplate from EthernetNetworkFactory
  ethernet: add EthernetCallback class to wrap OutcomeReceiver
2022-08-24 17:45:04 +00:00
Motomu Utsumi
73599a5f5d Use IBpfMap type instead of BpfMap type
Currently, production code uses BpfMap type and TestBpfMap extends
BpfMap but this makes it diffcult to test because TestBpfMap loads the
JNI.

This CL updates to use IBpfMap type in the production code.
Upcoming CL updates TestBpfMap to implement IBpfMap instead of extending
BpfMap so that test can still use TestBpfMap but tests do not need to
load JNI.

Bug: 217624062
Test: atest BpfCoordinatorTest BpfNetMapsTest
Change-Id: Ie67e14bf5519fb4427474ecc0fda441877a9555f
2022-08-24 23:31:19 +09:00
Jean Chalard
38a01e080d Merge "Add tests for callback visibility" 2022-08-24 09:51:36 +00:00
Motomu Utsumi
8e420ead05 Add wtf log for the case that should not happen
Bug: 243314552
Test: atest BpfNetMapsTest
Change-Id: I8e97c8150d0f427b7b0ac26374322e36b013320a
2022-08-24 18:51:04 +09:00
Motomu Utsumi
1a477b0b33 Convert int array to Integer Set without stream
Address a review comment on aosp/2145584

Bug: 243314552
Test: atest BpfNetMapsTest
Change-Id: Id4cb96b59c88221ad5de32ce3b170ca82c48e6f2
2022-08-24 17:50:37 +09:00
Nucca Chen
b19c482980 Merge "EthernetTetheringTest: testTetherUdpV4Dns" 2022-08-24 08:30:56 +00:00
Lorenzo Colitti
275ee60963 Never satisfy requests with networks that aren't connected.
Currently, NetworkAgentInfo#satisfies determines whether a
network exists (and should satisfy requests) based on
|created|, not |everConnected|. This is theoretically incorrect
because networks in CONNECTING state or similar must never
satisfy requests or call callbacks.

This cannot happen for requests. New requests are only added to
networks by NetworkAgentInfo#addRequest, which is only called by
computeNetworkReassignment via updateSatisfiersForRematchRequest,
which skips any network with everConnected = false. It can
potentially happen to listens though.

Also, this cannot ever happen for physical networks, because for
physical networks, created is set at the same time as
everConnected, the first time they enter CONNECTED state.

In theory, this can happen for VPNs since ag/988402 , which
changed the code to create VPN networks as soon as they enter
CONNECTING state. That CL added the everConnected boolean to
NetworkAgentInfo but did not update the satisfies and
satisfiesImmutableCapabilitiesOf checks to use everConnected.
In practice, even for VPNs this is very unlikely, since VPNs
advance from CONNECTING to CONNECTED essentially immediately.
Even if they didn't, sending callbacks before they enter
CONNECTED state would be incorrect because the app receiving
the callback would have no way of knowing that the network is
actually not yet connected.

With this change, some checks for everConnected become spurious,
because a network with everConnected=false cannot satisfy either
requests or listens. Remove these checks.

Test: extensively tested by existing ConnectivityServiceTest
Change-Id: I024bb2b85bc57228d53e69a7707c7ce7ac756259
2022-08-24 15:34:44 +09:00
Paul Hu
f37dfa3a11 Merge "Add null check for clientInfo" 2022-08-24 03:54:49 +00:00
Motomu Utsumi
9988869442 Merge changes from topic "cookie_tag_map_raw_dump"
* changes:
  Add option to dump cookieTagMap in base64 format
  Use BpfDump#fromBase64EncodedString
2022-08-24 03:16:53 +00:00
Hungming Chen
a339588d62 EthernetTetheringTest: testTetherUdpV4Dns
Add a tethering IPv4 DNS test.

DNS query:
tethered device --> downstream --> dnsmasq forwarding --> upstream --> DNS server

DNS reply:
DNS server --> upstream --> dnsmasq forwarding --> downstream --> tethered device

Bug: 237369591
Test: atest EthernetTetheringTest
Change-Id: I2baa9d7ccf55d117f644c80e867fb8272f7daac5
2022-08-24 11:15:36 +08:00
Chiachang Wang
cbe38b46a2 Merge "Decouple VpnManagerService from ConnectivityServiceTest" 2022-08-24 03:05:24 +00:00
Xin Li
fd479a9d45 Merge "Merge android13-tests-dev" 2022-08-23 23:07:25 +00:00
Patrick Rohr
750036b286 ethernet: remove callback from factory updateInterfaceLinkState
updateInterfaceLinkState already returns true / false depending on the
success, so the EthernetCallback can be removed and sent from
EthernetTracker instead.

Test: atest EthernetManagerTest
Bug: 225317892
Change-Id: Id6ae7929097840ac5c9a4d244fdf669a06b94ed5
2022-08-23 13:07:57 -07:00
Treehugger Robot
6a8166cf5e Merge "Use PerUidCounter in the connectivity static library" 2022-08-23 18:25:03 +00:00
Patrick Rohr
ea5c6dd136 ethernet: updateConfiguration result should not rely on ip provisioning
In addition, the result should always be success if the new
configuration is stored. This allows updating interfaces that are not
currently registered with ethernet service.

Bug: 236312641
Test: atest EthernetManagerTest
Change-Id: I70474ef5f046c65a6f74161137e25debd8dfe612
2022-08-23 11:01:47 -07:00
Treehugger Robot
9b20b7d82f Merge "Fix ConnectivityManagerTest#testFactoryReset flaky" 2022-08-23 10:34:34 +00:00
Paul Hu
d71e43f4d8 Merge "Update nullness suppression bug number" 2022-08-23 09:53:53 +00:00
Paul Hu
309d68d997 Update nullness suppression bug number
The internal issue of nullness suppression for mdns files has
been addressed. Update the bug number to track AOSP only work.

Bug: 242631897
Test: m
Change-Id: I41c072a4313a9668fe509f796ba2956d74397e5c
2022-08-23 09:52:47 +00:00
Maciej Żenczykowski
4d0432a400 Merge changes I89d6fe9a,I10b19a01
* changes:
  DscpPolicyTest - add ip version asserts
  dscpPolicy.c - old/new_first_u32 is actually be32
2022-08-23 06:43:05 +00:00
Motomu Utsumi
405d676a08 Merge "Support java BpfMap in BpfNetMaps#swapActiveStatsMap" 2022-08-23 04:01:30 +00:00
Jean Chalard
595a98b352 Merge "Address comments on aosp/1781202" 2022-08-23 03:13:12 +00:00
Cole Faust
e8fa68b9a0 Merge "Fix array-related errorprone warnings" 2022-08-22 22:43:00 +00:00
Patrick Rohr
de40e137a1 ethernet: remove callback boilerplate from EthernetNetworkFactory
Now that everything uses EthernetCallback, there is no need for the
boilerplate code in EthernetNetworkFactory anymore.

The next step will be to pull the callbacks out of
EthernetNetworkFactory entirely.

Bug: 225317892
Test: atest EthernetNetworkFactory
Change-Id: I4958df658f7d5852660a5c03a8c9220532e42d3c
2022-08-22 12:11:04 -07:00
Patrick Rohr
251f2fcf13 ethernet: add EthernetCallback class to wrap OutcomeReceiver
The OutcomeReceiver that gets passed into the EthernetServiceImpl is
hard to use (it is nullable and both onError and onResult can throw
RemoteExceptions).

Note: This is an intermediary state.
The next step will be to completely tear EthernetCallback out of
EthernetNetworkFactory, which will remove a lot of boilerplate code.

Bug: 225317892
Test: atest EthernetManagerTest
Change-Id: Ifc0e1ba29ded933c418e4b335cb731c3496d7e44
2022-08-22 12:10:27 -07:00
Maciej Żenczykowski
231299065c DscpPolicyTest - add ip version asserts
Bug: 243314791
Test: TreeHugger, atest DscpPolicyTest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I89d6fe9ae54182ddf924178cf8e66d2c3a0529ef
2022-08-22 09:51:02 -07:00
Mark Chien
0d3c8b692d Merge "updateSupportedDownstreams when tethering allowed is changed" 2022-08-22 15:15:11 +00:00
Mark
b7ed4a2784 Fix ConnectivityManagerTest#testFactoryReset flaky
This change fixed two things:
1. start wifi tethering after airplane mode enabled.
2. run ConnectivityManager#factoryReset with TETHER_PRIVILEGED
   permission, so it can sucessfully stop tethering.

Orignally testFactoryReset don't actually test stop tethering.
Tethering already be stopped while airplane mode enabled, but
enable airplane mode then doing factory reset would have race in
wifi stack which caused airplane mode don't take effect in wifi
side.

Bug: 240677322
Test: atest ConnectivityManagerTest#testFactoryReset --iterations 50

Change-Id: I3185401b10b798af744df5c3c7c21fee3d418939
2022-08-22 15:13:31 +00:00
Paul Hu
3f08cc4485 Reduce the test flake on NsdManagerTest
- Enlarge the time out for waiting callback.
- Ensure the agent disconnected completely after running each
  test.

Test: atest android.net.cts.NsdManagerTest --iteration 100
Change-Id: Icb04641ad5e4cb826995b99679313b12e96e9879
2022-08-22 10:29:14 +00:00
Maciej Żenczykowski
242af39425 dscpPolicy.c - old/new_first_u32 is actually be32
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I10b19a010000f1f49c2a48448f413376045bfe1f
2022-08-22 09:12:26 +00:00
Ken Chen
e4f45ab956 Revert "Log BPF programs & maps in bugreport"
This reverts commit daf5cb64cc.

Reason for revert: dumpstate has the same information

Bug: 243313712
Change-Id: Ie8283cd942bff6ef9dbb66e5926bf650bd56997f
2022-08-22 08:02:32 +00:00
Remi NGUYEN VAN
56dca4119a Merge changes from topic "netstack_jarjar_autogen"
* changes:
  Rename RegularMaintenanceTestService
  Do not jarjar classes in the target package
2022-08-22 02:09:26 +00:00