Commit Graph

1423 Commits

Author SHA1 Message Date
Maciej Żenczykowski
cffaf88a09 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: I4c57851d064079ee668b77949e7cade8eefc8238
2021-03-10 14:58:00 +00:00
Maciej Żenczykowski
b2dc6cfa40 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: I47d783a5000bb63ee98886377a577c6229645554
2021-03-10 14:57:58 +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
e8937ed7c2 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: I65d61ecc50dc7fc66367a5db52cca07024455ec3
2021-03-09 17:57:31 +00: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
Maciej Żenczykowski
993ede170f 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: Ia43b04a9974288f6447e453cd645831b8efe6ca6
2021-03-05 07:02:16 +00:00
Lorenzo Colitti
d1ea11ed6a 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: I0260aa93cbf2e8179de8bb7a13b65ca47fb0493d
2021-03-05 07:02:12 +00:00
Maciej Żenczykowski
b908e0c867 Merge "bpf offload - add a new 'tether_xdp_devmap'" 2021-03-05 06:03:02 +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
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
Remi NGUYEN VAN
bc1bdf4a85 Merge "Add dependency on system API in connectivity" 2021-03-01 01:07:19 +00:00
Remi NGUYEN VAN
74b274424a Add dependency on system API in connectivity
The system API are moved to the connectivity module: add dependency on
the stubs from framework-tethering.

This only allows tethering to depend on system API defined by the
connectivity classes, not on any private code, even if they are
eventually bundled in the same APEX.

Bug: 171540887
Test: m

Merged-In: Iebfb3e01c5d2480e84edcfc76cf489520bd60237
Merged-In: Ic2491f04880ff66abc3b2d3aaee6168e18f6d68a
(clean cherry-pick from internal branch)

Change-Id: Iebfb3e01c5d2480e84edcfc76cf489520bd60237
2021-02-26 19:36:06 +09:00
Remi NGUYEN VAN
62a1ba2d1b Merge "Add flag to force choosing upstreams automatically" am: e43c960d50 am: a474b9edfa
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1596352

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iaef23446e43ef557521785a23e5dcf81655d7f05
2021-02-26 10:01:35 +00:00
Treehugger Robot
f14f0783aa Merge "ebpf offload: bump size of ipv4 tethering maps" am: fcd5ec1971 am: f1a420808c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1608893

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I315667fba6cafe2e43e217a3fd430cbd219f849e
2021-02-26 06:57:11 +00:00
Treehugger Robot
0057b06d90 Merge "ebpf offload: mark as critical for tethering not netd" am: 4945772ba7 am: 9ea87036a8
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1607252

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ifa82c02dee9bad56257d3834c16091f19f7cdd41
2021-02-26 06:57:05 +00:00
Remi NGUYEN VAN
e43c960d50 Merge "Add flag to force choosing upstreams automatically" 2021-02-26 06:42:00 +00:00
Treehugger Robot
fcd5ec1971 Merge "ebpf offload: bump size of ipv4 tethering maps" 2021-02-26 05:43:07 +00:00
Treehugger Robot
4945772ba7 Merge "ebpf offload: mark as critical for tethering not netd" 2021-02-26 05:39:07 +00:00
Maciej Żenczykowski
8549af9f17 ebpf offload: bump size of ipv4 tethering maps
For ipv6 we need 1 entry per client, so 64 seems like plenty,
while for ipv4 we need 1 entry per flow, so even 1024 seems
like it might not be enough, but it's much better than 64.

Nucca says:
  # cat proc/sys/net/netfilter/nf_conntrack_buckets
  65536
  # cat proc/sys/net/netfilter/nf_conntrack_max
  262144

  per https://www.kernel.org/doc/Documentation/networking/nf_conntrack-sysctl.txt
  the default “nf_conntrack_max” is “nf_conntrack_buckets * 4”.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ib7d1d8c19bc688c442d842cf5c9f45cdf1241754
2021-02-25 19:11:39 -08:00
Maciej Żenczykowski
607d6dda0d ebpf offload: mark as critical for tethering not netd
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I5bccfcbababb09a412ac1093513ad93c254b349b
2021-02-25 19:10:01 -08:00
Lorenzo Colitti
33b3e53faa Use the R checkAndNoteWriteSettingsOperation method.
In S, there is a new overload that takes an attribution tag as
well. Don't use this method yet, and add a TODO to call it via
a shim.

Bug: 167645754
Test: m com.android.tethering
Ignore-AOSP-First: needed to sync mainline-prod with AOSP
Change-Id: Ib49a73aa28d3abfc1b8f1cdad84abb022c49efe8
Merged-In: Ib0ac49609e444a53a6fee4575f5078e15f364eef
2021-02-25 16:53:26 +09:00
Lorenzo Colitti
50caf56267 Revert "Revert^2 "Add service-connectivity to tethering APEX""
As part of syncing the tethering code from AOSP to mainline-prod,
revert the changes to the build file that added the connectivity
jar and made the module no longer updatable.

The intent is to build and release the tethering module in
mainline-prod, from latest AOSP code, without including the
connectivity code, which depends on S APIs.

This reverts commit 2812f607a0.

Bug: 167645754
Test: m com.android.tethering
Ignore-AOSP-First: needed to sync mainline-prod with AOSP
Change-Id: Ic2491f04880ff66abc3b2d3aaee6168e18f6d68a
Merged-In: Ib0ac49609e444a53a6fee4575f5078e15f364eef
2021-02-25 16:53:24 +09:00
Lorenzo Colitti
09074df188 Merge remote-tracking branch 'goog/rvc-qpr-dev-plus-aosp' into merge-sc-dev-plus-aosp-then-rvc-qpr-dev-plus-aosp
This CL merges rvc-qpr-dev-plus-aosp on top of sc-dev-plus-aosp
on top of mainline-prod. It picks up changes that were merged
into aosp/master before sc-dev-plus-aosp was on the path between
AOSP and master. One such very simple CL is aosp/1554765.

There were no merge conflicts.

Current diffstat with aosp/master is:
 97 files changed, 2219 insertions(+), 84 deletions(-)

This includes 1800 lines of translations added in 72 files like
Tethering/res/values-*/strings.xml

Bug: 167645754
Test: no merge conflicts
Test: didn't even try to build
Ignore-AOSP-First: this is a merge from AOSP
Change-Id: I63af0b95e2d0e6bddc217c29014c03ea0dbda6ec
Merged-In: Ib0ac49609e444a53a6fee4575f5078e15f364eef
2021-02-25 16:23:06 +09:00
Lorenzo Colitti
ad38d27ebb Add a BpfMap#clear method. am: ffb0ccd04b am: 10be22076e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1604974

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I1e4d5e6005cdd006ddd814692714fb80a6c46936
2021-02-24 12:30:56 +00:00
Lorenzo Colitti
4d09a87075 Move definitions used by tethering bpf code into the module. am: 56be03eb28 am: 69b0769eb0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1601855

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I842250d341916f7d5a1f48ba8ec09c4235d20d51
2021-02-24 06:59:26 +00:00
Lorenzo Colitti
ffb0ccd04b Add a BpfMap#clear method.
A caller can mostly already do this via forEach(), but having a
specific method is faster (since the code does not need to read
the value) and easier to use.

The semantics of this method (e.g., ignore ENOENT while deleting
a key, but throw on any other error) match those of the native
BpfMap::clear method.

Test: new unit tests
Change-Id: I5cd32efd0f87c823cd2d0a2fa3a95a83093fb6f9
2021-02-24 06:09:46 +00:00
Lorenzo Colitti
56be03eb28 Move definitions used by tethering bpf code into the module.
Bug: 167645754
Test: m com.android.tethering
Change-Id: Ia4fb1201e5f4e0c35baba7865b26b4cec0945a64
2021-02-24 12:16:05 +09:00
Remi NGUYEN VAN
b4859198f5 Add flag to force choosing upstreams automatically
The flag allows overriding the value of config_tether_upstream_automatic
on released R devices, as issues have been found on devices where an
overlay was used to set it to false.

The flag is only usable on R devices, as S devices can either not set
the setting to false, or fix the underlying issues.

Bug: 173068192
Test: atest TetheringCoverageTests

Change-Id: Id99638916e08e596fab21cedd7bfe39906ce2fe5
2021-02-22 05:30:04 +00:00
Bob Badour
a3f610a7b2 Merge "[LSC] Add LOCAL_LICENSE_KINDS to packages/modules/Connectivity" am: f5b346ed1d am: c384c677ef
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1587901

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I2f5af6eb56b232f1b79ff48ca6824f2ec726f01a
2021-02-19 07:48:38 +00:00
Bob Badour
f5b346ed1d Merge "[LSC] Add LOCAL_LICENSE_KINDS to packages/modules/Connectivity" 2021-02-19 06:23:22 +00:00
Tomasz Wasilczyk
6b10dc120d Merge "Don't crash Tethering service when WiFi feature is missing" am: 736f8ec55a am: 5278b64768
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1577289

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ice05e20436c5bab99e72f61179df055c657cc248
2021-02-18 20:30:16 +00:00
Tomasz Wasilczyk
736f8ec55a Merge "Don't crash Tethering service when WiFi feature is missing" 2021-02-18 18:20:28 +00:00
Treehugger Robot
8f356c1608 Merge "Use networkstack_client instead of aidl_interface" am: 319064f284 am: 8cd484f656
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1560399

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I8695d8cc740df456cb1cc9e38dbfdb4432452f7e
2021-02-18 15:28:40 +00:00
Treehugger Robot
9b23f59e33 Merge "Add tethering-module-sdk build target." am: c4127ef16c am: f6f3456ae7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1587662

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I8ebd51517170934130e27c28b86f794081cb5198
2021-02-18 14:58:23 +00:00
Treehugger Robot
319064f284 Merge "Use networkstack_client instead of aidl_interface" 2021-02-18 13:31:54 +00:00
Treehugger Robot
c4127ef16c Merge "Add tethering-module-sdk build target." 2021-02-18 12:05:46 +00:00
Treehugger Robot
d201e37561 Merge "Set updateable:false explicitly in apex rules." am: c72a6cae30 am: 89cd911569
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1590053

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I073da66ae98c1de75870ba2da1e5504a319902b2
2021-02-18 10:24:59 +00:00
Maciej Żenczykowski
aedd2eacd8 ebpf offload - rename PUNT/DROP to TC_PUNT/TC_DROP am: e982f091e1 am: 4248054e08
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1591369

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ie259ca96bd3e0e693cda96c89825675f0a2879b0
2021-02-18 10:24:50 +00:00
Maciej Żenczykowski
2ef44d9cef ebpf offload - add support for tethering of ipv4 udp am: e4a726a5c6 am: 1f6bed0155
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1591368

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib22a34dd4c0f1c072ccb2120eaeda51da79a44a3
2021-02-18 10:10:05 +00:00
Treehugger Robot
c72a6cae30 Merge "Set updateable:false explicitly in apex rules." 2021-02-18 09:30:33 +00:00
Maciej Żenczykowski
63a3a118b9 Merge "ebpf offload - do L4 header present check earlier" am: 2c0edb112f am: 9b833afa0a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1591367

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ida5efa2217eb8f25eb4a7a7b73b783aa56469e60
2021-02-18 07:52:08 +00:00
Maciej Żenczykowski
e982f091e1 ebpf offload - rename PUNT/DROP to TC_PUNT/TC_DROP
because it is not appropriate for use in XDP programs

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ibd5dac9676bae7aa5f10fbcfd777291f72bec819
2021-02-18 06:40:33 +00:00
Maciej Żenczykowski
e4a726a5c6 ebpf offload - add support for tethering of ipv4 udp
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I6229e33cb219e9acd14f5b880cfa2ea0a34442f4
2021-02-18 06:38:36 +00:00
Maciej Żenczykowski
82ee26be75 ebpf offload - do L4 header present check earlier
and more importantly unconditionally.  This requires less effort
on the part of the in-kernel bpf verifier.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ibaa94bf096fc81c4d984dfabf515131b1c81ef09
2021-02-18 06:23:32 +00:00
Tomasz Wasilczyk
3cbccdb6c3 Don't crash Tethering service when WiFi feature is missing
Bug: 175430552
Test: disable WiFi feature on device with wlan0

Change-Id: Ie8b422ed6e0a0a98eb1c7e6072464859d9083ba5
2021-02-17 15:36:05 -08:00
Mathew Inwood
adfc933979 Set updateable:false explicitly in apex rules.
Currently, this is the default so this is a no-op,
But the default is changing to true.

Bug: 180375550
Test: Treehugger
Change-Id: Ib841e474ab2b2ff2b54c160bb06c3bbbeea92675
2021-02-16 14:58:27 +00:00