Commit Graph

66134 Commits

Author SHA1 Message Date
Mike Yu
744d0759c3 Fix jniThrowException to print correct error message in NativeMultinetworkJni.cpp
The parameters `actual` and `expected` in the macros EXPECT_{GE,GT,EQ}
can be a statement. If their returned value are different, it results
in them being called twice. Some statements are not supposed to be
called more than once, such as expectAnswersValid that automatically
closes the fd.

Bug: 242681575
Test: atest CtsNetTestCasesLatestSdk:MultinetworkApiTest
Change-Id: Id730bcc3248ae77fcf05db414a7f5a2fe1d212e3
2022-09-07 07:44:26 +00:00
Junyu Lai
7119e9cf5e Merge changes from topic "st02"
* changes:
  [ST02.2] Use the getters of DnsHeader
  [ST02.1] Add TYPE_CNAME constant to DnsResolver
2022-09-07 02:25:41 +00:00
Treehugger Robot
4f062b3f62 Merge "EthernetTetheringTest: give slack time for waiting UDP stream mode" 2022-09-06 15:10:39 +00:00
Motomu Utsumi
b9548860a9 Open CookieTagMap in BpfNetMaps
Upcoming CL will update BpfNetMaps to pull NetworkBpfMapInfo atom that
contains the cookieTagMap size field.

Test: m, atest BpfNetMaps
Bug: 217624062
Change-Id: I84bb0aa56e3916fc6fc0ca31ba5962f3b9be4b6f
2022-09-06 22:33:44 +09:00
Hungming Chen
dc311c8aa5 EthernetTetheringTest: give slack time for waiting UDP stream mode
Give slack time for waiting UDP stream mode because handling conntrack
event in user space may not in precise time. Used to reduce the flaky
rate.

Bug: 243314243
Test: atest EthernetTetheringTest
Change-Id: I7aee1a45d9a4d4fecf09739488dcaadeb7e86655
2022-09-06 18:25:01 +08:00
Yike
68e079183d Improve the dependency declaration for Net tests
This change moves ConnectivityChecker from `required` to `data`,
since the `required` is inherited from Make and is very vague. It's
discouraged by Android Build team to use it.

Besides, this change declares net-tests-utils-host-common, since Net
tests use ConnectivityCheckTargetPreparer that is included in
net-tests-utils-host-common. All dependencies of a test should be
declared explicitly, so that test infrastructure could only provide
the needed dependencies instead of all to run a test.

Bug: 222438068
Test: presubmit
Change-Id: Id522fd88ca53b5af338315fc6370d68bdabf403b
2022-09-06 09:15:07 +00:00
Treehugger Robot
3be9640add Merge "Improve a comment about network scores" 2022-09-06 07:23:18 +00:00
Milim Lee
5d7cbdddc0 Create ethernet directory if it's not exist
Test: boot
Bug: 244012069
Change-Id: I2b8f1dd2989ba562755d66be9e6dea9a92834cf3
2022-09-06 15:23:36 +09:00
Treehugger Robot
276fa3f679 Merge "Run networkstack hostside GTS tests on module changes." 2022-09-06 05:58:42 +00:00
Chalard Jean
2a96cf2e3e Improve a comment about network scores
Test: comment-only
Change-Id: I02546b207e07133536bcae10f8eb4ad76b944881
2022-09-06 13:44:10 +09:00
Motomu Utsumi
d95a0dafa8 Switch SkDestroyListener based on the flag.
Switch existing C SkDestroyListener and new Java SkDestroyListener based
on the experiment flag.

Bug: 217624062
Test: atest SkDestroyListenerTest
Change-Id: I7031ba7c155edb43e0e7b77449587058d6ba38fb
2022-09-06 11:23:13 +09:00
Motomu Utsumi
3af8f0e8d6 Add startSkDestroyListener flag to native_init
This CL prepares for upcoming CL.
Upcoming CL will add SkDestroyListener with Java BpfMap and switch
current C SkDestroyListener and new Java SkDestroyListener based on the
experiment flag.

Bug: 217624062
Test: atest SkDestroyListenerTest
Change-Id: I5ebb319d1b2262199d4ef6a3549894fee24c4ccf
2022-09-06 11:23:13 +09:00
Motomu Utsumi
116af0d892 Add SkDestroyListenerTest
SkDestroyListener monitors the destroy of IPv4/IPv6 TCP/UDP sockets and
removes CookieTagMap entries.
SkDestroyListenerTest closes 100 sockets at once and check all the
entries are removed from the CookieTagMap.

Bug: 217624062
Test: atest MtsTetheringTestLatestSdk

Change-Id: I161006f4ae5bd83085e68bf8de260f04f3da0ea0
2022-09-06 11:23:09 +09:00
Treehugger Robot
26ebf8c97a Merge "Migrate NetworkStatsServiceTest from when().thenReturn() to doReturn().when()" 2022-09-05 12:20:55 +00:00
Junyu Lai
bae070bf80 Migrate NetworkStatsServiceTest from when().thenReturn() to doReturn().when()
This will address flakiness issues arising from the use of
when() in multithread context.

Fix: 243658074
Test: atest com.android.server.net.NetworkStatsServiceTest#testDataMigration_differentFromFallback \
      --rerun-until-failure 1000
Change-Id: I047050ef14cb60658098ff7803c6773907a92919
2022-09-05 16:17:57 +08:00
Paul Hu
fb88e1378d Merge "Reduce the test flake on NsdManagerTest" 2022-09-05 04:23:27 +00:00
Nucca Chen
6cafe04787 Revert "UpstreamNetworkMonitor: add NOTIFY_TEST_NETWORK_AVAILABLE"
This reverts commit 82e7733909.

Reason for revert: don't modify production code for testing only

Change-Id: I19826c3308774ce6f62a2748b4e038500aec33e2
2022-09-05 03:25:33 +00:00
Treehugger Robot
1aafa45701 Merge "Import translations. DO NOT MERGE ANYWHERE" 2022-09-04 20:18:10 +00:00
Bill Yi
df699c1948 Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: I5f200cd2a3e159e298a37bf98ed21942f2be78b0
2022-09-02 20:51:59 -07:00
Jean Chalard
2d6264f679 Merge "Allow connectToCell multiple times" 2022-09-03 03:26:28 +00:00
Sudheer Shanka
8d53860488 Merge "Explicitly disable the data saver mode before checking the app state." 2022-09-02 20:23:38 +00:00
Chiachang Wang
ebab250383 Merge "Add test to verify null ProxyInfo in Ikev2VpnProfile" 2022-09-02 12:15:09 +00:00
Tyler Wear
f8dbbdcb69 DscpPolicy Move to kernel 5.15
Require at least kernel 5.15. Feature is not required on older
kernels and may impact boot time unnecessarily.

Bug: 235559605
BUg: 241077401
Fixes: 241077401
Test: run cts -m CtsNetTestCases -t android.net.cts.DscpPolicyTest
Change-Id: I2e4b509de1d8940fc63ae057a8326f13c0fd1420
Merged-In: I2e4b509de1d8940fc63ae057a8326f13c0fd1420
2022-09-02 18:03:31 +09:00
Aaron Huang
279733e3f5 Merge "Fix settings show data usage with the uid of a removed package" 2022-09-02 07:43:55 +00:00
chiachangwang
715dc5b447 Add test to verify null ProxyInfo in Ikev2VpnProfile
Bug: 244281603
Test: atest FrameworksNetTests
Change-Id: Ice195b60a0f62ae541ede9277c6e36f9c72b2dbb
2022-09-02 03:51:43 +00:00
Jean Chalard
3db58490ff Merge "Convert EthTrackTest from when() to doReturn()" 2022-09-02 02:52:39 +00:00
Sudheer Shanka
c39bca0db4 Explicitly disable the data saver mode before checking the app state.
Bug: 244450780
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Change-Id: I6a8be0dcfa62286bedd972eb868ab01f3a1545a7
2022-09-02 02:09:33 +00:00
Treehugger Robot
24ca302311 Merge "Convert booleans in NAI to timestamps" 2022-09-01 23:06:09 +00:00
Treehugger Robot
110ec66819 Merge "Straighten out NetworkAgentConfig's equals()" 2022-09-01 18:23:21 +00:00
Maciej Żenczykowski
b5868a0a40 BpfHandler - eliminate mutex
since it doesn't actually work (this runs in netd, but is meant
to protect against system server modifications)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I87f268f1a68c559b19caa4d625cb9eb8395c91e2
2022-09-01 12:36:17 +00:00
Chalard Jean
254bd168a3 Convert booleans in NAI to timestamps
These timestamps will be useful for debugging issues where
debuggers need to know what happened to long-lived networks,
where logcat doesn't span long enough.

These timestamps are also likely to be useful in the future,
in particular for metrics.

Test: FrameworksNetTests
Change-Id: I8f46ce92e2ab301fa32e18e714a43a4130719199
2022-09-01 18:37:01 +09:00
Chalard Jean
61525a57a0 Convert EthTrackTest from when() to doReturn()
Bug: 242671512
Test: FrameworksNetTests
Change-Id: I5f13ebe1c1e8e1ecd3d561cae8380ec12b31dc95
2022-09-01 18:02:12 +09:00
Chalard Jean
333eaa930f Straighten out NetworkAgentConfig's equals()
Bug: 244312404
Test: FrameworksNetTests
Change-Id: I154f3b2ab898d6f428ccf9efa9ab90992beb1f9f
2022-09-01 08:14:49 +00:00
Jean Chalard
1c00db5d3b Merge "Flake fix : Wait setting applied before returning from setConfig" 2022-09-01 07:21:58 +00:00
Motomu Utsumi
ec94e62460 Merge "Use BpfDump#dumpMap in NetworkStatsService dump" 2022-09-01 05:46:55 +00:00
Maciej Żenczykowski
d312e6c606 Merge "BpfNetworkStats - use static BpfMap objects for stats maps A & B" 2022-08-31 12:38:42 +00:00
Chalard Jean
cfc6b090e4 Allow connectToCell multiple times
CtsNetTestUtils#connectToCell is happy to give an existing
cell network, so it doesn't make a lot of sense that it
demands only be called once per test unless you disconnect.
Some tests may face instability in the network and may
need to retry, but having the test itself know that
particular nook of the CtsNetTestUtils API is not very
seamless.

Instead, it's more useful to just unregister the callback
if it has been registered.

Test: CtsNetTestCases
Change-Id: I4dad570dcd2c25fb7ccd176769a805620fd8df59
2022-08-31 15:34:29 +09:00
Motomu Utsumi
d9aa769348 Use BpfDump#dumpMap in NetworkStatsService dump
aosp/2193727 adds BpfDump#dumpMap.
This CL updates NetworkStatsService to use this helper function.

Test: dumpsys netstats, atest NetworkStatsServiceTest
Change-Id: Ieaa75b6317678ef4f41d22c294e290c3a6d58fad
2022-08-31 05:54:08 +00:00
Motomu Utsumi
171c817072 Merge "Use IBpfMap type instead of BpfMap type" 2022-08-31 03:54:28 +00:00
Maciej Żenczykowski
1453f129ea BpfNetworkStats - use static BpfMap objects for stats maps A & B
This might eliminate a failure mode with dreaded 524 error
from the kernel... or it might not, but it shouldn't hurt.

Bug: 230418056
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: If2479daf77f61c220214ff507582295bd303fd21
2022-08-31 01:40:00 +00:00
Chalard Jean
044fc35040 Flake fix : Wait setting applied before returning from setConfig
Test: FrameworksNetTests
Change-Id: I177471e68761a4e1dd75678431657d821d4c9f72
2022-08-30 18:19:01 +09:00
Junyu Lai
1c685c1e97 Merge "[ST01] Attributes data usage of test network by specifier" 2022-08-30 05:50:40 +00:00
Aaron Huang
095438420c Fix settings show data usage with the uid of a removed package
When an app is removed, the stats still be included in
the persist snapshot in NetworkStatsFactory which
causes settings show the data usage with the uid of the
removed app. Thus, remove the stats of the removed
package from the persist snapshot when NetworkStatsService
receives ACTION_UID_REMOVED intent.

Bug: 239899930
Bug: 209360825
Test: FrameworksNetTests:NetworkStatsServiceTest
      FrameworksNetTests:NetworkStatsFactoryTest
Change-Id: I73cca367ac6bf0d2d29ef0a7d94500f1e6917dcb
2022-08-29 22:31:26 +08:00
Treehugger Robot
c6c4dc719f Merge "unit test of offernetwork and unoffernetwork" 2022-08-29 13:59:18 +00:00
Treehugger Robot
b091693d36 Merge "NullPointerException due to command:adb shell service call connectivity 79 -> void unofferNetwork(in INetworkOfferCallback callback)" 2022-08-29 13:59:18 +00:00
Treehugger Robot
05021aa886 Merge "Never satisfy requests with networks that aren't connected." 2022-08-29 08:30:31 +00:00
Junyu Lai
c9f1ca62d9 [ST01] Attributes data usage of test network by specifier
Currently, data usage of all test networks are all attributed to
the same NetworkIdentity, which does not allow services to
distinguish upload & download traffic of different test networks.

Thus, this CL put specifier that comes along with
TestNetworkAgent into wifiNetworkKey field to build different
NetworkIdentity to attribute data usage to different for
individual networks. And allow querying test network usage with
wifiNetworkKeys.

Bug: 139774492
Test: atest FrameworksNetTests
      atest android.net.cts.ConnectivityManagerTest
Change-Id: I1bb38fd20781eaf3105735440a04b27bef36fcae
2022-08-29 13:55:08 +08:00
Patrick Rohr
61b017f045 Revert "Add SkipPresubmit to EthernetManagerTest"
This reverts commit c2bc2963c1.

Reason for revert: fixed flakiness. Re-enable EthernetManagerTest in presubmit.

Change-Id: I29f7d2b4f530b18aaaae3e327f3721f08aab060a
2022-08-26 19:18:52 +00:00
Patrick Rohr
e777832a9d ethernet: reenable IPv6 provisioning delays
Unfortunately, there is no way to disable carrier on the tap interface
without first configuring the interface with carrier. This means that it
is possible the interface is brought up before carrier is disabled (it
is an unlikely flake but it does happen in automation). Reenabling RS
delay and DAD will make sure that provisioning does not succeed before
carrier is disabled.

Test: atest EthernetManagerTest --iterations 50
Change-Id: Ie2aa7529b48fa9aceff3dd3b432d87a6eb2f0298
2022-08-26 19:18:35 +00:00
Patrick Rohr
d407328dd4 Merge "Fix EthernetTetheringTest flaky" 2022-08-26 16:37:28 +00:00