Commit Graph

2845 Commits

Author SHA1 Message Date
Maciej Żenczykowski
e95ec4afa7 Merge "remove inprocess tethering" 2023-05-05 20:31:58 +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
KH Shi
7b8568927e Merge "Add Tetheroffload AIDL interface support" 2023-03-20 03:58:42 +00:00
Motomu Utsumi
f4ea712ce4 Merge "cronet: Update APIs naming" 2023-03-17 14:41:51 +00:00
Stefano Duo
43d89f659f Reland "Bundle Cronet's boringssl"
This relands commit 2cd4ac8725

Merged-In: I903369dbad37b663a39e80149e25b0634386df6d
Change-Id: I018121bf4d02ccc59c89de39e3d1598deb9cf67b
Bug: 274094720
2023-03-17 13:46:25 +00:00
Motomu Utsumi
2441e4aea6 cronet: Update APIs naming
Bug: 265674359
Bug: 273937039
Test: TH
Change-Id: I5fc149396511effdfabd462eba80d1a010ee205a
2023-03-17 09:04:56 +00:00
KH Shi
3d5e65cb48 Add Tetheroffload AIDL interface support
Add the AIDL HAL service interface support and abstract the HIDL/AIDL
interface implementations to allow OffloadController to talk to both
interfaces.

Bug: b/205762647
Test: atest com.android.networkstack.tethering
      atest ConnectivityCoverageTests
      atest ConntrackSocketTest
Change-Id: If7634a298d03668ed70b328f1ad6ca0ac0fe170b
2023-03-17 16:56:47 +08:00
Wayne Ma
c0e9e2901b Implement logging of upstream event type and duration.
Bug: 263681262
Test: atest TetheringMetricsTest
Test: statsd_testdrive 303
Change-Id: I80301ee035a9814920e3ce4b9eca6bcdc59350db
2023-03-17 16:40:06 +08:00
Patrick Rohr
98021b650b Connectivity Tests: join handler thread after calling quitSafely
Somewhat surprisingly, HandlerThread#quitSafely is *not* a synchronous
method, so the tearDown() method still needs to wait for the thread to
join.

Test: TH
Change-Id: I0433e2100adf9299a67af5c259a518cf44f4be57
2023-03-17 01:01:09 -07:00
Dan Stahr
9ed7a339a1 Merge "cronet: Fix AutoBoxing API linter issue" 2023-03-16 15:03:55 +00:00
Anton Hansson
41ad986490 Merge "Use filegroup defaults for framework sources" 2023-03-16 08:46:34 +00:00
Motomu Utsumi
5cdd07aa26 cronet: Fix AutoBoxing API linter issue
Bug: 265674359
Test: TH
Change-Id: Id2489a2337ff4d0fd0c30929f9e56d8d027dbbc6
2023-03-15 13:54:17 +00:00
Anton Hansson
57f3d69fd5 Use filegroup defaults for framework sources
There's now a shared defaults module for this kind of filegroup. Use
that and remove the previously duplicated prop.

Bug: 271816210
Test: m
Change-Id: Ia4547984a73179fdfc98c427482dd10246f9722c
2023-03-15 10:36:52 +00:00
Wayne Ma
304e4f2af8 Refactor TetheringMetricsTest, remove Pair.
Test: atest TetheringMetricsTest
Change-Id: I1b536ff198119b07e9313f081a8e02e515c67efd
2023-03-15 17:34:12 +08:00
Treehugger Robot
853ef56fb6 Merge "Revert "Bundle Cronet's boringssl"" 2023-03-15 00:31:21 +00:00
Patrick Rohr
77c084d1f6 Revert "Bundle Cronet's boringssl"
This reverts commit 2cd4ac8725.

Reason for revert: b/273575026

Change-Id: I5b9886465b8a0f71af469d303a39f670a9b0cb68
2023-03-14 22:45:06 +00:00
Patrick Rohr
68454864fc EthernetTetheringTest: join handler thread after calling quitSafely
Somewhat surprisingly, HandlerThread#quitSafely is *not* a synchronous
method, so the tearDown() method still needs to wait for the thread to
join.

Test: TH
Change-Id: I4297ba057b3d4e67c7b462b6995da637f2479d42
2023-03-14 20:24:01 +00:00
Treehugger Robot
944d6a3235 Merge "Cronet API: make UrlRequest.Callback an interface." 2023-03-14 15:42:28 +00:00
Wayne Ma
e18edffe3d Merge "Refactor TetheringMetricsTest" 2023-03-14 08:51:16 +00:00
Dan Stahr
fcfe8c7d8e Cronet API: make UrlRequest.Callback an interface.
For consistency with other Callback classes, and not to force class
hierarchy on users. The historical "callback completeness" issue can be
mnitigate using interface defaults.

Test: atest CtsNetHttpTestCases
Change-Id: Ibf2aaf4396ab9defdeb4e3882cea6b1b2dbd36ee
Merged-In: Id8fcc13567da8878e848f3c6668d865e77b48146
2023-03-14 05:57:19 +00:00