Commit Graph

1407 Commits

Author SHA1 Message Date
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
Bob Badour
97e6be27f6 [LSC] Add LOCAL_LICENSE_KINDS to packages/modules/Connectivity
Added SPDX-license-identifier-Apache-2.0 to:
  Tethering/Android.bp
  Tethering/apex/Android.bp
  Tethering/bpf_progs/Android.bp
  Tethering/common/TetheringLib/Android.bp
  Tethering/tests/Android.bp
  Tethering/tests/integration/Android.bp
  Tethering/tests/mts/Android.bp
  Tethering/tests/privileged/Android.bp
  Tethering/tests/unit/Android.bp
  tests/cts/hostside/Android.bp
  tests/cts/hostside/aidl/Android.bp
  tests/cts/hostside/app/Android.bp
  tests/cts/hostside/app2/Android.bp
  tests/cts/hostside/certs/Android.bp
  tests/cts/net/Android.bp
  tests/cts/net/api23Test/Android.bp
  tests/cts/net/appForApi23/Android.bp
  tests/cts/net/jni/Android.bp
  tests/cts/net/native/dns/Android.bp
  tests/cts/net/native/qtaguid/Android.bp
  tests/cts/net/util/Android.bp
  tests/cts/tethering/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: I8534c580f0e2a17be146300b67b3604817b64507
2021-02-16 04:09:58 -08:00
Jeongik Cha
d05f990649 Use networkstack_client instead of aidl_interface
Bug: 150578172
Test: m
Change-Id: Ib5f28db973eb80942faafe1c1c5ddcaab54bf980
2021-02-16 08:20:12 +00:00
Maciej Żenczykowski
6224c0e30e offload ebpf - introduce 4.14+ ipv4 forwarding programs am: 36867351ec am: f335d68cb8
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1588019

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ie736bc216988be768dad0f7229fbc51f4d7cc40e
2021-02-16 08:20:04 +00:00
Maciej Żenczykowski
36867351ec offload ebpf - introduce 4.14+ ipv4 forwarding programs
We've backported the necessary support to all 4.14+ ACK kernels,
but we can't actually enforce that these changes will be picked
up by all devices.  Thus we can only make the full featured
implementations optional on [4.14..5.8) kernels, with a tcp-only
version for those 4.14+ devices where the full featured version
fails to load.

Note: there's still a fair bit of implementation work left
in the do_forward4() function itself.  This is really just
the skeleton.

Test: atest, TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: If78123e00d55a77f2ecd7da1547581797e23f9b2
2021-02-16 05:48:55 +00:00
Maciej Żenczykowski
be444669e3 Merge "offload ebpf - do_forward4() - introduce updatetime argument" am: d74918c6d2 am: 623479f329
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1588018

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I696c7f791dc805b71b13c64cc442675f45803ce9
2021-02-15 13:33:32 +00:00
Maciej Żenczykowski
aefa0950b5 offload ebpf - do_forward4() - introduce updatetime argument
This will facilitate providing a tcp-only version of the programs
which due to TCP's very long timeouts will not need to use the
Linux 5.8+ bpf_ktime_get_boot_ns() helpers.

Test: atest, TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I1e49b6758d3754782ac6f8820e0c15aa20e4c61d
2021-02-15 12:33:01 +00:00
Maciej Żenczykowski
5d6f744551 tethering offload ebpf - lower requirement from 5.9 to 5.8 am: b0ac41f0cd am: c456856971
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1588017

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I2a6be5ac4bbc887ef11b4fc8110115e11e947fa3
2021-02-15 12:20:22 +00:00
Maciej Żenczykowski
b0ac41f0cd tethering offload ebpf - lower requirement from 5.9 to 5.8
As this is the actual version that is required,
ie. the version that supports bpf_ktime_get_boot_ns() helper.

Test: atest, TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I2ea4830597a0bed53950a5d0c483a47208959f35
2021-02-14 22:24:34 -08:00
Hai Zhang
6d71f109bc Add tethering-module-sdk build target.
Bug: 177884752
Test: m tethering-module-sdk
Change-Id: Idd4e6743001a6402f6a5dd6832601b08d7cc0236
2021-02-14 06:38:26 +00:00
Lorenzo Colitti
531fa9e0cc Merge "Load JNI in all classes that have native methods." am: af97e51c01 am: ceafffa6c0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1581528

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I21f1af4785d1ee540ba6dea8416c2538e60a9228
2021-02-12 05:49:17 +00:00
Treehugger Robot
55e1cc23c6 Merge "fix TetheringCoverageTests" am: 6fc8229f16 am: 31ce8ad94d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1584755

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If61cbbe8729451b53aea976540d388868cdde01a
2021-02-12 05:48:49 +00:00
Lorenzo Colitti
af97e51c01 Merge "Load JNI in all classes that have native methods." 2021-02-12 03:19:00 +00:00
Maciej Żenczykowski
c92e8ce636 fix TetheringCoverageTests
Test: atest TetheringCoverageTests now passes, TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I0d83de14784f323400a83ce282cae1a3e7b4b396
2021-02-11 16:06:46 -08:00
Lorenzo Colitti
17b18ca6c2 Add IPv4 counters. am: d561b7f67c am: d2956a1964
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1580287

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic66884108ae7fde4c1688847f7b2092c8d6e941d
2021-02-10 06:54:53 +00:00
Lorenzo Colitti
6800811597 Load JNI in all classes that have native methods.
The tethering module uses JNI in various classes, but only calls
System.loadLibrary in TetheringService#makeTethering. This means
that:

1. Any test that uses a class that uses JNI must load the
   library itself.
2. Any code that runs before TetheringService#makeTethering could
   potentially crash if it uses JNI. We may never have such code
   though.

Instead, make every class that has a native method load the JNI
library itself at static initialization time. This guarantees
that the class will have the JNI code available in any context
(production, test, etc.)

System.loadLibrary is documented not to do anything if called
more than once with the same library name:
https://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#loadLibrary(java.lang.String)

and the implementation has a lock so it is safe to call from
multiple threads concurrently.

Test: builds, boots, tethering starts
Test: atest TetheringCoverageTests
Change-Id: I9c0147ae9a28877f416aaff387b426d304ae552d
2021-02-10 15:43:38 +09:00
Lorenzo Colitti
7081e9f184 Dump counters in "dumpsys tethering bpf". am: 4e92da06fa am: e033a1e543
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1575051

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib449565583901259f0c21764d566637eace5f5f8
2021-02-10 05:31:03 +00:00