Commit Graph

2863 Commits

Author SHA1 Message Date
Xiao Ma
161b70c587 Add NetworkStackModuleTest annotation on the specific test case.
EthernetTetheringTest#testTetherZeroLengthDhcpPacket requires the latest
NetworkStack module, otherwise, the test will fail due to the loss of
the fix. Apply @NetworkStackModuleTest to exclude this testcase from
target test suite CtsTetheringTestLatestSdk.

Bug: 283200648
Test: atest CtsTetheringTestLatestSdk
Change-Id: Iebfb043e2b71427a6feaf90788fe79b6ab6b678d
2023-06-01 18:16:24 +09:00
Anton Hansson
1397a101ac Use new soong support to install privapp xml
This allows better overriding of it in the variants of this apex
that have a different package name.

Bug: 242509786
Test: build google tethering, diff before & after
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:91442c93fb8d7f67bf90faab0552428ff07f0452)
Merged-In: I84c53458686f70408ec759df854f5fcdee9cdaed
Change-Id: I84c53458686f70408ec759df854f5fcdee9cdaed
2023-05-29 17:15:52 +00:00
Anton Hansson
92c28d43a1 Merge "Stop Tethering requiring NetworkStack" 2023-05-29 13:24:39 +00:00
Anton Hansson
1525118302 Stop Tethering requiring NetworkStack
It leads to complexity when Tethering is overridden, because the
required attribute must be duplicated for all the variants.

Require NetworkStack be explicitly installed instead.

Bug: 242509786
Test: m
Change-Id: Ideaecf88418901e2c86271166be24f6b7e498a20
2023-05-29 10:08:08 +00:00
Mark
49649c9aea Support SAP and LOHS enabled at the same time
Use type + scope as key to build cached address map so that
SAP (key: TETHERING_WIFI + INTERNET) and LOHS
(key: TETHERING_WIFI + LOCAL) can use different address.

Bug: 233175023
Test: atest TetheringTests
Change-Id: I46a4b3ee919628092b7540202a43d79f407b09b6
2023-05-25 08:31:33 +00:00
Mark
ae3abdfa4b Allow SAP and LOHS wifi clients exist at the same time
This change store localOnly wifi clients in its own field so that
tethered and localOnly hotspot clients can exist at the same time.

Currently, there are no tethered and localOnly hotspot clients at
the same time because PrivateAddressCoordinator does not support
SAP + LOHS. A follow-up change will be made to allow this.

When both SAP and LOHS are enabled, the SAP and LOHS clients from
TetheringEventCallback#onClientsChanged are all TETHERING_WIFI.
Currently, there is no way for the listeners to distinguish between
SAP and LOHS clients.

Bug: 233175023
Test: atest TetheringTests
Change-Id: I01b0a6abb084f7135f7825e0c5303e49c16a4c39
2023-05-25 08:31:06 +00:00
Mark
3ec851ef03 Add mDesiredServingState field in BaseServingState
As the suggestion from:
https://android-review.git.corp.google.com/c/platform/packages/modules/Connectivity/+/2489359/9/Tethering/src/android/net/ip/IpServer.java#b1176

Make BaseServingState an abstract class to prevent it from being used
directly. Additionally, move the handleNewPrefixRequest method into
BaseServingState because it is the only class that uses it.
To avoid TetheredState and LocalHotspotState from having to implement
their own enter function, add the mDesiredInterfaceState field to
BaseServingState.

Bug: 233175023
Test: atest TetheringTests
Change-Id: I03269c37e666345efb0c61039a2bb213f223a5a2
2023-05-24 17:00:41 +00:00
Mark Chien
adc6ab5c45 Merge "Add verifyHotspotClientUpdate helper function" 2023-05-18 05:57:39 +00:00
Mark Chien
65a73dbf78 Merge "Fix entitlement recheck fail in U" 2023-05-17 05:54:39 +00:00
Xiao Ma
5a44770232 Merge "Update the integration test to verify zero-length DHCP packet." 2023-05-17 01:12:52 +00:00
Mark
e86fb5ef56 Fix entitlement recheck fail in U
Starting with U, only explicit intents will be allowed to
launch non-exported internal components. Set package name
to entitlement recheck intent so that the intent could be
delivered to tethering itself successfully.

Bug: 278482046
Test: atest TetheringTests
      manual verify entitlement recheck work in U
Change-Id: Ife30eee13fe39509ccb5786d2a76fbb7baa022a8
2023-05-16 07:59:32 +00:00
Maciej Żenczykowski
2da7535246 remove out-of-process flag
The logic dealing with in vs out-of-process tethering flags
was added in aosp/master once it was already not merging to tm-dev,
thus ending up only in udc-dev, it was later removed in aosp/master,
and then cherrypicked to udc-dev.

As such there is no shipping version of the bpfloader
(besides early U developer previews and betas)
with this requirement.

This will make September+ releases of the tethering apex incompatible
with U developer previews and betas 1 and 2.

(ie. any U build not including https://googleplex-android-review.git.corp.google.com/c/platform/system/bpf/+/23214402
which was merged into udc-dev on May 14th @ 18:00)

This change has a dependency on
https://googleplex-android-review.git.corp.google.com/c/platform/vendor/google/modules/TetheringGoogle/+/23243439

Test: TreeHugger
Bug: 279942846
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I52d0ea706a8e2cb5c37874ed54f199035c14966c
2023-05-15 19:29:20 +00:00
Xiao Ma
d5020111ce Update the integration test to verify zero-length DHCP packet.
DHCP packet listener doesn't close socket any more upon receiving a
zero-length DHCP packet with a fix, instead, just ignore the zero-length
packet and continue reading. Also update the integration test logic to
verify the new behavior, i.e. we can send DHCPDISCOVER from a second device
with different mac address to verify the upstream DHCP server doesn't close
the listening socket, and then we will receive the response from server e.g.
DHCPOFFER packet.

Bug: 269692093
Test: atest TetheringIntegrationTests
Change-Id: I183da43ce5a6511714d293318fe6c60ea55999c0
2023-05-15 13:27:16 +00:00
Maciej Żenczykowski
024cbc3418 remove inprocess tethering
(unused leftover cruft)

Test: TreeHugger
Bug: 279942846
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ia66e4795a4544330aaf499fff8defb07248f5edd
2023-05-13 22:13:44 +00:00
Patrick Rohr
f128ba3461 Merge changes from topic "delete-cronet-disabled-support"
* changes:
  cronet: Move cronet defaults to framework/Android.bp
  cronet: delete option to disable cronet in tm-mainline-prod
2023-05-12 22:37:29 +00:00
Patrick Rohr
740b1d4ac3 cronet: Move cronet defaults to framework/Android.bp
Since cronet has moved out of the tethering jar.

Test: TH
Change-Id: Ibf476c0afd72863b26188dae6838825e6762976a
2023-05-12 10:15:01 -07:00
Patrick Rohr
2e3e2955b8 cronet: delete option to disable cronet in tm-mainline-prod
With the release cut of the July train and the recent automerger
cutover, tm-mainline-prod is now officially an abandoned branch.

This change deletes (most) infrastructure that was put in place to
disable cronet on tm-mainline-prod.

Test: builds
Change-Id: I078f2114b736a634f08d8f704c19beb2224ef645
2023-05-12 10:15:01 -07:00
Maciej Żenczykowski
e95ec4afa7 Merge "remove inprocess tethering" 2023-05-05 20:31:58 +00:00
Mark
c16645155f Add verifyHotspotClientUpdate helper function
This change centralized some common test codes to
verifyHotspotClientUpdate() to facilitate the following
commit for softap+lohs

Bug: 233175023
Test: atest TetheringTests
Change-Id: Iee3905084b244b91abdf7c562d77b5054d58ff6a
2023-05-04 07:18:08 +00:00
Xiao Ma
8da5ff4b5f Merge "Add an integration test to verify zero-length DHCP packet." 2023-05-03 14:09:04 +00:00
KH Shi
9dfbb45bb6 Add null check for tupleOrig in ConntrackMessage
ConntrackSocketTest#testIpv4ConntrackSocket always fail in cuttlefish
because it gets NullPointerException when accessing tupleOrig in
ConntrackMessage. tupleOrig can be null if it doesn't have source IP.

This situation happens when dumping the following conntrack entry:
vsoc_x86_64:/ # cat /proc/net/nf_conntrack
ipv4     2 unknown  2 570 src=0.0.0.0 dst=224.0.0.22 [UNREPLIED] \
src=224.0.0.22 dst=0.0.0.0 mark=0 secctx=u:object_r:unlabeled:s0 use=2

Bug: 280203901
Test: atest TetheringPrivilegedTests (on cuttlefish)
Change-Id: Iddc8cb390a4369190d535f4694e0e5fa4b6e590f
2023-05-02 22:57:24 +08:00
Maciej Żenczykowski
7a03c187f5 remove inprocess tethering
It is just a constant source of bugs, with no real tests,
let's stop pretending this is a supported configuration.

The only tested configuration is out-of-process tethering
updatable apex.

Test: TreeHugger
Bug: 279942846
Change-Id: I4b659a3cd32b89a65549b56006b926a5ac755f7b
2023-04-28 20:11:14 +00:00
Remi NGUYEN VAN
6d38c01852 Add a dependency object in TetheringConfiguration
Address a TODO in TetheringConfiguration to use a dependency object
instead of static mocking on DeviceConfig.

This avoids TetheringConfiguration dependencies on internal
implementation of DeviceConfigUtils, unblocking changes in
DeviceConfigUtils.

Bug: 279108992
Test: atest TetheringTests
Change-Id: I252eaadff85fa47b894e989b4f2527b00c5dca56
2023-04-28 19:18:43 +09:00
Xiao Ma
29e92df3f2 Add an integration test to verify zero-length DHCP packet.
DHCP packet listener closes the listening socket and stops reading
packet upon receiving a zero-length DHCP packet, which will break
the following DHCP handshake. Add an integration test to verify the
current behavior. A follow-up fix will verify if DHCP server will
accept the zero-length DHCP packet and continue reading packet on
that socket.

Bug: 269692093
Test: atest TetheringIntegrationTests
Change-Id: I5990e37cdfad4e8e4337b0bb1a74632286884baf
2023-04-28 10:06:54 +08:00
KH Shi
bcd62d18f4 Merge "Remove TODO comment that was already done" 2023-04-24 09:32:56 +00:00
Wayne Ma
b5ee365614 Add tx_bytes and rx_bytes to UpstreamEvent message
This commit adds two new fields, tx_bytes and rx_bytes, to the
UpstreamEvent message. These fields provide information about the
amount of data transferred during the event, which can be useful for
network performance analysis. The current tx/rx usages are always
zero, but it will be updated in a later change to reflect the actual
usage. No changes were made to the existing fields upstream_type and
duration_millis.

Test: atest TetheringMetricsTest
Change-Id: I9e1043b3fff5aa3f548b8696bac7e5bc4271c77c
2023-04-21 11:15:56 +08:00
Maciej Żenczykowski
ea07e4dff2 Merge "switch to classic bpf macros" 2023-04-19 19:37:02 +00:00
KH Shi
11dee200f9 Add forwarded stats dump in tethering hardware offload
The information can be useful for issue debugging, it shows the
accumulated traffic offloaded to the hardware for all upstreams.

$ dumpsys tethering
....
    ForwardedStats:
      rmnet_data2: rx:155686981 tx:799922
....

Bug: b/205762647
Test: adb shell dumpsys tethering
Change-Id: I94143329bdc8ad0eff79c32f329fae95ad3acf8a
2023-04-19 09:14:57 +00:00
Motomu Utsumi
73e2e87d56 Move cronet to framework-connectivity
aosp/2384137 added cronet to framework-tethering.
But framework-connectivity is a better place to put cronet since
cronet does not work on R devices (b/270049141) and
framework-tethering is R+, framework-connectivity is S+.

Followup CLs will move some modules (e.g. CronetJavaPrejarjarDefaults)
that use the branch dependent soong variables to framework/Android.bp

Test: TH
Bug: 278070640
Change-Id: I6bc10116759fb9e083c02147908e53022dab740a
2023-04-19 11:32:12 +09:00
Maciej Żenczykowski
32b46a4d36 switch to classic bpf macros
Note: this switches
  com_android_networkstack_tethering_util_setupIcmpFilter
over to relative cbpf which in turn is called from:
  com_android_networkstack_tethering_util_setupNaSocket
  com_android_networkstack_tethering_util_setupNsSocket
and tested by p/m/C's:
  TetheringUtilsTest.java - testIcmpSocketFilters()

Test: TreeHugger, atest TetheringUtilsTest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I22a5ea8f8e3b879a37fe4acd84f61020661eaa71
2023-04-19 00:06:15 +00:00
Maciej Żenczykowski
b68f73cc17 No Tethering Offload HAL is not really an error
Bug: 278660842
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I978de7fe33b77b432df183b4c7a1966849f17389
2023-04-18 10:05:13 +00:00
Wayne Ma
c4732276d4 Merge "Address comment from aosp/2335004" 2023-04-18 05:45:42 +00:00
Chidera Olibie
02918132de Merge "Revert "Fix symbol not found error for hidden apis used by MTS"" 2023-04-17 09:14:41 +00:00
Spandan Das
b06f9d6b81 Add libnetd_updatable to tethering-module-sdk
System libraries and binaries (e.g. netd) have a dependency on this.
Adding it to the sdk module allows an external snapshotting script
to generate prebuilts stubs of this library and commit them to
prebuilts/module_sdk. This allows minimal branch setup to build against
the apis of libnetd_updatable without checking out its source code.

Bug: 273723791
Test: m tethering-module-sdk
Change-Id: I1f235d86abba2c37ca7d750dea7071227e1346fe
2023-04-13 19:37:48 +00:00
Chidera Olibie
ef0074143d Revert "Fix symbol not found error for hidden apis used by MTS"
This reverts commit 5f44ed3e7e.

Reason for revert: The symbol not found error was a transient build failure.

Change-Id: Iada1a0bc9c2282286c1e3b972de42e6387c901d6
2023-04-13 09:38:39 +00:00
Wayne Ma
fab745c8ae Address comment from aosp/2335004
Bug: 263681262
Test: atest TetheringMetricsTest
Change-Id: I7372b7717a903d43a543f82e31a0439725d02e3a
2023-04-13 10:01:36 +08:00
Maciej Żenczykowski
bab0c1ad95 offload.c - adjust bytes for l2 header
Bug: 263884894
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I5c7bca4e005302a91368d22b9683db5b16d73b3a
2023-04-04 06:18:28 +00:00
Mark Chien
1a978c0300 Merge "Fix testPhysicalEthernet failure for physical ethernet device" 2023-03-31 04:48:33 +00:00
Mark
2040551d18 Fix testPhysicalEthernet failure for physical ethernet device
Other virtual interface ethernet test cases stop ethernet tethering
by deleting the virtual interface. To disable ethernet tethering for
testPhysicalEthernet, call stopTethering explicitly.

Bug: 271380398
Test: atest EtherentTetheringTest
Change-Id: I19a73f63227bab6a60d57d38b17a20a3f3f6c1d4
2023-03-30 09:16:47 +00:00
Maciej Żenczykowski
a7e496f067 TetheringUtils jni - clazz type is jclass
See: packages/modules/Connectivity/Tethering/src/com/android/networkstack/tethering/util/TetheringUtils.java

public static native void setupNaSocket(FileDescriptor fd) throws SocketException;
public static native void setupNsSocket(FileDescriptor fd) throws SocketException;
public static native void setupRaSocket(FileDescriptor fd, int ifIndex) throws SocketException;

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: If406a4e507da916f5691d0ae4bded14dd168bc72
2023-03-27 22:41:09 +00:00
Remi NGUYEN VAN
02eee9aa5a Use current shims in service-connectivity
Instead of NetworkStackApiStableShims, use NetworkStackApiCurrentShims
as this is a development branch.

Use java_defaults in the "merge conflicts expected" section, so that
module release branches can use the same defaults, but set it to
NetworkStackApiStableShims.

The shims are removed from FrameworksNetIntegrationTests, as they are
already available there through service-connectivity-pre-jarjar. Keeping
them as a dependency would make FrameworksNetIntegrationTests use both
Stable shims (directly) and Current shims
(through service-connectivity-pre-jarjar).

Bug: 266205506
Test: m
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:921290b49d109360aae5dc39effaa3b0e691f65a)
Merged-In: I88228152834a1c06830fb51e868fb8e3d8c47519

Change-Id: I88228152834a1c06830fb51e868fb8e3d8c47519
2023-03-27 15:56:23 +09:00
KH Shi
5655bf52e7 Remove TODO comment that was already done
The TODO is used to track to dynamically pass down the TTL from the
upstream interface. Remove it as it was already done in IpServer.

Test: No code changes
Change-Id: Idb12f82023315661f1bf4c767b9b7744a151e821
2023-03-24 11:38:18 +08:00
Chidera Olibie
5f44ed3e7e Fix symbol not found error for hidden apis used by MTS
This fails to build on git_master when
depending on `sdk_version:module-current` and
`libs:["framework-tethering-pre-jarjar"].

AIUI, some builds use sdk prebuilts that have compiled out
some of the hidden apis. And thus fails with symbol not found.

So we depend on the impl version of frame-tethering so we always
have access to these hidden apis for MTS.

Test: atestNetHttpCoverageTests
Change-Id: Id68a9051b9f8566f9ca42142669150a6db8b0925
2023-03-23 15:53:11 +00:00
Mohannad Farrag
9c6801f81b Revert^2 "gn2bp: Remove soong_namespace"
8484ec4dcd

Change-Id: I490c09179ea6a20ca5fba83c314b552d360be688
2023-03-23 12:47:47 +00:00
Mohannad Farrag
8484ec4dcd Revert "gn2bp: Remove soong_namespace"
Revert submission 2502135-remove_soong_namespace

Reason for revert: Missing line needs to be added

Reverted changes: /q/submissionid:2502135-remove_soong_namespace

Change-Id: I780a21cf7031e04eb368fda4f93ed16ea032ca8d
2023-03-23 12:36:48 +00:00
Mohannad Farrag
16ba062336 gn2bp: Remove soong_namespace
* This was causing the infra to ignore the modules and masking build errors.

Test: TH
Change-Id: Ic5aa3557353488d5370f4d9c4240954820bfe52b
2023-03-23 12:14:04 +00:00
Wayne Ma
cd893e0825 Merge "Add new test for swtiching multiple upstream network." 2023-03-21 08:51:42 +00:00
Wayne Ma
2bcd523745 Add new test for swtiching multiple upstream network.
Bug: 263681262
Test: atest TetheringMetricsTest
Change-Id: I70e88d36ecf4cac0f61ab54cc14efa46a4b5facb
2023-03-21 11:38:16 +08:00
Wayne Ma
9d6b724887 Merge "Implement logging of upstream event type and duration." 2023-03-20 16:50:37 +00:00
Stefano Duo
a5e1029101 Merge "Reland "Bundle Cronet's boringssl"" 2023-03-20 13:10:30 +00:00