Commit graph android_packages_modules_Co.../Tethering
Message SHA1
Merge "Introduce Ipv6UpstreamRule to bpf tethering offload" into main
KH Shi   authored and   Gerrit Code Review   commited 2023-08-25 10:20:20 +00:00
480d807057
Merge "Add RemoteAuthService" into main
Igor Zaslavsky   authored and   Gerrit Code Review   commited 2023-08-24 20:02:42 +00:00
a92d8cab5f
Add RemoteAuthService
Add RemoteAuthService APIs and Stubs (hide) for Settings of D2DA

This CL introduces new SystemApi allow user to discover remote devices
compatible to be registered as remote authenticators via RemoteAuthManager

Design doc: go/remote-auth-manager-fishfood-design

Test: built successfully.
Bug: 290092977
API-Coverage-Bug: 294934095
Change-Id: Iaaae1126065fdc3db469eeb8d85ac654b8199a12

Igor Zaslavsky   commited 2023-08-24 17:50:11 +00:00
ec344f4c18
Introduce Ipv6UpstreamRule to bpf tethering offload
Replaced startUpstreamIpv6Forwarding and stopUpstreamIpv6Forwarding
with add/remove Ipv6UpstreamRule. This is a preparation for following
CLs which will pass the upstream's prefixes to the bpf map. We might
have more than one upstream rules.

Also renamed Ipv6ForwardingRule to Ipv6DownstreamRule since we have
defined the Ipv6UpstreamRule.

No logic changes are being made in this CL.

Test: atest TetheringTests
Bug: 261923493
Change-Id: I022f97c2daf468bbd4a4279a069ccf498013e7e7

KH Shi   commited 2023-08-24 12:02:23 +00:00
59ad35ee19
Move ArpPacket.java to frameworks/libs/net
Bug: 281639507
Test: TH
Change-Id: I754c3581438d716d2156b80e4ce29b3f2adf76d4

Yuyang Huang   commited 2023-08-23 18:24:35 +09:00
5c2126ed38
Rename to isTetheringFeatureEnabled
DeviceConfigUtils has isFeatureEnabled for NetworkStack and Tethering
which were confusing since the difference was only the arguments.
This CL renames isFeatureEnabled for Tethering module to
isTetheringFeatureEnabled to avoid confusion.

Bug: 279108992
Test: m
Change-Id: I05255bb38619afbe621d29524d7910d206a149f1

Motomu Utsumi   commited 2023-08-17 17:47:19 +09:00
624aeb4274
Import RFC7421_PREFIX_LENGTH from NetworkStackConstants.
RFC7421_PREFIX_LENGTH is being removed from NetworkConstants and import
it from NetworkStackConstants instead.

Bug: 290885904
Test: TH
Change-Id: I35e785be3f1a278c76b0810cad844710254b0f15

Xiao Ma   commited 2023-08-14 20:08:19 +09:00
c32e37f0b2
Merge "Add tests for OffloadHardwareInterface" into main
KH Shi   authored and   Gerrit Code Review   commited 2023-08-14 02:13:23 +00:00
839cc0b455
Merge "Import RFC7421_PREFIX_LENGTH from NetworkStackConstants." into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-08-10 13:07:20 +00:00
b8ea09efd7
bpf tethering offload - add src subnet to upstream ipv6 direction
This patch is based on aosp/2535559 from maze@.

Add source prefix into the upstream key such that only packets which
source IPv6 address matches it will be forwarded to the upstream
interface.

In this patch, the source prefix is set to zero so there is no
behavior changes. Next CL in patch series will use the real source
prefixes retrieved from upstream interface.

Test: atest TetheringTests
Bug: 261923493
Change-Id: I43d068a29b937c7dfeb6fab632a8effb47ee2263

KH Shi   commited 2023-08-10 16:01:21 +08:00
c8fb1a2530
Add tests for OffloadHardwareInterface
NativeHandles shouldn't be closed in OffloadHardwareInterface after
passing them to initOffload() of AIDL service, because their owner
will be changed to ParcelFileDescriptor by libbinder.

Add test cases to verify that NativeHandles are closed correctly.
NativeHandles should be closed after initOffload if:
  - Init with HIDL HAL interface
  - Has null NativeHandle, any non-null NativeHandles should be closed

Bug: 277834236
Test: atest OffloadHardwareInterfaceTest
Change-Id: Icbe74da73d3bdc582d1816b314fdfce9661465fc

KH Shi   commited 2023-08-10 14:56:09 +08:00
f5390a9d8f
Merge "Fix bug for failing to init Offload AIDL HAL service" into main
KH Shi   authored and   Gerrit Code Review   commited 2023-08-10 06:37:58 +00:00
cf0cc72629
Import RFC7421_PREFIX_LENGTH from NetworkStackConstants.
Remove the dependency on services-connectivity-shared-srcs
filegroup gradually.

Bug: 290885904
Test: TH
Change-Id: I6474563a3a0b521945e6467a2832862764ad4770

Xiao Ma   commited 2023-08-09 20:02:15 +09:00
1f993309c6
Fix EtherentTetheringTest flaky
The first tethering test case may experience tethering restart
with IP conflict handling. Tethering would cache the last
upstreams so that the next enabled tethering avoids
picking up the address that is in conflict with the upstreams.
To protect subsequent tests, turn tethering on and off before
running them.

Bug: 254183718
Test: atest CtsTetheringTest
      atest MtsTetheringTestLatestSdk
Change-Id: I03729d3212a03bd9fcfe2c09cf327840f13b250c

Mark   authored and   Mark Chien   commited 2023-07-27 16:04:28 +00:00
f5e4b90ae2
Fix bug for failing to init Offload AIDL HAL service
When fail to init offload AIDL service, OFFLOAD_HAL_VERSION_NONE is
returned. Not as expected, it go to close the FDs for AIDL service and
causes a NE.

Bug: 277834236
Test: atest com.android.networkstack.tethering
Change-Id: I26a7412cb7d88f0d56b713db18af5cd9583a7942

Zemeng Li   authored and   KH Shi   commited 2023-07-24 21:19:31 +08:00
32ef13d7f3
Merge "Don't run EthernetTetheringTest if Ethernet is not supported"
Mark Chien   authored and   Gerrit Code Review   commited 2023-07-04 09:12:34 +00:00
df41b36fc9
Don't run EthernetTetheringTest if Ethernet is not supported
Bug: 288844185
Test: atest CtsTetheringTest
Change-Id: Ie918a0657ab17900437918f7ae99f7aa2539052c

Mark   commited 2023-07-03 09:25:18 +00:00
dc581e6c8f
EthernetTetheringTest: test RFC 7050 prefix64 discovery
Reply ipv4only.arpa AAAA query with Pref64::WKA for applying test
prefix64 to LinkProperties of test network.
See Nat464Xlat#setNat64PrefixFromDns.

Currently, the test prefix64 is applied directly in test network
initialization. In order to increase the NAT64 test coverage,
the integration test starts to reply prefix64 discovery DNS query
for testing the RFC 7050 prefix discovery.

These clat related tests are still expected to pass since this
prefix64 source change:
- testTetherClatIcmp
- testTetherClatUdp
- testTetherClatTcp

Bug: 259888307
Test: atest EthernetTetheringTest
Change-Id: Ic94ce997dd0b1d718a1074850c01ea90298cc1c3

Hungming Chen   authored and   Mark   commited 2023-06-26 15:51:25 +00:00
05ecb5c19e
Merge "Move buildXXXPacket methods into TetheringTester"
Mark Chien   authored and   Gerrit Code Review   commited 2023-06-26 02:16:20 +00:00
5cebcf7d64
Move buildXXXPacket methods into TetheringTester
Move all EthernetTetheringTest buildXXXPacket util into TetheringTester
and make them static public.

Bug: 259888307
Test: atest EthernetTetheringTest
Change-Id: Ice5252c1adfdb98dfaf815f48ac4603711317f65

Mark   authored and   Mark Chien   commited 2023-06-22 07:12:49 +00:00
4845823f48
Merge "Tethering: ignore duplicate upstream changed event"
Mark Chien   authored and   Gerrit Code Review   commited 2023-06-19 15:03:48 +00:00
c2e434bbc7
Tethering: ignore duplicate upstream changed event
Different network objects with the same network ID should be
treated as the same network.

chooseUpstreamType compares the current upstream and new upstream
by object (comparison operator) instead of network id
(Network#equals). This implies that different objects with the
same network id still trigger upstream changed report.

Since this commit, reportUpstreamChanged is only called when upsteam
has really changed (connected, switched or disconnected) in
chooseUpstreamType. In previous code, reportUpstreamChanged is also
called if EVENT_ON_CAPABILITIES is called when the upstream is the
same but its capabilities changed.

The NotificationUpdater#onUpstreamCapabilitiesChanged method only
needs to be called by chooseUpstreamType when it chooses a new
upstream. If the upstream remains the same but its capabilities
change, the EVENT_ON_CAPABILITIES will call
onUpstreamCapabilitiesChanged.

Bug: 243516306
Test: atest TetheringTest
Change-Id: I009383a61a5fabd249ba78fcffd524a5bbe4602e

Hungming Chen   authored and   Mark   commited 2023-06-19 06:51:03 +00:00
fc52868213
Add testIpv4AddressForSapAndLohsConcurrency test case
A test to verify that SAP and LOHS can use different IPv4
addresses if they are both enabled.

Bug: 233175023
Test: atest TetheringTest
Change-Id: I40f0f35221a76e6593cc8d04e9f2b25df8c27c87

Mark   commited 2023-06-17 04:04:14 +00:00
cb1fe1a622
Add testConnectedClientsForSapAndLohsConcurrency test case
A test to confirm that connected clients are updated when SAP
and LOHS are enabled simultaneously.

Bug: 233175023
Test: atest TetheringTest
Change-Id: I920f02e5b2ad137af529776141d51b6c83b8ea5b

Mark   commited 2023-06-16 09:09:10 +00:00
639866b45a
Merge "Import translations. DO NOT MERGE ANYWHERE"
Bill Yi   authored and   Gerrit Code Review   commited 2023-06-08 03:11:48 +00:00
5fba518a42
Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: I648bb906f2fd3452518358a93c590807a11d21e0

Bill Yi   commited 2023-06-04 15:21:23 -07:00
8fadf1e7d3
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

Xiao Ma   commited 2023-06-01 18:16:24 +09:00
161b70c587
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

Anton Hansson   commited 2023-05-29 17:15:52 +00:00
1397a101ac
Merge "Stop Tethering requiring NetworkStack"
Anton Hansson   authored and   Gerrit Code Review   commited 2023-05-29 13:24:39 +00:00
92c28d43a1
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

Anton Hansson   commited 2023-05-29 10:08:08 +00:00
1525118302
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

Mark   commited 2023-05-25 08:31:33 +00:00
49649c9aea
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

Mark   commited 2023-05-25 08:31:06 +00:00
ae3abdfa4b
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

Mark   authored and   Mark Chien   commited 2023-05-24 17:00:41 +00:00
3ec851ef03
Merge "Add verifyHotspotClientUpdate helper function"
Mark Chien   authored and   Gerrit Code Review   commited 2023-05-18 05:57:39 +00:00
adc6ab5c45
Merge "Fix entitlement recheck fail in U"
Mark Chien   authored and   Gerrit Code Review   commited 2023-05-17 05:54:39 +00:00
65a73dbf78
Merge "Update the integration test to verify zero-length DHCP packet."
Xiao Ma   authored and   Gerrit Code Review   commited 2023-05-17 01:12:52 +00:00
5a44770232
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

Mark   commited 2023-05-16 07:59:32 +00:00
e86fb5ef56
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

Maciej Żenczykowski   commited 2023-05-15 19:29:20 +00:00
2da7535246
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

Xiao Ma   commited 2023-05-15 13:27:16 +00:00
d5020111ce
remove inprocess tethering
(unused leftover cruft)

Test: TreeHugger
Bug: 279942846
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ia66e4795a4544330aaf499fff8defb07248f5edd

Maciej Żenczykowski   commited 2023-05-13 22:13:44 +00:00
024cbc3418
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

Patrick Rohr   authored and   Gerrit Code Review   commited 2023-05-12 22:37:29 +00:00
f128ba3461
cronet: Move cronet defaults to framework/Android.bp
Since cronet has moved out of the tethering jar.

Test: TH
Change-Id: Ibf476c0afd72863b26188dae6838825e6762976a

Patrick Rohr   commited 2023-05-12 10:15:01 -07:00
740b1d4ac3
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

Patrick Rohr   commited 2023-05-12 10:15:01 -07:00
2e3e2955b8
Merge "remove inprocess tethering"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2023-05-05 20:31:58 +00:00
e95ec4afa7
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

Mark   commited 2023-05-04 07:18:08 +00:00
c16645155f
Merge "Add an integration test to verify zero-length DHCP packet."
Xiao Ma   authored and   Gerrit Code Review   commited 2023-05-03 14:09:04 +00:00
8da5ff4b5f
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

KH Shi   commited 2023-05-02 22:57:24 +08:00
9dfbb45bb6
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

Maciej Żenczykowski   commited 2023-04-28 20:11:14 +00:00
7a03c187f5
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

Remi NGUYEN VAN   authored and   Motomu Utsumi   commited 2023-04-28 19:18:43 +09:00
6d38c01852
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

Xiao Ma   commited 2023-04-28 10:06:54 +08:00
29e92df3f2