Commit Graph

9994 Commits

Author SHA1 Message Date
Remi NGUYEN VAN
235097b32b Merge "Update sources of Tethering module since it is renamed" am: e2c74e90a9 am: a564d023d0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1626083

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ieede28a14ecfca4969eabb8954336ee0e07491c3
2021-03-15 02:48:59 +00:00
Remi NGUYEN VAN
a564d023d0 Merge "Update sources of Tethering module since it is renamed" am: e2c74e90a9
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1626083

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic0796324e5b1f5f38890b655f988c91a496612e1
2021-03-15 02:05:41 +00:00
Remi NGUYEN VAN
e2c74e90a9 Merge "Update sources of Tethering module since it is renamed" 2021-03-15 01:32:47 +00:00
Lorenzo Colitti
9f8e962d48 Merge "Add a test for upstream selection." am: f427d49541 am: 939d48f96c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1611320

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I1f2430060ba0de9fa4d19fa290b31f114f72b13a
2021-03-12 15:16:49 +00:00
Lorenzo Colitti
939d48f96c Merge "Add a test for upstream selection." am: f427d49541
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1611320

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I891027b54d90fb01784158ec690f3880c5125f42
2021-03-12 14:38:02 +00:00
Lorenzo Colitti
f427d49541 Merge "Add a test for upstream selection." 2021-03-12 14:07:01 +00:00
Lorenzo Colitti
473399ceab 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
2021-03-12 17:59:02 +09:00
Maciej Żenczykowski
e9aa6a316d Merge changes from topic "attach_bpfprog_in_mainline" am: 3357388742 am: 5254c0c243
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1607973

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I8db0e2be24559a4b7b9ec51452ccb74ef51ae6a6
2021-03-12 01:37:01 +00:00
Hungming Chen
9dba544999 [NFCT.TETHER.14] Clear the BPF maps in BpfCoordinator ctor am: 499d3cac73 am: 129077bd58
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1623669

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I63ab27a10a04180ac9faf038350c36ff7aec71fe
2021-03-12 01:37:00 +00:00
Maciej Żenczykowski
5254c0c243 Merge changes from topic "attach_bpfprog_in_mainline" am: 3357388742
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1607973

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I846f007b1da04929826d4c687b93d7c3a6f56185
2021-03-12 01:01:39 +00:00
Hungming Chen
129077bd58 [NFCT.TETHER.14] Clear the BPF maps in BpfCoordinator ctor am: 499d3cac73
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1623669

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I54098527fb72260c01c78d0b49282da4257f4a24
2021-03-12 01:01:36 +00:00
Remi NGUYEN VAN
a88f2b694e Merge "Rename StringNetworkSpecifier to Ethernet" am: ce2ab07074 am: 0594e93b46
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1574523

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I5a5f18774319c2cccc8dc92fa03760636e7107d8
2021-03-12 00:26:45 +00:00
Maciej Żenczykowski
3357388742 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
2021-03-12 00:21:01 +00:00
Remi NGUYEN VAN
0594e93b46 Merge "Rename StringNetworkSpecifier to Ethernet" am: ce2ab07074
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1574523

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I7778338f37a592a37d215af63d9cf6578c5407b8
2021-03-12 00:10:08 +00:00
Remi NGUYEN VAN
ce2ab07074 Merge "Rename StringNetworkSpecifier to Ethernet" 2021-03-11 23:51:49 +00:00
Hungming Chen
3dbd4a1cc4 [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
2021-03-11 17:49:42 +08:00
Aaron Huang
b401e58a1e 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
2021-03-11 07:36:55 +00:00
Sudheer Shanka
391af8dda0 Merge "Skipping printing AssumptionViolatedExceptions." am: b94021ab6e am: 188fa60f90
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1620820

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I6ff9507d19f0e56258c78d285648fe8d3df6e75c
2021-03-10 14:58:41 +00:00
Maciej Żenczykowski
f4404beddc ebpf offload - beginnings of xdp implementation am: 90b81ac174 am: e416c69f76
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1622560

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib8850fb10af5c8fa80743d51cbc514f67b44ffd0
2021-03-10 14:58:35 +00:00
Maciej Żenczykowski
f2c7fe1437 ebpf offload - make it possible to boot on Q era 4.14/4.19 kernels am: acddd4f183 am: 973a01cae3
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1625739

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I95c85376c218ca29aee62c0aab5cca097cfa298f
2021-03-10 14:57:59 +00:00
Maciej Żenczykowski
9009cc521d ebpf offload - noop program reorder am: 2278aed207 am: 4e071fff2a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1625238

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I72e3bcb1733f9c864915e13e0849d8e9773e5c82
2021-03-10 14:57:57 +00:00
Sudheer Shanka
188fa60f90 Merge "Skipping printing AssumptionViolatedExceptions." am: b94021ab6e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1620820

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I798cb459698884e688a48150357ec49502c29677
2021-03-10 14:40:22 +00:00
Sudheer Shanka
b94021ab6e Merge "Skipping printing AssumptionViolatedExceptions." 2021-03-10 14:26:18 +00:00
Maciej Żenczykowski
e416c69f76 ebpf offload - beginnings of xdp implementation am: 90b81ac174
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1622560

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I42da34bad79dfe9fac5cdf5f768bbfdd235d111f
2021-03-10 14:24:09 +00:00
Maciej Żenczykowski
973a01cae3 ebpf offload - make it possible to boot on Q era 4.14/4.19 kernels am: acddd4f183
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1625739

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I4fa83a97a4776af6f568da10d0b1e156f9c7da42
2021-03-10 14:23:46 +00:00
Maciej Żenczykowski
4e071fff2a ebpf offload - noop program reorder am: 2278aed207
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1625238

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3f6603fe427f5b54a7bfd2b728605fe0ac11afe8
2021-03-10 14:23:44 +00:00
Maciej Żenczykowski
90b81ac174 ebpf offload - beginnings of xdp implementation
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I6956e78bd325b63dc6dc813440f9f80c29aada36
2021-03-10 14:02:50 +00:00
Maciej Żenczykowski
acddd4f183 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
2021-03-10 13:59:46 +00:00
Maciej Żenczykowski
2278aed207 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
2021-03-10 13:59:00 +00:00
Lorenzo Colitti
52dbfe5394 Make TestConnectivityManager send CONNECTIVITY_ACTION. am: 57957fe8a1 am: 138c2578a8
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1611319

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ifa368ff8aa5b9729406df1ff4c431ca6993c9b09
2021-03-09 17:57:17 +00:00
Lorenzo Colitti
138c2578a8 Make TestConnectivityManager send CONNECTIVITY_ACTION. am: 57957fe8a1
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1611319

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I84d8126c78e4e8502430392079be4f11b5a5b257
2021-03-09 17:20:06 +00:00
Hungming Chen
499d3cac73 [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
2021-03-09 16:11:22 +08:00
Lorenzo Colitti
57957fe8a1 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
2021-03-09 01:16:35 +09:00
Sudheer Shanka
c19cd34a35 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
2021-03-05 09:30:34 +00:00
Maciej Żenczykowski
b6cf0d8785 Merge "bpf offload - add a new 'tether_xdp_devmap'" am: b908e0c867 am: f5a9d32a73
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1612879

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If362ffe9a8ed9018e4b6a9349987f7abe6d7338a
2021-03-05 07:02:21 +00:00
Lorenzo Colitti
4d89e4899b Merge changes I968bfa76,Id46f1e5b,Iff9b6212,I6bdb090a am: bc87f8a9d9 am: 69b2de6e5a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1611318

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ief6f2a603bdc60b45f791a2d8f0b97befec44f7a
2021-03-05 07:02:11 +00:00
Maciej Żenczykowski
f5a9d32a73 Merge "bpf offload - add a new 'tether_xdp_devmap'" am: b908e0c867
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1612879

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ibde3d60cd0684ec28b6f8de9719bc31c91eae85c
2021-03-05 06:22:15 +00:00
Lorenzo Colitti
69b2de6e5a Merge changes I968bfa76,Id46f1e5b,Iff9b6212,I6bdb090a am: bc87f8a9d9
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1611318

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I75098c183e04978665618e52b2ff56def5fbe464
2021-03-05 06:22:07 +00:00
Maciej Żenczykowski
b908e0c867 Merge "bpf offload - add a new 'tether_xdp_devmap'" 2021-03-05 06:03:02 +00:00
Lorenzo Colitti
bc87f8a9d9 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.
2021-03-05 05:11:10 +00:00
Lorenzo Colitti
66287d3551 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
2021-03-04 23:06:52 +09:00
Lorenzo Colitti
b424a2794e 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
2021-03-04 23:02:40 +09:00
Lorenzo Colitti
bf69824479 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
2021-03-04 23:02:40 +09:00
Lorenzo Colitti
d025c562f0 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
2021-03-04 23:02:40 +09:00
Remi NGUYEN VAN
71de00d339 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
2021-03-03 18:28:38 +09:00
Maciej Żenczykowski
db2cff5cdf 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
2021-03-01 23:42:43 -08:00
Treehugger Robot
d5821f3c06 Merge "Make ConnectivityManagerTest use the API shims." am: c8761c98ae am: c7d509804b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1611323

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I1b49229f76a378336c55d658e2e186973fe88a58
2021-03-01 20:09:03 +00:00
Treehugger Robot
c7d509804b Merge "Make ConnectivityManagerTest use the API shims." am: c8761c98ae
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1611323

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ie3de6a218eabeab2532d6ee4d27c7f2ee65b6065
2021-03-01 19:30:24 +00:00
Treehugger Robot
c8761c98ae Merge "Make ConnectivityManagerTest use the API shims." 2021-03-01 17:50:10 +00:00
Remi NGUYEN VAN
074f40bd54 Add CtsNetTestCases to TEST_MAPPING am: ad380c1de6 am: 94358c4c9e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1612014

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I30f6e15c961f9cafa5e223d1d6f0ed3e6118d3cf
2021-03-01 09:41:50 +00:00