Commit graph

9,895 commits

Message SHA1
Merge "Revert "Replace the usage of UidRange""
Anthony Stange   authored and   Gerrit Code Review   commited 2021-03-18 16:40:53 +00:00
83f77d83fd
Revert "Replace the usage of UidRange"
Revert "Replace the usage of UidRange"

Revert "Add shims for NetworkRequest"

Revert submission 1626206-replaceUidRange

Reason for revert: Breaking build - b/183106405
Reverted Changes:
I0b79c73e8:Add shims for NetworkRequest
I4bc0daf5a:Replace the usage of UidRange
I4e5aec6ef:Replace the usage of UidRange
I107c329d4:Expose uids related APIs in NetworkRequest and Net...

Change-Id: I5a4addc562d180487e2891fd2081c593126e6ffc

Anthony Stange   commited 2021-03-18 16:30:59 +00:00
274c796731
Merge "Replace the usage of UidRange"
Chiachang Wang   authored and   Gerrit Code Review   commited 2021-03-18 13:36:39 +00:00
1241156261
Merge "Fix a bug where any() returns null"
Chalard Jean   authored and   Gerrit Code Review   commited 2021-03-18 09:59:21 +00:00
3a1932cd79
Merge "Remove networkAttributes resource usage"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-17 11:24:28 +00:00
584cfc6b67
Merge "Enable networking tests to be included in partial MTS files as well as full mts."
Kimberly Kreider   authored and   Gerrit Code Review   commited 2021-03-17 02:23:54 +00:00
6f4d35119f
Fix a bug where any() returns null
The type needs to be specified

Test: NetworkAgentTest
Change-Id: I7128ae520cb7175f1fb9467a94edfd1a4bdeb9da

Chalard Jean   commited 2021-03-16 21:49:29 +09:00
1705798d13
Merge "Test conntrack event monitor on R"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2021-03-16 12:29:20 +00:00
d5f07c1243
Test conntrack event monitor on R
Should not {start, stop} conntrack event monitor on R because
it is used by S feature.

Test: atest TetheringCoverageTests
Change-Id: I57a0a84d46e973660b24fc10d314820ada0d45b9

Hungming Chen   commited 2021-03-16 18:14:38 +08:00
62afc9809b
Merge "Do not start conntrack event monitor when running on R"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-03-16 08:03:46 +00:00
c162fc297f
Remove networkAttributes resource usage
Supported network types are now deduced from system features, not the
networkAttributes resource.
Update the test to expect network types to be configured as per
resources before S, and to match system features on S+.

Bug: 146206136
Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest
Change-Id: I715924d562f439f7239c1c95d2dc5bca7095a123

Remi NGUYEN VAN   commited 2021-03-16 16:54:17 +09:00
f1c04fb6b3
Merge "[NS01.cn] Adjust calls for NetworkScore"
Chalard Jean   authored and   Gerrit Code Review   commited 2021-03-16 06:36:07 +00:00
bc786632cf
Merge "add test for TetheringUtils::setupNsSocket()"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2021-03-16 06:23:06 +00:00
d3bb5a544c
Do not start conntrack event monitor when running on R
Starting conntrack event monitor on R devices is unnecessary because
no code uses them.

Bug: 177884581
Test: atest TetheringCoverageTests
Change-Id: I036cb8e29b32a4e220da9a52849b978a6ab821e4

Hungming Chen   commited 2021-03-16 14:18:32 +08:00
23ee901e76
Merge "Add a test for TetheringUtils.setupNaSocket."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2021-03-16 06:17:37 +00:00
d5edbb9eb4
add test for TetheringUtils::setupNsSocket()
Bug: 154669942
Test: test-only change
Change-Id: I33fe5a92667a0a6ee38bbcfdee40405cd37cc30f

Maciej Żenczykowski   commited 2021-03-15 21:10:21 -07:00
e7c57368f8
Add a test for TetheringUtils.setupNaSocket.
Because most of the tethering tests are unprivileged, we cannot
test this code on real sockets. So use an AF_UNIX socketpair.

Bug: 154669942
Bug: 182785371
Test: test-only change
Change-Id: I843fddb3aaeab33628438f3bcd6a4166062de962

Lorenzo Colitti   authored and   Maciej Żenczykowski   commited 2021-03-15 21:01:42 -07:00
82d4b9956d
Merge changes from topic "conn_resources_cp"
* changes:
  Add ServiceConnectivityResources to in-process APEX
  Add ServiceConnectivityResources to tethering

Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-16 02:29:31 +00:00
016e0b9261
Merge "Add test for RouterAdvertisementDaemon."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2021-03-15 13:21:03 +00:00
e8e91c1726
Merge "Do not open BPF maps when running on R."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2021-03-15 13:13:15 +00:00
d12f867cb0
Merge "Fix NullPointerException when running testRequestBackgroundNetwork"
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2021-03-15 13:09:14 +00:00
25e4e50f25
Fix NullPointerException when running testRequestBackgroundNetwork
aosp/1622675 made handler to be nonnull but
testRequestBackgroundNetwork still pass null as handler when
calling requestBackgroundNetwork, so there is a NullPointerException
when running testRequestBackgroundNetwork.

Bug: 175662146
Test: atest CtsNetTestCases:ConnectivityManagerTest#testRequestBackgroundNetwork
Change-Id: I871992549dfc8cc356221164f1dd49c64f0dae67

lucaslin   commited 2021-03-15 18:49:10 +08:00
bfaefe42d1
Do not open BPF maps when running on R.
Opening the maps on R devices is unnecessary (because no code
uses them) and unsafe (because the maps might actually be in a
different format than expected by the module).

Always return null when opening the maps, so the code will safely
fall back to using netd for anything.

This only affects dump(). The production code never opens the
maps except via the shim, and only the S shim opens the maps.
Also check isAtLeastS in dumpCounters, because it opens the map
directly.

Bug: 177884581
Test: builds, boots, "dumpsys tethering" shows expected output
Change-Id: I5884490a5cc40fc529a12100ae5baaeae6a18f30

Lorenzo Colitti   commited 2021-03-15 10:44:53 +00:00
3c228f4923
[NS01.cn] Adjust calls for NetworkScore
Test: NetworkAgentTest
Change-Id: I67b7adb867ec0fdb4ef17f00edd518836b69c8f3

Chalard Jean   commited 2021-03-15 09:50:03 +00:00
1fc092ac59
Add test for RouterAdvertisementDaemon.
bug: 154669942
Test: atest TetheringPrivilegedTests
Change-Id: I2bbea720c486d6bb47a8d86375847894e2b2f390

markchien   authored and   Xiao Ma   commited 2021-03-15 08:20:57 +00:00
2af32e475f
Replace the usage of UidRange
The parameter of NetworkCapabilities.setUids() and
NetworkRequest.Builder.setUids() are updated to take a set of
integer Range instead of a set of UidRange because of refactor
work for the incoming connectivity mainline module.

The parameter change stops NetworkRequestTest to work in the
different API levels. Replace the usage with shims to work in
both current and stable APIs.

Bug: 172183305
Test: atest FrameworksNetTests CtsNetTestCasesLatestSdk
Change-Id: I4bc0daf5ad9e4b4043f4a897ddab16aec8f8a536

Chiachang Wang   commited 2021-03-15 10:04:08 +08:00
c1f14634a4
Merge "Update sources of Tethering module since it is renamed"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-15 01:32:47 +00:00
e2c74e90a9
Add ServiceConnectivityResources to in-process APEX
The APK was added to the standard APEX, but is missing in the
in-process APEX.

Bug: 182557971
Merged-In: Ic2491f04880ff66abc3b2d3aaee6168e18f6d68a
Merged-In: Ibf982ceb5f0fd61c822399e3eeeb1ef5e500604d

Change-Id: Ibf982ceb5f0fd61c822399e3eeeb1ef5e500604d
Test: m

Remi NGUYEN VAN   commited 2021-03-14 12:33:30 +09:00
2fb22c2a2b
Merge "Add a test for upstream selection."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2021-03-12 14:07:01 +00:00
f427d49541
Add a test for upstream selection.
Currently, upstream selection is split between the Tethering and
UpstreamNetworkMonitor classes. The UpstreamNetworkMonitor bits
are unit tested, but there are no tests for the interaction of
the two. Add a simple test.

In order to do this, remove the code that controls the
UpstreamNetworkMonitor spy from prepareUsbTethering. This is so
that the new test can call prepareUsbTethering but still rely on
the behaviour of the actual UpstreamNetworkMonitor.

Bug: 173068192
Test: atest TetheringTests
Change-Id: If2ef9af82bc0cbff9172e575ad3d7686e5b492da

Lorenzo Colitti   commited 2021-03-12 17:59:02 +09:00
473399ceab
Add ServiceConnectivityResources to tethering
The resource package is used by service-connectivity to load its own
resources.

Bug: 182125649
Test: atest FrameworksNetTests

Merged-In: I3c7fc6285f10318ecef05a64e1179054bb831d99
Merged-In: Ic2491f04880ff66abc3b2d3aaee6168e18f6d68a

Change-Id: I3c7fc6285f10318ecef05a64e1179054bb831d99

Remi NGUYEN VAN   commited 2021-03-12 17:50:41 +09:00
60f4c2f425
Merge changes from topic "attach_bpfprog_in_mainline"
* changes:
  [NFCT.TETHER.15] Attach BPF program in the mainline module
  [NFCT.TETHER.14] Clear the BPF maps in BpfCoordinator ctor

Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2021-03-12 00:21:01 +00:00
3357388742
Merge "Rename StringNetworkSpecifier to Ethernet"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-11 23:51:49 +00:00
ce2ab07074
[NFCT.TETHER.15] Attach BPF program in the mainline module
Migrate Maze's BPF program attaching and detaching functions from
system/netd/server/OffloadUtils.{c, h} to tethering module.

Test: atest TetheringCoverageTests
Test case #1:
Enable WiFi hotspot and check tc filters are added or removed on both
wlan1 and rmnet_data#.

$ adb shell tc filter show dev wlan1 ingress
filter protocol ipv6 pref 1 bpf chain 0
filter protocol ipv6 pref 1 bpf chain 0 handle 0x1
prog_offload_schedcls_tether_upstream6_ether:[*fsobj] direct-action
not_in_hw id 2 tag 7cf020cc09a7c982
filter protocol ip pref 2 bpf chain 0
filter protocol ip pref 2 bpf chain 0 handle 0x1
prog_offload_schedcls_tether_upstream4_ether:[*fsobj] direct-action
not_in_hw id 7 tag 2f87d55b636c082c

$ adb shell tc filter show dev rmnet_data2 ingress;
filter protocol ipv6 pref 1 bpf chain 0
filter protocol ipv6 pref 1 bpf chain 0 handle 0x1
prog_offload_schedcls_tether_downstream6_rawip:[*fsobj] direct-action
not_in_hw id 3 tag 8b3885b75bd261de
filter protocol ip pref 2 bpf chain 0
filter protocol ip pref 2 bpf chain 0 handle 0x1
prog_offload_schedcls_tether_downstream4_rawip:[*fsobj] direct-action
not_in_hw id 6 tag b1c9478c91f8df9a

Test case #2:
Enable USB tethering and check tc filters are added or removed on both
rndis0 and rmnet_data#.

Test case #3:
Enable WiFi and USB tethering and check tc filter are added or removed
on rndis0, wlan1 and rmnet_data#.

Change-Id: I3f9a65043271bc8f5bf1b82ae505c471625ca9de

Hungming Chen   commited 2021-03-11 17:49:42 +08:00
3dbd4a1cc4
Update sources of Tethering module since it is renamed
framework-tethering-shared-srcs is named to
framework-connectivity-shared-srcs so update
source section to include correct file group.

Ignore-AOSP-First: changes in topic has conflicts in sc-dev
Bug: 177046265
Test: FrameworksNetTests
Change-Id: I81e2af0cc3b37af16b03c1288eb0591b7ed65cc4
Merged-In: I81e2af0cc3b37af16b03c1288eb0591b7ed65cc4
Merged-In: Ic2491f04880ff66abc3b2d3aaee6168e18f6d68a

Aaron Huang   commited 2021-03-11 07:36:55 +00:00
b401e58a1e
Merge "Skipping printing AssumptionViolatedExceptions."
Sudheer Shanka   authored and   Gerrit Code Review   commited 2021-03-10 14:26:18 +00:00
b94021ab6e
ebpf offload - beginnings of xdp implementation
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I6956e78bd325b63dc6dc813440f9f80c29aada36

Maciej Żenczykowski   commited 2021-03-10 14:02:50 +00:00
90b81ac174
ebpf offload - make it possible to boot on Q era 4.14/4.19 kernels
by marking programs as optional and providing appropriate stub implementations.

Test: TreeHugger
Bug: 181045068
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I021e7bcbfe4236242f517f067f89777fc08ecd8d

Maciej Żenczykowski   commited 2021-03-10 13:59:46 +00:00
acddd4f183
ebpf offload - noop program reorder
This is just a cut'n'paste reordering of programs.
Goal is to put rawip programs above ether ones.
This will enable next change to be easier to read.

Test: TreeHugger
Bug: 181045068
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Icebf4bf0505136e97b7b6950fb0b790582eb495e

Maciej Żenczykowski   commited 2021-03-10 13:59:00 +00:00
2278aed207
[NFCT.TETHER.14] Clear the BPF maps in BpfCoordinator ctor
Needed while the system server has recovered from crash.

Test: atest TetheringCoverageTests
Change-Id: Idbed4887f5396537f0d0df97de8b482266dffbb7

Hungming Chen   commited 2021-03-09 16:11:22 +08:00
499d3cac73
Make TestConnectivityManager send CONNECTIVITY_ACTION.
The tethering code still depends on CONNECTIVITY_ACTION for
upstream selection. Make TestConnectivityManager send these
broadcasts.

Bug: 173068192
Test: atest TetheringTests
Change-Id: I6a32e99fafef9d6d2abec438ffc68164ab4c5bdf

Lorenzo Colitti   commited 2021-03-09 01:16:35 +09:00
57957fe8a1
Skipping printing AssumptionViolatedExceptions.
Right now, if there are any failures along with
the cases where we skip the test, we end up printing
failure exception and all AssumptionViolatedExceptions
which makes it hard to find the actual failures.

Bug: 181686645
Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Change-Id: Ib3f1622fc259ad4966789cfafdc54203c2559471

Sudheer Shanka   commited 2021-03-05 09:30:34 +00:00
c19cd34a35
Merge "bpf offload - add a new 'tether_xdp_devmap'"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2021-03-05 06:03:02 +00:00
b908e0c867
Merge changes I968bfa76,Id46f1e5b,Iff9b6212,I6bdb090a
* changes:
  Use TestConnectivityManager in TetheringTest.
  Support building different UpstreamNetworkState test objects.
  Change TetheringTest's UpstreamNetworkMonitor from mock to spy.
  Make TestConnectivityManager usable by other tethering tests.

Lorenzo Colitti   authored and   Gerrit Code Review   commited 2021-03-05 05:11:10 +00:00
bc87f8a9d9
Use TestConnectivityManager in TetheringTest.
The changes required are:
- Change all usages of when(mCm.method()).thenReturn(...) to
  doReturn(...).when(mCm).method() because spies must use the
  latter syntax.
- In setDataSaverEnabled, set the mocked return value before
  sending the broadcast. Otherwise, the first time the method is
  called, the spy will attempt to send the broadcast, and will
  crash because it does not have permission to do so.

This does not do anything useful yet, but it will be used in
future CLs.

Bug: 173068192
Test: atest TetheringTests
Change-Id: I968bfa76ead25b2d45ed1c0e8ede32df81401579

Lorenzo Colitti   commited 2021-03-04 23:06:52 +09:00
66287d3551
Support building different UpstreamNetworkState test objects.
TetheringTest is only able to build UpstreamNetworkState objects
for mobile Internet networks. Support building wifi and dun
versions as well.

Bug: 173068192
Test: atest TetheringTests
Change-Id: Id46f1e5b65dbe04e84a5f56343821af260e2539e

Lorenzo Colitti   commited 2021-03-04 23:02:40 +09:00
b424a2794e
Change TetheringTest's UpstreamNetworkMonitor from mock to spy.
This allows future tests that want to exercise the interactions
between Tethering and UNM to do so.

Also verify what happens when UNM is initialized, and in setUp,
capture the NetworkCallback it files to track the default
network, so tests can send it NetworkCallbacks. (This callback
is only ever filed once.)

Test: test-only change
Change-Id: Iff9b62120cced41cc61263bfd4fa34f575d0ac00

Lorenzo Colitti   commited 2021-03-04 23:02:40 +09:00
bf69824479
Make TestConnectivityManager usable by other tethering tests.
Currently, this class is a static inner class of
UpstreamNetworkMonitorTest. Extract it to its own top-level class
so it can be used by other tests.

Bug: 173068192
Test: atest TetheringTests
Change-Id: I6bdb090a99781ac2530b3924ac5c4cf78de315b0

Lorenzo Colitti   commited 2021-03-04 23:02:40 +09:00
d025c562f0
Rename StringNetworkSpecifier to Ethernet
Tests just need a specifier to verify general NetworkSpecifier
functionality. They can use EthernetNetworkSpecifier the same way they
use StringNetworkSpecifier.

To keep the tests passing on Q and R, add a CompatUtil class that will
keep creating StringNetworkSpecifiers (now removed) instead.

Bug: 179329291
Test: atest CtsNetTestCases
Merged-In: Ic6bf611ba36b555e4e0bb1bd3fa0053fe29dc8cf

Change-Id: I38fa9eed5915264a53cc70e8f170c003eefe04e2

Remi NGUYEN VAN   commited 2021-03-03 18:28:38 +09:00
71de00d339
bpf offload - add a new 'tether_xdp_devmap'
It will map device ifindex to itself (but note that internally in the
kernel this is optimized into a map from ifindex to direct device
pointer), but only for xdp transmit capable devices (other devices
will not have an entry).

This will allow the use of bpf_redirect_map() from xdp tethering programs.

Test: atest, TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I29684e6761727d1115e9b4d75486eccbca3d5e33

Maciej Żenczykowski   commited 2021-03-01 23:42:43 -08:00
db2cff5cdf