Commit Graph

2054 Commits

Author SHA1 Message Date
Treehugger Robot
baefbc3375 Merge "Move IpSec APIs to Connectivity module" 2022-02-10 11:45:21 +00:00
Aaron Huang
2e778ee46b Move IpSec APIs to Connectivity module
(cherry picked from commit 68ca373929)
Bug: 204153604
Test: TH
Change-Id: If4afabdc65ed2ac3e918af1d4a03c4c9173c4a3c
Merged-In: If4afabdc65ed2ac3e918af1d4a03c4c9173c4a3c
2022-02-10 14:25:04 +08:00
Remi NGUYEN VAN
85a4e07826 Add visibility for core tests
Allow core tests to use hidden connectivity APIs. Benchmark tests in
particular cannot be run without these.

Ignore-AOSP-First: Avoiding merge conflicts, cherry-pick will follow
Bug: 197717846
Test: m
  (cherry-picked from ag/16772124)
Change-Id: Ia01f24317d14b063f9a7e24c3ada11b140641c50
Merged-In: Ia01f24317d14b063f9a7e24c3ada11b140641c50
2022-02-09 23:08:37 +08:00
Nucca Chen
34e16b9537 Merge "Move Tether4Key and Tether4Value to common libs" 2022-02-09 13:53:41 +00:00
Hungming Chen
887a22cc4a Move Tether4Key and Tether4Value to common libs
EthernetTetheringTest needs to parse BPF map content for IPv4
forwarding rule tests. Move the struct class files to common
libs.

Compare Tether4{Key, Value}.java between frameworks/libs/net/common
and packages/modules/Connectivity/Tethering.
There is only the package name change as expected.

$ diff packages/modules/Connectivity/Tethering/src/com/android/networkstack/tethering/Tether4Key.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/Tether4Key.java
17c17
< package com.android.networkstack.tethering;
---
> package com.android.net.module.util.bpf;

$ diff packages/modules/Connectivity/Tethering/src/com/android/networkstack/tethering/Tether4Value.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/Tether4Value.java
17c17
< package com.android.networkstack.tethering;
---
> package com.android.net.module.util.bpf;

Test: atest TetheringCoverageTests

Change-Id: I73c180fa4129aefde1e64ecbafe928f388b061d6
2022-02-09 10:45:37 +00:00
Aaron Huang
720ad7c026 Have connectivity targets be visible to Frameworks[Vcn|Ike]Tests
(cherry picked from commit 7174ac3d86)
Bug: 204153604
Ignore-AOSP-First: part of large topic that only builds internally
Test: build, FrameworksVcnTests, FrameworksIkeTests
Change-Id: I40740200fe4a7476a21bb5330429a11c97e38fb8
Merged-In: I40740200fe4a7476a21bb5330429a11c97e38fb8
2022-02-08 14:31:27 +00:00
Patrick Rohr
f7d2824956 Merge changes from topic "move-testbpfmap"
* changes:
  Extract TestBpfMap from BpfCoordinatorTest.
  Add jarjar rule for com.android.testutils.TestBpfMap
2022-02-04 12:37:50 +00:00
Lorenzo Colitti
1705eb9964 Extract TestBpfMap from BpfCoordinatorTest.
The class is being moved to a common test utils location in
another CL in this topic.

Test: atest BpfCoordinatorTest
Change-Id: Ibf8dae3e05aacaea4f7c3fe8229d87e1ad6a68d5
2022-02-03 22:53:07 +01:00
Patrick Rohr
3157918fc9 Add jarjar rule for com.android.testutils.TestBpfMap
TestBpfMap needs to be jarjar'ed to work with ConnectivityCoverageTests
which combines both framework tests and tethering tests (and their
respective jarjar rules).

Test: atest ConnectivityCoverageTests:BpfCoordinatorTest
Change-Id: Ie3e7f0be9aeb848978f0df97be48100c808086bc
2022-02-03 22:53:07 +01:00
Maciej Żenczykowski
2f7dac1bad remove spurious headers
bpf_connectivity_headers already pulls in bpf_headers,
which already pulls in bpf_syscall_wrappers.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ib22da8d433bd3187349f06f41ec064360c38982f
2022-02-02 16:38:36 -08:00
Treehugger Robot
35e2ab4c11 Merge "Remove libtcutils from dependencies as it is included in lib bpfjni" 2022-02-02 22:34:51 +00:00
Maciej Żenczykowski
d9025190fa Grant 'w' rights to for-system subdirectory for root.
This is basically a no-op since the apex/fs is r/o anyway,
but it appears like it might help the emulator build...

Test: N/A
Bug: 217565060
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I5e9c9fb41687aa5a4b15ff2bf21eafecada726a8
2022-02-02 20:54:53 +00:00
Patrick Rohr
8dfcb14be3 Remove libtcutils from dependencies as it is included in lib bpfjni
Test: builds && boots
Change-Id: Iacaed446655a606399188b8e5e4a5e98fefee121
2022-02-02 19:40:12 +00:00
Remi NGUYEN VAN
6a20eeda42 Reorganize connectivity framework dependencies
Allow framework-connectivity to depend on framework-connectivity-t
stubs, and framework-connectivity-t to depend on prebuilt (to avoid
circular dependencies) framework-connectivity stubs to compile its own
stubs, and framework-connectivity.impl to compile its implementation.

Also reorganize jarjar rules so that service and framework jar can use
static libraries in framework-connectivity without packaging their own,
reducing duplicate code.

Bug: 204830222
Test: m
Change-Id: I75c34986e7c479de23cdb2e9b360fa1fede018c9
2022-02-01 13:33:48 +09:00
Maciej Żenczykowski
76709a18e9 Merge changes Ifd6be50a,I857e40c9,I1b9f4fde,Ib3b43cf2
* changes:
  Prevent native_init from starting TrafficController
  Remove libutils dependency from libservice-connectivity
  Merge libtraffic_controller_jni into libservice-connectivity
  [NETD-TC#15] Make ConnectivityService and PermissionMonitor calls BpfNetMaps on T
2022-02-01 03:02:36 +00:00
Patrick Rohr
361b859b00 Merge libtraffic_controller_jni into libservice-connectivity
There is not really a point to separate these two as they are all used
in ConnectivityService.
As a future TODO, we might want to rename libservice-connectivity to
libcom_android_server_jni to be more inline with the jarjar'ed jni lib
versions.

Test: atest FrameworksNetTests:ConnectivityServiceTest
Change-Id: I1b9f4fde345038bda6b3ffcf8e3f47cf9262e052
2022-01-31 16:18:51 +01:00
Ken Chen
1647f60d66 [NETD-BPF#19] Mainline part of bpf code from netd
1. Add libnetd_updatable.so in com.android.tethering. The library is
loaded by netd. Currently, it mainly targets on a few functions which
access BPF maps. The functionality may extend in the future.

2. Attach gcroup progs from libnetd_updatable.so.

3. Move (privileged)TagSocket and untagSocket implementation to mainline
module. Combine privilegedTagSocket and untagSocket into a single
function.

4. Split related unit tests from netd_unit_test to
libnetd_updatable_unit_test as well.

Bug: 202086915
Test: cd system/netd; atest
Test: atest TrafficStatsTest NetworkUsageStatsTest

Change-Id: Ib556458103a4cbb643c1342d9b689ac692160de0
2022-01-30 09:51:25 +08:00
Treehugger Robot
2be7b1d5fb Merge "Conditionally disable TetheringApiCurrentLib" 2022-01-28 05:21:22 +00:00
Lorenzo Colitti
2a947ceb50 Merge changes from topic "dscp_policies"
* changes:
  Don't enable DscpPolicyTracker on pre-T devices.
  Allow service JNI in FrameworksNetIntegrationTests.
  Don't manually load the JNI library in DscpPolicyTracker.
  Process DSCP QoS events for policies
  Allow using BpfMap and TcUtils in unit tests.
2022-01-27 23:25:54 +00:00
Remi NGUYEN VAN
e9370c5ef4 Merge "Add var to enable/disable tethering next APEX" 2022-01-27 11:41:26 +00:00
Tyler Wear
723882126a Process DSCP QoS events for policies
New events to handle adding and removing of DSCP QoS policies.
Async indication sends status back to client if the policy
has been added, failed, or if the policy limit has been
reached.

Bug: 202871011
Change-Id: I7988d22ae625ad0dd415927d2943de4a749e6fb8
2022-01-27 10:19:27 +00:00
Remi NGUYEN VAN
f826bce37a Conditionally disable TetheringApiCurrentLib
The "current" targets are only necessary in branches that can use
non-stable APIs, and can fail to build otherwise.

Apply ConnectivityNextEnableDefaults so they are disabled on such
branches. Also deprecate NetworkStackNextEnableDefaults, so
ConnectivityNextEnableDefaults is used everywhere.

Bug: 190249673
Test: m
Change-Id: I1b152f3cc22f1bed6444d280f0066e480980e949
2022-01-27 18:49:19 +09:00
Remi NGUYEN VAN
f24553d950 Add var to enable/disable tethering next APEX
This is necessary to disable the .inprocess APEX, in branches that only
use stable APIs, as it depends on unstable stubs. override_apex does not
support defaults.

Bug: 190249673
Test: m
Change-Id: Ib4a27b65f3c5b6d4b0ac69e85cf671038efc5744
2022-01-27 13:21:25 +09:00
Roopa Sattiraju
27acf0b677 Adding bt dependency
Bug: 206121418
Test: Compile
Merged-In: I92f3971ba1bb7e873166482f7051dcd2b9df5bf2
Change-Id: I92f3971ba1bb7e873166482f7051dcd2b9df5bf2
2022-01-25 20:27:30 -08:00
Maciej Żenczykowski
e04edee45f make clatd 0755 instead of 0555
Bug: 215897658
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I4c5fa8b4cd07a6e2ca2128943336a7a5d05712d4
2022-01-24 19:27:15 +00:00
Wayne Ma
790c83e387 [NETD-TC#14] Add traffic controller JNI to tethering module
This CL provides native methods to access BPF maps via a native library.

Bug: 202086915
Test: m; flash; boot;
Change-Id: I2e5d03d0c2e31ba11996d1b28ead9b552397fe29
2022-01-24 00:22:26 +08:00
Treehugger Robot
29d5f0adbe Merge "bump tethering tc prio to make room for rate limiting" 2022-01-21 18:19:43 +00:00
Mark Chien
ceeebae37e Merge "Use new bluetooth API to enable/disable bt tethering after T" 2022-01-21 08:43:53 +00:00
Maciej Żenczykowski
849b3aadc4 move clatd.c bpf program to mainline
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I7e88fcc34c21695e844d607836df4661790cba03
2022-01-20 21:00:22 -08:00
Maciej Żenczykowski
1f36542d1e Merge "Move netd.c to Tethering module" 2022-01-21 02:42:35 +00:00
Ken Chen
587d4231fc Move netd.c to Tethering module
This is a clean move. The content of netd.c is not changed. The object
name is still netd.o. But the module name is renamed to netd.o_mainline
to avoid name collision in sc-mainline-prod branch.

Modified Android.bp according to the file location. The sub_dir is
newly specified. The object file will be compiled to:
- apex/com.android.tethering/etc/bpf/net_shared/netd.o

The extracted programs and maps will be in:
- sys/fs/bpf/net_shared/

The netd.o will not be loaded in pre-T because the bpfloader before T
does not load objects from paths other than:
- apex/com.android.tethering/etc/bpf/
- /system/etc/bpf/

Bug: 202086915
Test: cd system/netd; atest
Test: atest TrafficStatsTest NetworkUsageStatsTest
Change-Id: I5281c851341f9258a37d8aad6da4196c06342940
2022-01-21 07:40:33 +08:00
Patrick Rohr
b194dfe04b Add proguard rules for TcUtils
Without this, proguard strips tcFilterAddDevIngressPolice (as its unused
inside the Tethering apk) and crashes the system.

Bug: 202086915
Bug: 157552970
Test: device boots
Change-Id: I3f29a2d2371ecbfad929f8812f7f15f68258b5d1
2022-01-20 22:11:57 +01:00
Remi NGUYEN VAN
24b3c37e0a Prepare T build rules for backwards compatibility
- Add a default to framework-connectivity-tiramisu for disabling
  T-only build rules.
- Separate the tiramisu hidden apis from hiddenapi txt files, so
  that the framework-connectivity-tiramisu file can avoid being
  referenced by the APEX when the JAR is not part of it.

Bug: 206893064
Test: m
Merged-In: I37c7385b456e4d71789aafe33cc8375adf40a681
Change-Id: I37c7385b456e4d71789aafe33cc8375adf40a681
2022-01-20 13:57:44 +08:00
Paul Hu
a77cad355b Merge "Build framework-connectivity-tiramisu library" 2022-01-20 03:02:56 +00:00
markchien
69681d65a5 Use new bluetooth API to enable/disable bt tethering after T
This change only apply to the device after T.
Use new bluetooth API to change bluetooth tethering settings and the
new API provide the callback to to notify Tethering when bluetooth
interface is ready. Tethering doesn't use bluetooth interface status
change event from netlink to add/remove IpServer anymore.

Tag: #feature
Bug: 190438212
Test: TetheringTest
Change-Id: Iae92d98d500f83b116da7282cf1130fb8fecf53d
2022-01-17 16:47:43 +08:00
Hungming Chen
f9d40ae77a Set the permission to file clatd and directory for-system
Set clatd privs to clat:clat:-r-sr-sr-x and set its parent
directory privs to root:system:dr-xr-x---. Makes sure that
only root and system group members can execute the binary.

Test: flash and check the file permission

$ adb shell ls -lZ /apex/com.android.tethering/bin
dr-xr-x--- 2 root system u:object_r:system_file:s0  4096 1970-01-01 08:00 for-system

$ adb shell ls -lZ /apex/com.android.tethering/bin/for-system
-r-sr-sr-x 1 clat clat u:object_r:clatd_exec:s0  24352 1970-01-01 08:00 clatd

Bug: 212345928
Test: test clat
1. Connect to ipv6-only wifi.
2. Make IPv4 traffic.
   $ ping 8.8.8.8

Change-Id: I9537d47b135e6e0324fb40ece2b9f7befb159244
2022-01-14 18:33:40 +08:00
Maciej Żenczykowski
bb766e83c3 Merge "Add clatd binary to apex" 2022-01-14 03:22:34 +00:00
Maciej Żenczykowski
612afc316a Merge "Move BpfUtils -- integrate TcUtils into Tethering module" 2022-01-14 02:53:15 +00:00
Patrick Rohr
a881ba3001 Move BpfUtils -- integrate TcUtils into Tethering module
Bug: 202086915
Bug: 157552970
Test: atest TetheringTests
Change-Id: Ibf9d8d568b9f890a22869e70384848e33a380d4f
2022-01-13 10:09:11 +01:00
Treehugger Robot
0d4f956b34 Merge "Bump tethering target sdk version to 31" 2022-01-13 05:00:02 +00:00
markchien
bf62258f8c Bump tethering target sdk version to 31
Also add BLUETOOTH_CONNECT permission which is needed for access
PanService if target sdk 31+. The permission would be granted to
privilege application without prompt.

Also remove the min_sdk_version 29 from AndroidManifest because it is
useless that the Android.bp already define min_sdk_version 30.

$aapt dump xmltree TetheringNext.apk AndroidManifest.xml
N: android=http://schemas.android.com/apk/res/android
  E: manifest (line=19)
    A: android:sharedUserId(0x0101000b)="android.uid.networkstack" (Raw: "android.uid.networkstack")
    A: android:versionCode(0x0101021b)=(type 0x10)0x1f
    A: android:versionName(0x0101021c)="Tiramisu" (Raw: "Tiramisu")
    A: android:compileSdkVersion(0x01010572)=(type 0x10)0x1f
    A: android:compileSdkVersionCodename(0x01010573)="Tiramisu" (Raw: "Tiramisu")
    A: package="com.android.networkstack.tethering" (Raw: "com.android.networkstack.tethering")
    A: platformBuildVersionCode=(type 0x10)0x1f
    A: platformBuildVersionName="Tiramisu" (Raw: "Tiramisu")
    E: uses-sdk (line=23)
      A: android:minSdkVersion(0x0101020c)=(type 0x10)0x1e
      A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1f
    ....
    E: uses-permission (line=35)
      A: android:name(0x01010003)="android.permission.BLUETOOTH_CONNECT" (Raw: "android.permission.BLUETOOTH_CONNECT")

Bug: 204265450
Test: manual testing bluetooth tethering and TH
Change-Id: I6f821020679b9379cada29f6f0816187545a24fb
2022-01-12 07:24:16 +00:00
Hungming Chen
378e323000 Add clatd binary to apex
Ship clatd binary with apex. This makes that the clatd binary becomes
updatable.

Bug: 212345928
Test: manual test
1. Connect to ipv6-only wifi.
2. Make IPv4 traffic.
   $ ping 8.8.8.8

Change-Id: I4f6f0944e94e165983a19a5d3c3a117274f6bbac
2022-01-11 17:02:32 +08:00
Hungming Chen
bb8e9dae7f Add tethering IPv4 UDP forwarding test
This is a preparation for testing IPv4 BPF offload.
- Add an ARP responder.
- Add a basic UDP forwarding test.

Test: atest EthernetTetheringTest
Change-Id: I720a5a2c4b97493eb6a5570cecd73dfc1eabf5cd
2022-01-03 07:16:16 +00:00
Maciej Żenczykowski
577c46a185 Merge "Add bpf jni into connectivity module" 2021-12-23 18:44:48 +00:00
markchien
8fb75e3916 Add bpf jni into connectivity module
This is the preparing CL for connectivity module to use bpf.

Bug: 179733303
Bug: 205088391
Test: atest ConnectivityCoverageTests
Change-Id: Ibe49d7f671b5050461e2c63c080d9457ad76c26c
2021-12-23 14:33:01 +08:00
Treehugger Robot
139f43509e Merge "Support testing upload/download packets" 2021-12-23 04:22:59 +00:00
Jiakai Zhang
86c139aedb Dexopt service-connectivity.
`service-connectivity` is a jar that system_server loads dynamically.
Such jars can be dexopted now. This CL adds `service-connectivity` to a
`systemserverclasspath_fragment`, which does not actually add the jar to
the classpath, but tells the build system to dexopt it.

NOTE: The corresponding `exported_systemserverclasspath_fragments` needs
to be added to the `prebuilt_apex` once a new prebuilt is dropped.

Bug: 203198541
Test: m com.android.tethering
Change-Id: I53745baaf1bc7142cc12a1e6cd8d84c9b338ac9d
Merged-In: I53745baaf1bc7142cc12a1e6cd8d84c9b338ac9d
Merged-In: I9a009493fe0482967ab1f92516514715cfd457d6
2021-12-21 09:36:33 +00:00
paulhu
802ab9760f Build framework-connectivity-tiramisu library
- Move nsd APIs and build framework-connectivity-tiramisu library
- Add nsd associated hidden apis
- Build service-connectivity-tiramisu-pre-jarjar library for
  T+ services.
- Move ConnectivityServiceInitialiizer to service-t directory
  to create S+ service instances which can avoid dependency on
  lower sdk library.

Bug: 206893064
Test: atest FrameworksNetTests CtsNetTestCases
CTS-Coverage-Bug: 207804007
Merged-In: I9628716f5c38047ff4ea2346b27589077259c436
Change-Id: I9628716f5c38047ff4ea2346b27589077259c436
2021-12-17 00:04:24 +08:00
markchien
1e020903cc Reuse BluetoothPan object and use it under tethering handler thread
1. Instead of create BluetoothPan every time when tethering need to use
it, store it with mBluetoothPan and resue it.
2. Call BluetoothPan function under tethering handler thread.

Bug: 190438212
Test: atest TetheringTests

Change-Id: I40adece59960ec44a02dc438d6bd95483a0788af
2021-12-16 12:12:07 +08:00
Chiachang Wang
81bc609550 Merge "Enable strict_updatability_linting in connectivity src" 2021-12-08 02:36:16 +00:00