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
This is the preparing CL for connectivity module to use bpf.
Bug: 179733303
Bug: 205088391
Test: atest ConnectivityCoverageTests
Change-Id: Ibe49d7f671b5050461e2c63c080d9457ad76c26c
`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
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
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
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
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
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
(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
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
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
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
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
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
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
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
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
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
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