Commit Graph

42674 Commits

Author SHA1 Message Date
Remi NGUYEN VAN
354f5cf7d0 Merge "Skip BatteryStatsManagerTest on Q" am: e2067816e9 am: 4bcefe111a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1764310

Change-Id: I4168b127b63517c80aebbf270ecd0ec0b2f122cb
2021-07-19 09:39:21 +00:00
Remi NGUYEN VAN
4bcefe111a Merge "Skip BatteryStatsManagerTest on Q" am: e2067816e9
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1764310

Change-Id: Iac778fc5dfe0b5ec0adf400372b3e43c5cc76d5d
2021-07-19 09:25:12 +00:00
Remi NGUYEN VAN
e2067816e9 Merge "Skip BatteryStatsManagerTest on Q" 2021-07-19 09:11:54 +00:00
Treehugger Robot
fa45b598d5 Merge "No-op cleanup" am: 21592b0d93 am: 866b9c4480
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1769285

Change-Id: Ib19a5d93e0b4e2f305a80ccf8841a36a5e7bda74
2021-07-16 16:38:19 +00:00
Treehugger Robot
866b9c4480 Merge "No-op cleanup" am: 21592b0d93
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1769285

Change-Id: I4ea2b3bd3ab5f8c58aca5ca602e22a67f6f8e0d1
2021-07-16 16:25:17 +00:00
Treehugger Robot
21592b0d93 Merge "No-op cleanup" 2021-07-16 16:08:05 +00:00
Remi NGUYEN VAN
fd5d3a5617 Merge "Add ConnectivityCoverageTests to presubmit" am: 0909afc08a am: 4d5342d396
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1768348

Change-Id: I39afdc1740908dbcd7e5fdf87f66a955b4108538
2021-07-16 06:46:06 +00:00
Remi NGUYEN VAN
c4a7f75dc8 Merge "Move ConnectivityCoverageTests to mainline-presubmit" am: 7d4ab94bc6 am: dfc744c81e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1754249

Change-Id: If0dee06aa3865ebdb232ebcf39c646fa7e993092
2021-07-16 06:45:59 +00:00
Remi NGUYEN VAN
4d5342d396 Merge "Add ConnectivityCoverageTests to presubmit" am: 0909afc08a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1768348

Change-Id: Ia83ac341917eee98078d6328f66d90b5a42fa028
2021-07-16 06:31:02 +00:00
Remi NGUYEN VAN
dfc744c81e Merge "Move ConnectivityCoverageTests to mainline-presubmit" am: 7d4ab94bc6
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1754249

Change-Id: I2858a01588c723da64efba2e110097d58b868e86
2021-07-16 06:30:51 +00:00
Remi NGUYEN VAN
0909afc08a Merge "Add ConnectivityCoverageTests to presubmit" 2021-07-16 06:20:00 +00:00
Remi NGUYEN VAN
7d4ab94bc6 Merge "Move ConnectivityCoverageTests to mainline-presubmit" 2021-07-16 06:19:10 +00:00
Chalard Jean
6d8f2fbf99 No-op cleanup
Test: atest ConnectivityServiceTest
Change-Id: Ic07c94785d97bd654ffce960e8bc2652c2dbc3d6
2021-07-16 12:02:22 +09:00
Remi NGUYEN VAN
48c68886ee Add ConnectivityCoverageTests to presubmit
The tests are now consistently green in postsubmit.

Bug: 187935317
Change-Id: Ib04e5de8e57bd9cca0c9244f12a9668f97ba46f9
Test: Need TH to test
2021-07-16 01:36:16 +00:00
Remi NGUYEN VAN
c595c6461c Merge "Fix jarjar-related failures in coverage tests" am: e9f7f1e3d4 am: c6bf1e19a4
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1764731

Change-Id: If9fb707bf6e80b8937a41eb6306b2e2e0589a626
2021-07-15 09:28:55 +00:00
Remi NGUYEN VAN
c6bf1e19a4 Merge "Fix jarjar-related failures in coverage tests" am: e9f7f1e3d4
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1764731

Change-Id: I4a380aba04862af13f01a9d02e3e27c86b22c111
2021-07-15 09:03:23 +00:00
Remi NGUYEN VAN
1e79e9322b Merge "Use TRANSPORT_USB from the SDK" am: ca688d62d3 am: 048ef34b88
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1764734

Change-Id: I7ff0480df0d7997ea68422d1fe315fa94c5a0556
2021-07-15 09:02:04 +00:00
Remi NGUYEN VAN
048ef34b88 Merge "Use TRANSPORT_USB from the SDK" am: ca688d62d3
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1764734

Change-Id: I7a7d4d6006c5b40e3cb553b8b836a7b93d917065
2021-07-15 09:01:26 +00:00
Remi NGUYEN VAN
5a1f2f7108 Move ConnectivityCoverageTests to mainline-presubmit
Recent runs have been passing in mainline-postsubmit.

Non-mainline presubmit will be added later, after it has been passing
consistently for some time.

Bug: 187935317
Change-Id: I20e3d6f11458f00ff75f32419b964c97635995b1
Test: TH needs to test
2021-07-15 05:25:58 +00:00
Remi NGUYEN VAN
e9f7f1e3d4 Merge "Fix jarjar-related failures in coverage tests" 2021-07-15 05:19:18 +00:00
Remi NGUYEN VAN
ca688d62d3 Merge "Use TRANSPORT_USB from the SDK" 2021-07-15 04:55:38 +00:00
Frank Li
8dde213a97 [automerger skipped] Merge "Cleanup the public API getActiveNetworkForUid on AOSP" am: 588a92abe4 am: 806baad21b -s ours
am skip reason: Merged-In I3c2563d4ae4e3715d0c6270344ba8f7ef067872f with SHA-1 2afd0986d3 is already in history

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1749326

Change-Id: I6fdaa0c679437cdeb7de3c0052615faa647e3801
2021-07-14 17:02:21 +00:00
Frank Li
806baad21b Merge "Cleanup the public API getActiveNetworkForUid on AOSP" am: 588a92abe4
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1749326

Change-Id: I74f0e25208fa797e2953752a4b41cf5eec872136
2021-07-14 16:39:48 +00:00
Frank Li
588a92abe4 Merge "Cleanup the public API getActiveNetworkForUid on AOSP" 2021-07-14 16:23:20 +00:00
lifr
538f079d20 Cleanup the public API getActiveNetworkForUid on AOSP
In order to make ConnectivityService the mainline module in ANDROID 12,
The earliest ConnectivityService API getActiveNetworkForUid was exposed.

But after that public api getActiveNetworkForUid and all callers
(Outside the module) has been deleted or replaced in android 12
version. So we should delete the public API in AOSP to keep the APIs
of Android 12 & AOSP consistent and also avoid using it again in AOSP.
The commit is equivalent to ag/14029494, but done in a different repo.

Bug: 183465229
Test: atest ConnectivityControllerTest
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: I50a39d6391c88bbb914a63fdb17bae6851591c01
2021-07-14 21:13:45 +08:00
lucaslin
45e34a8cfb [automerger skipped] Ignore checking TRANSPORT_USB when Android version is older than S am: eadb0add66 am: 4eb7434fed -s ours
am skip reason: Merged-In I3c2563d4ae4e3715d0c6270344ba8f7ef067872f with SHA-1 2afd0986d3 is already in history

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1764733

Change-Id: Ia8a4d0b704932fe0c60e27b8153a091c12a50c05
2021-07-14 09:39:05 +00:00
lucaslin
4eb7434fed Ignore checking TRANSPORT_USB when Android version is older than S am: eadb0add66
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1764733

Change-Id: Idbe4a10d48e80ebab1b98bf083d2326e6281d55d
2021-07-14 09:26:45 +00:00
Remi NGUYEN VAN
732584bcb8 Use TRANSPORT_USB from the SDK
Stop using the stopgap TRANSPORT_USB from NetworkCapabilitiesUtil, which
is being removed.

Bug: 184158327
Test: atest NetworkCapabilitiesTest
Change-Id: I6bbb35d39ff67d6f53b389689dc9f1067e64f962
2021-07-14 16:35:11 +09:00
lucaslin
eadb0add66 Ignore checking TRANSPORT_USB when Android version is older than S
There is a new transport type - TRANSPORT_USB(8) in Android S,
so when the test tries to add this new transport type in older
Android version, it cannot pass the transport type validation and
make test fail.

(clean cherry-pick of change in downstream branch history)
Original change ID before project move:
I38816173b04ea198d99f64f45e9271ac2641e4ac

Bug: 184158327
Test: run CtsNetTestCasesLatestSdk on Android R & Q
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: Ib0368241771d287c09c0e4463f91122533f85a27
2021-07-14 16:28:58 +09:00
Remi NGUYEN VAN
ed8efa75b4 Fix jarjar-related failures in coverage tests
Instead of jarjaring the whole com.android.internal.util package, apply
the jarjar rules per-class. Jarjaring the whole package causes problems
in tests, as for example ConnectivityServiceTest depends on Vpn that
uses other internal utils as hidden API, and these should not be
jarjared.

Also avoid jarjaring INetdUnsolicitedEventListener which is used by
NetdEventListenerServiceTest, and ensure KeepalivePacketDataUtilTest
expects the right package name in toString.

Generally the problems appear because ConnectivityCoverageTests also
includes tests for classes that are not part of the connectivity module,
and use hidden APIs that refer to classes that should not be jarjared.
Some of the tests could be excluded from the coverage suite instead, but
keeping them is helpful for future modularization efforts.

Test: Build service-connectivity, dexdump classes and verify jarjared
      atest ConnectivityCoverageTests
Change-Id: Id6b7e6833d49fa03d9442d7c1c3e4dc16fb48dfc
2021-07-14 15:22:56 +09:00
Treehugger Robot
9e199e7b5d [automerger skipped] Skip bpf offload if upstream interface is VCN am: 8920d32880 -s ours
am skip reason: Merged-In I1ad8cededddec42f45b08aaa31d583c548d105f0 with SHA-1 7dc1b4da7b is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15275452

Change-Id: Ib424c48811a7a709f2c051c602ae681c786cbfaf
2021-07-14 04:22:04 +00:00
Remi NGUYEN VAN
4ba3adc4e5 Skip BatteryStatsManagerTest on Q
BatteryStatsManager did not exist on Q, so it cannot and should not be
tested there.

Bug: 193586822
Test: atest CtsNetTestCasesLatestSdk on Q
Change-Id: Ia9bef7c3438c25e1a4cb403b27cb0084bbd4f824
2021-07-14 12:06:51 +09:00
Treehugger Robot
8920d32880 Skip bpf offload if upstream interface is VCN
Bpf offload do not support VCN network yet, don't start bpf offload
if the interface is ipsec*.

Bug: 191178945
Test: atest TetheringTests
Original-Change: https://android-review.googlesource.com/1764307
Merged-In: I1ad8cededddec42f45b08aaa31d583c548d105f0
Change-Id: I1ad8cededddec42f45b08aaa31d583c548d105f0
2021-07-13 19:14:49 +00:00
Treehugger Robot
ed62eb3a5b Merge "Skip bpf offload if upstream interface is VCN" am: 097d65b0f3 am: 9743c8165e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1764307

Change-Id: Id3546b8888439ee9228fb2b5687b117165fdbbd7
2021-07-13 17:45:37 +00:00
Treehugger Robot
9743c8165e Merge "Skip bpf offload if upstream interface is VCN" am: 097d65b0f3
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1764307

Change-Id: Iee7c4eeaad1aa00b47699bec2838e692ae88edcf
2021-07-13 17:31:09 +00:00
Treehugger Robot
097d65b0f3 Merge "Skip bpf offload if upstream interface is VCN" 2021-07-13 17:16:04 +00:00
markchien
7dc1b4da7b Skip bpf offload if upstream interface is VCN
Bpf offload do not support VCN network yet, don't start bpf offload
if the interface is ipsec*.

Bug: 191178945
Test: atest TetheringTests
Change-Id: I1ad8cededddec42f45b08aaa31d583c548d105f0
2021-07-13 15:35:31 +00:00
Remi NGUYEN VAN
668f279e83 [automerger skipped] Jarjar all classes in service-connectivity am: b240e2a86e -s ours
am skip reason: Merged-In I2aadeca32751267b74d4fd2fd93bb3e8c62e46c0 with SHA-1 0755183fae is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15261893

Change-Id: Id04321d1ce840c10b33211ed847b80838b9216f2
2021-07-13 12:45:03 +00:00
Nucca Chen
5cdd98b850 Merge "[CTT-7] Delete the rules while half-closing tcp state entered" am: f7c8cec604 am: d0b818fa8a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1755173

Change-Id: Id9d4f2be4e4c0d7840a5d336855dfff92f9666fe
2021-07-13 12:31:20 +00:00
Nucca Chen
523e11ef67 Merge "[CTT-6] Update TCP conntrack entry timeout while adding rules" am: db30678605 am: f22f935082
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1760692

Change-Id: I759b26fa36116578c84fd6c226725ece3fbe5b7c
2021-07-13 12:31:16 +00:00
Nucca Chen
709d91215f Merge "[CTT-5] Stop update TCP conntrack entry timeout" am: 69ccea4839 am: 23e3eadde5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1760691

Change-Id: Idf2680669d1c881f3d1846f379f5a8163c4ac274
2021-07-13 12:31:10 +00:00
Nucca Chen
d0b818fa8a Merge "[CTT-7] Delete the rules while half-closing tcp state entered" am: f7c8cec604
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1755173

Change-Id: Ia2243c777d696e1f5bd94d8afd42d43ba1c1d48e
2021-07-13 12:17:54 +00:00
Nucca Chen
f22f935082 Merge "[CTT-6] Update TCP conntrack entry timeout while adding rules" am: db30678605
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1760692

Change-Id: Ie5b26c90bc7e7677259ce1be85ce55002cf03d2e
2021-07-13 12:17:48 +00:00
Nucca Chen
23e3eadde5 Merge "[CTT-5] Stop update TCP conntrack entry timeout" am: 69ccea4839
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1760691

Change-Id: Ib1e1c1f2ccdf85bd3a7fd2275abb7ee144207b58
2021-07-13 12:17:43 +00:00
Nucca Chen
f7c8cec604 Merge "[CTT-7] Delete the rules while half-closing tcp state entered" 2021-07-13 12:07:12 +00:00
Nucca Chen
db30678605 Merge "[CTT-6] Update TCP conntrack entry timeout while adding rules" 2021-07-13 12:07:05 +00:00
Nucca Chen
69ccea4839 Merge "[CTT-5] Stop update TCP conntrack entry timeout" 2021-07-13 12:06:55 +00:00
Hungming Chen
118b5b578a [CTT-7] Delete the rules while half-closing tcp state entered
This is fixing post-FIN state (by disabling offload post-FIN).
Once the tcp state enters half-closing tcp state (fin wait,
close wait), delete the offload rules.

From this commit, we have done the short term solution for conntrack
tcp timeout issue. Here is what we have done so far.
- Stop updating tcp timeout to avoid updating wrong tcp state
  timeout.
- Update the ESTABLISHED timeout
  nf_conntrack_tcp_timeout_established (432000) after adding
  bidirectional rules.
- Delete the tcp rules when the tcp state has left
  "established".

Here is the long term solution and need to be addressed in follow up
commits.
- Parse the tcp state from netlink conntrack event.
- Build a mapping to trace the tcp state of the tcp conntrack event.
- Update tcp state timeout for {ESTABLISHED (432000), FIN_WAIT (120),
  CLOSE_WAIT (60)}.

Bug: 190783768
Bug: 192804833
Test: atest TetheringCoverageTests

Manual test:
1. Browse on tethered device
2. Check conntrack tcp state is established.
   $ cat /proc/net/nf_conntrack
   ipv4     2 tcp      6 431995 ESTABLISHED src=192.168.207.9
   dst=140.112.8.116 sport=50697 dport=443 ..
3. Check offload rules are added via dumpsys.
   Upstream:
     tcp .. 192.168.207.9:50697 -> 14(rmnet0) 10.224.1.247:50697
     -> 140.112.8.116:443 ..
   Downstream:
     tcp .. 140.112.8.116:443 -> 30(30) 10.224.1.247:50697
     -> 192.168.207.9:50697 ..
4. Stop browsing for a few seconds.
5. Check conntrack tcp state is half-closed.
   $ cat /proc/net/nf_conntrack
   ipv4     2 tcp      6 116 TIME_WAIT src=192.168.207.9
   dst=140.112.8.116 sport=50697 dport=443 ..
5. Check offload rules are removed via dumpsys.
   Upstream:
     (not found)
   Downstream:
     (not found)

Change-Id: I07e27230bf8952acd7828d1f605167758b3bc490
2021-07-13 14:28:58 +08:00
Hungming Chen
299a81157c [CTT-6] Update TCP conntrack entry timeout while adding rules
Needed because a payload data packet may have gone through
non-offload path, before we added offload rules, and that this
may result in in-kernel conntrack state being in ESTABLISHED
but pending ACK (ie. UNACKED) state. But the in-kernel conntrack
might never see the ACK because we just added offload rules.
As such after adding the rules we need to force the timeout back
to the normal ESTABLISHED timeout of 5 days.

Issue: the timeout is set to unacknowledged 300s (countdwon to 298s)
$ adb shell cat /proc/net/nf_conntrack
ipv4     2 tcp      6 298 ESTABLISHED src=192.168.244.128
dst=140.112.8.116 sport=45694 dport=443 ..

Test: atest TetheringCoverageTests
Manual check:
$ adb shell cat /proc/net/nf_conntrack
ipv4     2 tcp      6 431988 ESTABLISHED src=192.168.40.162
dst=140.112.8.116 sport=40774 dport=443 ..

Bug: 190783768
Bug: 192804833

Change-Id: I8c34e85e26c9d976e5e2b85473db75ff46d8abd4
2021-07-13 14:28:30 +08:00
Hungming Chen
a5c742be69 [CTT-5] Stop update TCP conntrack entry timeout
This is a preparation for only update the tcp timeout while
adding rules. Also add slack time for updating UDP timeout
interval.

Bug: 190783768
Bug: 192804833

Test: atest TetheringCoverageTests
Change-Id: I3151b531e6581e257f3cfa39ad2fcf1650358b3d
2021-07-13 14:26:58 +08:00