Commit Graph

2012 Commits

Author SHA1 Message Date
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
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
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
Ken Chen
5fabfd8dd0 Merge "[NETD-BPF#3] Relocate Tethering/bpf_progs and rename bpf_tethering_headers" 2021-12-02 12:54:01 +00:00
markchien
13e5a48cb7 Support testing upload/download packets
This is a preparing CL to test the packets sent from clients and the
packets replied from remote side.

Bug: 183166581
Test: atest EthernetTetheringTest
Change-Id: I898de024c0d9ecf13d81023035242c4abf856702
2021-11-29 18:02:24 +08:00
Chiachang Wang
3bc5276568 Enable strict_updatability_linting in connectivity src
Bug: 188851968
Test: m lint-check
Change-Id: I3cd06ea16f05cb37d9369a48dd0285d8239fd764
2021-11-26 10:31:58 +08:00
Treehugger Robot
edfb9232f0 Merge "better compatibility for unusual Qualcomm/Mediatek cellular ARPHRD_* values" 2021-11-26 01:25:13 +00:00
Maciej Żenczykowski
23ff703f7a better compatibility for unusual Qualcomm/Mediatek cellular ARPHRD_* values
see kernel/private/wembley/+/refs/heads/tm-4.19/include/uapi/linux/if_arp.h
which has #define ARPHRD_PUREIP 520 (and is a Mediatek based device)

or Qualcomm based Pixel 3 and older kernels (<=4.9) which #define ARPHRD_RAWIP 530
(unlike Pixel 4/5 which are 4.14/4.19 and use the upstream ARPHRD_RAWIP of 519)

We stop supporting 520/530 starting with 5.11+ since those as GKI 2.0 only kernels
cannot be using non-upstream-ed constants (btw. this is probably true for 5.10-S
as well, but let's play it safe).  For pre-5.11 we're lucky because even now
(with 5.15 released) upstream has yet to define an ARPHRD_* for either one of
520 or 530, so there's no harm in 'squatting' on this unused space.

This approach also means there's absolutely no change in behaviour on
pre-launch-T devices, since they all are at most running 5.10 kernels.

We'll be able to get rid of this code in the far future once we stop shipping
mainline tethering updates to pre-5.10 Mediatek or pre-4.14 Qualcomm devices.
This will likely be many years.

Test: TreeHugger
Bug: 207057951
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I767b5fc56bc826e088507aea8ae7a30aa8aa424a
2021-11-25 11:03:58 +00:00
Mark Chien
0f56af4162 Merge "Add defaults to enable/disable connectivity/tethering next" 2021-11-24 07:05:00 +00:00
markchien
598a75ba8c Add defaults to enable/disable connectivity/tethering next
The defaults can be used to enable/disable connectivity next targets
depending on the branch, while minimizing merge conflicts.

The "next" target may use unstable APIs. It need to be disabled in the
branch which only have the last stable SDK available.

Also correct TetheringTestsLatestSdkLib which should use stable API.

Test: TH
Change-Id: I00d91bbd513277c1cedf67d18ac9f56cc4037309
2021-11-24 12:20:23 +08:00
Ken Chen
bb57fa9eec [NETD-BPF#3] Relocate Tethering/bpf_progs and rename bpf_tethering_headers
The folder is currently used by tether offload only. Because we will
move netd.c and clatd.c to it, the folder should be moved to the upper
tier.

Also, rename bpf_tethering_headers to bpf_connectivity_headers so that
other connectivity code besides to tethering are justified to use it.

Bug: 202086915
Test: atest FrameworksNetTests
Change-Id: I95943c6e909f1fdca12604ef0c55d67c39ca686b
2021-11-20 18:31:08 +08:00
Maciej Żenczykowski
c8c36b9407 isEthernet() - ARPHRD_PPP does not require ethernet headers
(this is required to make ipv6 tethering work with at least S.LSI modems)

Test: TreeHugger
Bug: 207057951
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ic178db928ec7f74f69d7d4739b3b8439ff026625
2021-11-18 23:31:56 -08:00
Maciej Żenczykowski
a457bf7ea8 explicitly specify that offload.o & test.o bpf programs are S+
Note: due to the release version of the Connectivity/Tethering mainline
module being built from sc-mainline-prod, this won't actually take effect
until system/bpf bpfloader at version 0.6+ is merged in to that tree.

This doesn't really matter, since currently things default to v0.0+.
But there is no mainline module updatable pre-v0.2 supported OS
anyway. BpfLoader v0.2 is what shipped in Android S Beta 4 through
Android S Final.

Before S there simply was no bpfloader support for mainline updatable
ebpf code, while S Beta 3 and earlier shipped v0.0 which is badly
incompatible with even the current version of the mainline module.

Additionally v0.0 doesn't even parse this field, while v0.1 which
does was very short lived [~3 days] and can thus be utterly ignored.

As such this change is effectively a no-op, and even post merge
of bpfloader v0.6+ into sc-mainline-prod will still be effectively
a no-op.

So why do it? I want to explicitly document that these programs are S+,
so that I can change the default in the future to be T+.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I7e5d0124700c7045abe16b1f3b504c9e88054ff2
2021-11-17 12:04:44 -08:00
Maciej Żenczykowski
ff81692077 Merge changes from topics "rename-libbpfmapjni", "rename-libtetherutiljni"
* changes:
  Rename libbpfmapjni and include bpf common util library
  Rename tethering jni and get the jni by its package name
2021-11-11 13:19:48 +00:00
markchien
782a56809b Rename libbpfmapjni and include bpf common util library
1. libbpfmapjni.so is rename to libnet_utils_device_common_bpf.so
2. net-utils-device-common-bpf.jar is separated from
   net-utils-device-common-netlink.jar

Bug: 205088391
Test: atest TetheringTests
      atest CtsTetheringTest
      atest TetheringPrivilegedTests

Change-Id: If59b35b3429ebd597c18678499ff458183f89026
2021-11-11 13:49:15 +08:00
Mark Chien
ea0cfd1897 Merge "Rename tethering util folder and its package name" 2021-11-10 06:08:28 +00:00
markchien
f967b11087 Rename tethering jni and get the jni by its package name
tetherutiljni is renamed to com_android_networkstack_tethering_jni_util

Bug: 205088391
Test: atest TetheringTests
      atest CtsTetheringTest
      atest TetheringPrivilegedTests
Change-Id: Ifd1f4473625e33d3ebe190c9f8a2b5d54aa1ff49
2021-11-10 14:07:24 +08:00
markchien
d02f9af918 Rename tethering util folder and its package name
Move tethering util files from android.net.util into
com.android.networkstack.tethering.util. The goal is move all of
tethering internal files into its own namespace
com.android.networkstack.tethering.util.

Bug: 205088391
Test: atest TetheringTests
      atest CtsTetheringTest
      atest TetheringPrivilegedTests

Change-Id: I6559fb4f873b3cad5b210b10e49df1b6c6914a70
2021-11-09 17:02:47 +08:00
Remi NGUYEN VAN
959d2cb6bd Don't rematch all requests when adding new ones
With the network selection rewrite in S, rematching a single request can
now easily be done; this can be used as an optimization in
handleRegisterNetworkRequests to avoid rematching all requests when
registering a new one.

This can be disabled by a flag that is unset by default,
REMATCH_ALL_REQUESTS_ON_REGISTER.

Test: atest ConnectivityServiceTest
Change-Id: If76f79b41ac88863974f7025624667134bea2570
2021-11-08 19:17:57 +09:00
Treehugger Robot
7269fb17fd Merge "Add TetheredInterface{Request, Callback} interface" 2021-11-08 09:54:54 +00:00
markchien
48e271bdcb Add TetheredInterface{Request, Callback} interface
Define interfaces that match the signature of the existing
EthernetManager.TetheredInterfaceRequest and TetheredInterfaceCallback
classes and make EthernetManager.TetheredInterfaceRequest and
TetheredInterfaceCallback implement/subinterface these interfaces. The
new bluetooth API could also implement these interfaces to make API surface
consistent.

Test: TH would test the existing tests that use the subclass.
Bug: 190438212
Change-Id: I093972c111cb1d921076782492716d5a046be8fc
2021-11-08 16:44:34 +08:00
Mark Chien
7509c7a67e Merge "Separate tethering build target to Tethering and TetheringNext" 2021-11-08 07:29:55 +00:00
markchien
5a8c806e55 Separate tethering build target to Tethering and TetheringNext
To avoid much code diverge between aosp and its downstream, we need to
separate the build target which build with latest stable sdk in release
branch and build with unfreeze sdk in dev branch. So we could use new
API with APIshim in dev branch without impacting release branch.

BYPASS_INCLUSIVE_LANGUAGE_REASON=the wording is the file name of
existing file.
Bug: 204265450
Test: m
Change-Id: I949fd83b1eed7461e0b381193b190cf15080bc1b
2021-11-04 08:53:12 +00:00
markchien
45dc794fb4 Fix TetheringPrivilegedTests crash
After separat BpfMap to a library, its package name is jarjar to
com.android.network.stack.util*. Also jarjar BpfMap of
TetheringPrivilegedTests to fix crash in jni registered.

Bug: 179733303
Test: atest TetheringPrivilegedTests
Change-Id: Ia9bc819a44fe26bf2ff7a46351ea60f2eeb02933
2021-11-04 16:40:18 +08:00
Maciej Żenczykowski
bb4c6073ec Merge "bpfmap: Move to Common Location" 2021-11-04 01:50:15 +00:00
Kimberly Kreider
200e42063c Merge "Replace "mts" with "mts-tethering"." 2021-11-01 23:43:53 +00:00
Mark Chien
3a5c822ec1 Merge "Log received wifiP2p intent into dumpsys for debugging" 2021-11-01 08:04:55 +00:00
Tyler Wear
e8043ca762 bpfmap: Move to Common Location
Move bpfmap to frameworks/libs/net/common/native.

Bug: 179733303
Change-Id: Id08b216ec6a64968d66d7990f91ea7ce222a1154
2021-10-29 09:05:33 -07:00
Chalard Jean
adcec9ebbe Move to f/l/n instead of RouteUtils
Test: TetheringTests
Change-Id: I35b36538463a7fc2f02e142719c898d1694b2d6b
2021-10-29 16:05:46 +09:00
markchien
eb8599c4e3 Log received wifiP2p intent into dumpsys for debugging
Bug: 201480425
Test: m
Change-Id: I527c894eff3c068080995333ab8b372ab2aa38a0
2021-10-29 14:45:14 +08:00
Kimberly Kreider
c5b3f34831 Replace "mts" with "mts-tethering".
Bug: 203466102
Test: build locally and verified contents
Change-Id: I7cccb54c0ad1a3bd8da0bcb7ad6474aa1e734299
2021-10-20 18:16:59 +00:00
Treehugger Robot
5dc1edd9a8 Merge "Dependency update for StateMachine" 2021-10-20 13:43:58 +00:00
Chalard Jean
7949b8c557 Merge "Cleanup shims usage in Tethering" 2021-10-20 13:06:24 +00:00
Chalard Jean
732ebcbc7f Cleanup shims usage in Tethering
Now that S has gone to AOSP, this dependency is no longer
needed. It is, on the contrary, harmful as it prevents us
from adding shims that depend on T APIs in AOSP.

Test: builds
Change-Id: I64f0f394e826e58a9b7e772043bb6008428892e6
2021-10-20 19:44:09 +09:00
Treehugger Robot
f8d1f3d1cd Merge "Unregister the tethering internal callback in finalize" 2021-10-20 08:40:08 +00:00
Treehugger Robot
9d0c5419c9 Merge "Test TetheringManager could be GC after getting connector" 2021-10-20 07:48:10 +00:00
markchien
819e19ea2a Unregister the tethering internal callback in finalize
Bug: 177265744
Bug: 191798390
Bug: 187972579
Test: atest TetheringServiceTest
Change-Id: Ie7f9535b923db5073a59329ead22546a54e6ef47
2021-10-20 06:57:58 +00:00
markchien
e7b4a505aa Test TetheringManager could be GC after getting connector
There is pollingConnector thread which start polling connector if
TetheringManager is created earlier than TetheringService started(during
device boot up). TetheringManager won't be GCed if pollingConnector
thread do not finish its task yet.

Bug: 177265744
Bug: 191798390
Bug: 187972579
Test: atest TetheringServiceTest
Change-Id: Id8c7d10c5172e1d5de460c5311ff9c20261facef
2021-10-20 06:06:04 +00:00
Treehugger Robot
d7d41a73e7 Merge "Fix TetheringManager memory leak" 2021-10-20 03:59:59 +00:00
markchien
1110b725a0 Fix TetheringManager memory leak
TetheringCallbackInteranl is inner class which explicitly reference
TetheringManager object. This causes TetheringManager can't be GC. Using
static nested class which has its own lifecycle and weak reference
TetheringManager object.

Still have a leak inside Tethering that TetheringCallbackInternal is
never unregistered. Currently it rely on binder died to remove the
reference, which usually happen in kill process. If process keep alive,
the TetheringCallbackInternal would not be freed even TetheringManager is
gone. Will have follow CL to fix this.

Bug: 177265744
Bug: 191798390
Bug: 187972579
Test: 1. lunch Settings with ON/OFF tethering, dump java heap.
      2. close Settings and restart Settings again, dump java heap.
      3. Compare java heap between step 1 and step 2.
Change-Id: I0e2a21b7988115098a033a581cd98da8bffe2791
2021-10-14 14:02:11 +08:00
Treehugger Robot
1f3515bb48 Merge "Add Override anntation for TetheringConnector.setPreferTestNetworks" am: 1503bdc297
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1844178

Change-Id: Ie1f715a7b3ac4d46a25c58e799fb133dfdc55951
2021-10-04 10:00:56 +00:00
Treehugger Robot
1503bdc297 Merge "Add Override anntation for TetheringConnector.setPreferTestNetworks" 2021-10-04 09:50:19 +00:00
markchien
d3e0f2e896 Add Override anntation for TetheringConnector.setPreferTestNetworks
Test: TH
Change-Id: Idfaca3cb59580ffe4ee194466ad2ba8f47d8fac4
2021-10-04 16:14:08 +08:00
William Escande
ea9e22e10b Dependency update for StateMachine
StateMachine was in a custom filegroup in base.
It's now built in stand-alone library in modules-utils.

Bug: 198418216
Tag: #refactor
Test: Build
Merged-In: I7499fad6c4c5076e2bd98f0d9f91c5f243fb1ed2
Change-Id: I7499fad6c4c5076e2bd98f0d9f91c5f243fb1ed2
2021-10-01 17:06:42 +02:00