Commit Graph

739 Commits

Author SHA1 Message Date
Mark Chien
794d04d779 Merge changes I41ae1d61,I334860af
* changes:
  Make tethering APIs unsupported synchronously when disallowed
  Revert "Revert "Add onSupportedTetheringType callback""
2022-07-28 02:22:07 +00:00
Mark
cf230301e3 Make tethering APIs unsupported synchronously when disallowed
To backward compatible existing behavior, make tethering APIs
unsupported synchronously when tethering is disallowed. There
are two APIs register/unregisterTetheringEventCallback still
supported even tethering is disallowed.
This could avoid some existing tests flaky. The test assume
startTethering would fail right away after tethering restricted
apply.

Bug: 184996041
Bug: 239500515
Test: atest TetheringTests
Change-Id: I41ae1d61647c9baf69bcb246965e8d9b4a89b497
2022-07-27 09:41:42 +00:00
Treehugger Robot
e522b7ff75 Merge "Fix tethering WTF issue" 2022-07-22 12:52:13 +00:00
Mark Chien
874a3e273e Revert "Revert "Add onSupportedTetheringType callback""
This reverts commit 4bf22ae076.

Reason for revert: land the change again

Change-Id: I334860af201ce0faa09f1dbb8935bc9fddd66c50
2022-07-20 06:18:13 +00:00
zhengyu.zhan
d1b6993684 Fix tethering WTF issue
When enable/disable tethering quickly, tethering may have stopped
when Ipserver start creatFd().
As tethering iface is down due to tethering stopped, creatFd() will
throw ErrnoException: bind failed: ENODEV (No such device).
When tethering is stopped, this exception is normal, should not
rise WTF.

Bug: 233587050
Test: manual test
Change-Id: I2e200313d1bec2c1e1245e779f3875397127160d
2022-07-19 17:18:26 +08:00
Chiachang Wang
b7f81e4a6d Merge "Correct javadoc usage" 2022-07-15 07:41:33 +00:00
chiachangwang
9473c59980 Correct javadoc usage
"{@see" aren't rendered properly. Replace them with "See {@link"
or @see depending on the usage.

Bug: 238753273
Test: make doc-comment-check-docs ; Check the doc result
Change-Id: I70cb2f36e7c5fa8102b5949054df5184d755202c
2022-07-15 03:44:46 +00:00
Xiao Ma
59819aeb0e Deprecate filegroup tethering-module-utils-srcs in tethering.
tethering-module-utils-srcs filegroup only contains NetdUtils.java
class, import this class from netd-client static lib instead.

Bug: 238960524
Test: m
Change-Id: I7547c3a3a13e564408cdf8e702f3438530763381
2022-07-14 13:30:27 +09:00
Xiao Ma
c81c066958 Make Tethering module depend on net-utils-device-common-ip.
NetworkStack module utils are duplicated to net-utils-device-common-ip,
delete the module utils source code and use net-utils-device-common-ip
instead.

Bug: 235901424
Test: atest TetheringTests
Change-Id: I19fe72a92d6de1084963c2b3a38d094f8da2a91e
2022-07-13 04:32:28 +00:00
Mark Chien
370ba4f3c5 Merge "Revert "Add onSupportedTetheringType callback"" 2022-07-12 07:30:50 +00:00
Mark Chien
4bf22ae076 Revert "Add onSupportedTetheringType callback"
This reverts commit ae3d303344.

Reason for revert: this cause GTS fail
Bug: 238038401

Change-Id: I3e21321e931f60208cb0befaed38e58b088ff966
2022-07-12 02:11:48 +00:00
Patrick Rohr
b873e25ab4 Use frameworks/libs/net version of SharedLog
Test: m
Bug: 235901424
Change-Id: Ibfa7821c68c41036a47e765f15078cd5d195afb8
2022-07-07 12:52:58 -07:00
Nucca Chen
bf28a595f2 Merge "Use BpfDump.toBase64EncodedString to dump raw map" 2022-07-06 12:04:54 +00:00
Treehugger Robot
dd9a89c2f2 Merge "Ignore BPF tethering offload test if tether config is disabled" 2022-06-29 07:57:56 +00:00
Treehugger Robot
b7c368c27f Merge "Fix metrics doesn't work if multiple tethering requested" 2022-06-29 03:39:03 +00:00
Mark
26cf9b6728 Fix metrics doesn't work if multiple tethering requested
There is a bug in TetheringMetrics that the on-going builders would be
cleared when creating new builder. This means if multiple tethering
created at the same time, only latest tethering would have metrics.

Bug: 153942334
Test: atest TetheringTests
Change-Id: I16a66790bc19072d8ffe570348bcbafa91263573
2022-06-28 10:31:02 +00:00
Mark
133299a9b8 Tethering: remove dead code
changeInterfaceState only used in enableIpServing which always
pass STATE_TETHERED or STATE_LOCAL_ONLY state. Move it into
enableIpServing directly and remove unused code.

Test: m
Change-Id: I2d91115e588a153ddcb9d61f8e2bc09a09c52d48
2022-06-28 06:46:27 +00:00
Hungming Chen
b37f76f28e Ignore BPF tethering offload test if tether config is disabled
Needed because OEM can disable BPF offload by PRO.

Bug: 237144191
Bug: 236925089
Test: atest EthernetTetheringTest
Change-Id: Idf965caa44aeaae1f084d2c4fcd516a352c1b138
2022-06-27 15:11:23 +08:00
Hungming Chen
264cac59bb Use BpfDump.toBase64EncodedString to dump raw map
Move base64 related bpf map function and constant to f/l/n.
This is preparation for testing BPF map in ClatCoordinator.

Test: atest EthernetTetheringTest
Change-Id: Ieb1e0a0f128c9aa0d7c9f043e90eecf3c61252f5
2022-06-23 21:42:20 +08:00
Mark Chien
46c86bbf82 Merge "Register localOnly softapCallback for local only hotspot" 2022-05-17 09:07:38 +00:00
markchien
f2e9409f55 Prepare for refactoring wifi ipserver start/stop
This is a preparing change.
1) In enableWifiIpServing, replace
   ensureIpServerStarted(ifname) +
   changeInterfaceState(ifname, ipServingMode)
   with enableIpServing(TETHERING_WIFI, ifname, ipServingMode).

   And checking whether corresponding wifi or p2p feature is
   avaialble before enableWifiIpServing. Note: If the wifi or p2p
   feature wasn't supported before, it would still call
   changeInterfaceState without ipServer created but
   changeInterfaceState would be no-op because there is no
   corresponding ipServer for changing state.

2) Splitting enableWifiIpServing into enableWifiIpServing and
   enableWifiP2pIpServing.

3) No longer guess the interface name after T. WIFI_AP_STATE_CHANGED
   intent should always include ifname and it should be tracked by
   mTetherStates. If OEM have modification in wifi framework to send
   empty ifname, tethering no longer support this after T.

4) After T, tethering always trust the ifname which pass by wifi or p2p
   intent broadcast and treat it as TETHERING_WIFI or
   TETHERING_WIFI_P2P. This allow tethering to deprecate wifi/p2p regexs
   after T.

Bug: 189410000
Bug: 178116595
Bug: 185451791
Bug: 190145323
Bug: 176048959

Test: atest TetheringTests

Change-Id: Ia5f69ddf2d842536ce0df75eeae57866f56df571
2022-05-16 21:17:40 +08:00
markchien
4ccb419602 Register localOnly softapCallback for local only hotspot
Before T, wifi local only mode won't update onConnectedClientsChanged.
To support updating tethered client information for localOnly hotspot,
register localOnly softap callback to get connected wifi client update.

Bug: 171928468
Test: atest TetheringTests

Change-Id: I0e974feea9497809ea02a4138c7b9c2c584a8a45
2022-05-16 15:09:10 +08:00
Treehugger Robot
42f38d0bdf Merge changes from topic "tethering_metrics"
* changes:
  Add tethering stats into statsd
  Injecting tethering stats into statsd
2022-05-16 05:06:01 +00:00
Wayne Ma
6cd440fedd Add tethering stats into statsd
Bug: 153942334
Test: atest TetheringTest IpServerTest
Test: Manual test with statsd_testdrive
Change-Id: I7205bb24dd30ba78b79bc352034da299d452750f
2022-05-12 17:21:11 +08:00
Hungming Chen
374107963a Catch new exceptions from BpfMap
Bug: 230880517
Test: atest FrameworksNetTests
Change-Id: I9eff2589f83ac109fb6e8b9906da05890daa9bd9
2022-05-12 14:13:01 +08:00
Wayne Ma
7ecded8248 Injecting tethering stats into statsd
Fill in downstream type, upstream type, error code and user type to NetworkTetheringReported.

Bug: 153942334
Test: m, flash and boot
Test: atest TetheringMetricsTest
Change-Id: I6ba7d9e512b1ada519f44f9f3a95667e4b0f03c0
2022-05-09 19:35:53 +08:00
Tom Hsu
1135676150 Merge "[Tetheirng] Refactor carrier config to EntitlementManager" 2022-04-21 13:43:14 +00:00
tom hsu
f0d60e9902 [Tetheirng] Refactor carrier config to EntitlementManager
- To reduce CarrierConfigManager access times, move CarrierManager
  to TetheringConfiguration.

Bug: 225900149
Test: atest EntitlementManagerTest pass
Test: atest TetheringConfigurationTest pass
Change-Id: I5b206e2bc012cbbca26fb1e5c72558383981f183
2022-04-21 12:44:26 +08:00
Hungming Chen
e32dbded7c Add bpf forwording packet count test
- Add dumpsys option to dump stats map in BpfCoordinator
- Add stats test to check bpf forwording packet count in
  EthernetTetheringTest

Bug: 227159997
Test: atest TetheringCoverageTests
Change-Id: I177787ed0c28ebe137ff1431f40a23b1e4b22a19
2022-04-20 08:54:08 +00:00
Hungming Chen
6abd0ff25d Tethering: replace argsContain with CollectionUtils.contains
Bug: 227159997
Test: adb shell dumpsys tethering --short
Change-Id: I6158d4cb4aecf9db4d7cc6698db898ce2cbb2c4c
2022-04-20 08:53:49 +00:00
Hungming Chen
e4a6b28938 BpfCoordinator: Add an option to choose which raw bpf map to dump
Make that tethering dumpsys can choose which map to dump.
The related functions in BpfCoordinator and its test are refactored
into template functions. This is used in the following commits which
will dump stats map for testing.

Bug: 227159997
Test: atest TetheringCoverageTests

Change-Id: I23d747543d16a971773c132b60227eb3f42efe25
2022-04-20 15:58:47 +08:00
Mark Chien
c4379c2440 Merge "Add onSupportedTetheringType callback" 2022-04-20 03:38:42 +00:00
markchien
ae3d303344 Add onSupportedTetheringType callback
This new callback could tell caller Tethering is supported for what tethering
types.

Bug: 184996041
Test: atest TetheringTests
      atest EthernetTetheringTest
CTS-Coverage-Bug: 223340235

Change-Id: Ib80ed8d7f73f4a098b8965db186d24d8cf1884d3
2022-04-20 00:41:41 +08:00
Treehugger Robot
8315d1cf03 Merge "Move TetherStatsKey and TetherStatsValue to common libs" 2022-04-19 08:35:03 +00:00
Mark Chien
60f25d6c5b Merge "Add config_p2p_leases_subnet_prefix_length configuration" 2022-04-06 09:14:19 +00:00
Hungming Chen
87bb6c3603 Move TetherStatsKey and TetherStatsValue to common libs
EthernetTetheringTest needs to parse BPF map content for bpf stats
tests. Move the struct class files to common libs.

Compare TetherStats{Key, Value}.java between frameworks/libs/net/common
and packages/modules/Connectivity/Tethering.
There is only the package name change as expected.

$ diff packages/modules/Connectivity/Tethering/src/com/android/networkstack/tethering/TetherStatsKey.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/TetherStatsKey.java
17c17
< package com.android.networkstack.tethering;

Bug: 227159997
Test: atest TetheringCoverageTests

Change-Id: I87193cb6409b4d19c72184011d7e99275800dab1
2022-04-04 23:25:58 +08:00
Wayne Ma
075dd6f8ff Merge "Adding Tethering proto" 2022-03-31 16:24:16 +00:00
markchien
fb65dfeb8d Add config_p2p_leases_subnet_prefix_length configuration
Add new rro configuration which can be used to make the p2p dhcp
prefix length larger to reserve the address range outside of leases
subnet prefix length for EAPOL-Key feature. This configuration only
valid if its value larger than dhcp server address prefix length and
config_tether_enable_legacy_wifi_p2p_dedicated_ip is true.
E.g.:leaseSubnetPrefixLength = 25, p2p static address = 192.168.49.1/24
dhcp range: 192.168.49.0 ~ 192.168.49.127 (192.168.49.1/25), reserved
192.168.49.128 ~ 192.168.49.255 for EAPOL-Key feature.

Bug: 170056953
Test: atest TetheringTests

Change-Id: I1319efd871796da7234383a29ab64a1623101ae7
2022-03-31 16:32:55 +08:00
Hungming Chen
dad664748a Add test for tetherOffloadClient{Add, Remove, Clear}
also remove the redundant constructor definition in
test key/value class builder.

Test: atest TetheringCoverageTests
Change-Id: Icf93d4f196846c82c3a1c2b2b8697f4a5156ea92
2022-03-30 16:28:11 +08:00
Wayne Ma
71d66396d2 Adding Tethering proto
Bug: 153942334
Test: m, flash and boot
Change-Id: I853d3a4dd914dd0c65a6c9e1749d8898da68540e
2022-03-24 17:40:31 +08:00
Tom Hsu
1c12d0790e Merge "Add a carrier config to block tethering." 2022-03-16 07:26:39 +00:00
Meng Wang
a84bb2d8ba Add a carrier config to block tethering.
When KEY_CARRIER_SUPPORTS_TETHERING_BOOL=false, it will behave as if
entitlement check failed and a system notifcation shows up if user
tries to turn on tethering from Settings UI.

Bug: 161206517
Test: manual
Change-Id: I78da390ecb0c8f4f68285ef16da80653f136c11e
2022-03-16 12:40:24 +08:00
Nucca Chen
3938102448 Merge changes I5af6ce96,Ibc1f6813
* changes:
  Refactor make{Tether4Key, Tether4Value ConntrackEvent} helper
  BpfCoordinatorTest: refactor upstream and downstream setup functions
2022-03-11 18:05:14 +00:00
markchien
22c1a3aa1f Use U32 from shared library
There is U32 added in frameworks/libs/net. Use shared one to avoid
duplicated code.

Bug: 215095957
Test: m
Change-Id: I861bc2f65ea947a908de2ec83e9b137d3342c8ce
2022-03-09 15:05:16 +08:00
Mark Chien
8dcc3000fd Merge "Make isTetheringSupported respect all tethering downstreams" 2022-03-07 05:56:20 +00:00
markchien
259d5c08a8 Make isTetheringSupported respect all tethering downstreams
Currently if wifi, usb and bluetooth tethering is not supported,
isTetheringSupported would return false. Then ethernet, ncm tethering
and wifi p2p would also not be supported anymore. Make
isTetheringSupported respect all tethering downstreams after T.

Also remove redundant code:
1. tethering always has upstream configuration, checking whether has
upstream configuration for isTetheringSupported is useless.
2. Remove TetheringDependencies#isTetheringSupported because it don't
have any caller.

Test: atest TetheringTests
Change-Id: I3db5ce410c064d37c9e9e704fce2a2b68705834e
2022-03-07 10:55:51 +08:00
Maciej Żenczykowski
a63535bfd1 Merge changes from topic "dedup-interfaceparams"
* changes:
  Remove unused InterfaceParams jarjar rule
  Deduplicate InterfaceParams
2022-03-05 08:23:55 +00:00
Patrick Rohr
9f371f024b Deduplicate InterfaceParams
CS should use InterfaceParams from frameworks/libs/net.

Test: builds
Bug: 222448728
Change-Id: I1f45d3171b265461a8724b4be7b212c030b63fe9
2022-03-04 16:53:51 +01:00
Mark Chien
9edd999725 Merge "Pass whole TetheringConfiguration to IpServer" 2022-03-03 11:54:59 +00:00
markchien
b961d3d70f Pass whole TetheringConfiguration to IpServer
This is a no-op CL that passing whole TetheringConfiguration to IpServer
to reduce the number of IpServer constructor parameters.

Bug: 170056953
Test: atest TetheringTests
Change-Id: I4ec17f7ecaefd7f275139ad9c7f7551635b192c9
2022-03-03 11:54:24 +00:00