Commit Graph

886 Commits

Author SHA1 Message Date
lucaslin
ee661dfb59 Move BaseNetdUnsolicitedEventListener to frameworks/libs/net
Move BaseNetdUnsolicitedEventListener to frameworks/libs/net and
create a new library - netd-client for using.
Also remove netd_aidl_interface-unstable-java since netd-client
links to the stable one.

Bug: 174837473
Test: Manual test and check the log.
Change-Id: Id65142b8c13a6cccbfe387d4ab757967497546e6
2021-01-08 01:55:53 +00:00
Treehugger Robot
4f430ae5ec Merge "Revert "Add service-connectivity to tethering APEX"" 2021-01-07 15:25:03 +00:00
Pete Bentley
850ca6f6b4 Revert "Add service-connectivity to tethering APEX"
Revert "Set setCurrentProxyScriptUrl as public"

Revert submission 1532910-connectivity_jar_in_apex

Reason for revert: Breaks boot tests: b/176969905
Reverted Changes:
Ie41a5b569:Set setCurrentProxyScriptUrl as public
Id7b6a4664:Move service-connectivity to the tethering APEX
Ia7cb83834:Add service-connectivity to tethering APEX

Change-Id: I9f31d4810a92e620f02cc8d24bdf18fe28001a2b
2021-01-07 13:51:18 +00:00
Lorenzo Colitti
7998551cdc Merge "Add service-connectivity to tethering APEX" 2021-01-07 08:34:25 +00:00
Remi NGUYEN VAN
bd5cc4231d Add service-connectivity to tethering APEX
Add the connectivity service JAR to the tethering APEX.
This change should not be released in monthly updates until the
modularization work is done, so will be reverted in module release
branches.

Test: Boot, wifi connects and has internet access
Bug: 171540887
Merged-In: Ic496cd62be8c90928ccc619519ebe517beea78f0

Change-Id: Ia7cb83834b854e8c495c4ef17ec69ad032509208
2021-01-07 06:17:33 +00:00
Treehugger Robot
561f38a799 Merge "Also update connected clients for local only tethering" 2020-12-23 11:36:34 +00:00
markchien
f50f05ebcb Also update connected clients for local only tethering
mForwardedDownstreams is the set of downstreams who wanted upstream.
In other word, it don't contains localOnly tethering(e.g. local only
hotspot, wifi p2p tethering). Changing the list from mForwardedDownstreams
to mNotifyList make both tethered and localOnly tethering have connected
clients callback.

Bug: 172290164
Test: atest TetheringTests
Change-Id: I58fdb28efc616b00d63a1c237ea93aee4d8f2dcd
2020-12-22 23:23:09 +08:00
Chalard Jean
d2df5729f6 Move module utils to the module package.
Test: FrameworksWifiTest FrameworksNetTest
Merged-In: Ib04bebb061dc64d6d685116b596fb3179d5b959a
Change-Id: I9118da3898d864c7bf0ed7bc9d94b94343c4a084
2020-12-16 11:44:34 +09:00
Orion Hodson
e5bd0dba21 Use libnetjniutils for JNI File Descriptor info
Drops use of deprecated API in libnativehelper and uses a common
helper that will be stable across releases.

Bug: 158749603
Test: m
Change-Id: Ic1a1811ffb9a1c207f562a180417e99df31e3502
2020-12-11 22:48:10 +00:00
paulhu
862c8a1ea0 Fix tethering doesn't turn off issue
When user restriction turns on, all tethering functions should
be disabled. But tethering functions still work after
restrication is on. Because tethering request would be removed
from mActiveTetheringRequests after starting tethering that
will result in Tethering#isTetheringActive() always returns
false. Thus, update the design to check tethered interface to
ensure that any of tethering function is working.

Bug: 169596583
Test: atest TetheringTests
Test: Manually test that tethering function would be disabled
      and notification would show to user after restriction
      was on.
Change-Id: Icb9649a5ecdec2d029ac763b5b9b80042ad50eb9
2020-11-10 16:47:52 +08:00
Nikita Ioffe
06bf173b20 Merge "com.android.tethering: set min_sdk_version 30" 2020-11-06 12:46:39 +00:00
Mark Chien
220e7854bd Merge "Fix null DadProxy failure in R Tethering unit test" 2020-11-06 11:00:19 +00:00
Nikita Ioffe
583e35a12e com.android.tethering: set min_sdk_version 30
Tethering is updatable apex module that was launched in R, hence it and
all it dependencies should specify min_sdk_version <= 30.

Test: m
Bug: 171668006
Bug: 171330443
Change-Id: Ic91cf96dda6419d1038b0329b920f9cd24482aef
Merged-In: Ic91cf96dda6419d1038b0329b920f9cd24482aef
(cherry picked from commit bee20e84f8)
(cherry picked from commit 1fe1e539e1)
2020-11-05 20:30:40 +00:00
markchien
290e7c452b Fix null DadProxy failure in R Tethering unit test
Tethering unit test would verify the interfaction between DadProxy and
IpServer. Since DadProxy only available in S+, the test would fail if it
build with R sdk.

Bug: 171936270
Test: atest TetheringTests in both R and S
Change-Id: Ia73d4aa59d01400d1ccfd3fdc1b721e269cae952
2020-11-05 15:28:56 +08:00
Baligh Uddin
ebff93159e Adjust visibility for tests
BUG: 167962976
Test: TH
Merged-In: Ic89c084604788b4d41cf854e5015c8ce7791c64d
Change-Id: I12e326167c6fb61a59a919cdd0198ac8f8c84772
2020-11-04 05:06:58 +00:00
Baligh Uddin
1711a1222c Revert "Add OWNERS block to prevent the tree from mooving during migration."
Migration of frameworks/base/packages/Tethering is complete, removing
the OWNERS block.
This reverts commit 1623eb61d5.
BUG: 167962976
Test: TH

Change-Id: Ic89c084604788b4d41cf854e5015c8ce7791c64d
2020-10-31 04:50:11 +00:00
Baligh Uddin
1623eb61d5 Add OWNERS block to prevent the tree from mooving during migration.
BUG: 167962976
TEST: None.
Change-Id: I49db5a11ee89645dac158ec3757180b2387e2d70
2020-10-29 03:24:01 +00:00
Baligh Uddin
f814b9b1ce Add visibility rules for packages/modules/Connectivity/Tethering
BUG: 167962976
Test: TH
Change-Id: Id28881b35cf24fc9517fa11af6d8e539ab244fa6
2020-10-29 02:11:55 +00:00
markchien
e3126480ba Add shared jarjar rule for tethering tests
Also jarjar com.android.net.module.util* to
com.android.networkstack.tethering.util*.

Bug: 171670016
Test: atest TetheringCoverageTests
Change-Id: I3bde9ad3c41adf36da99bd944303d88ce992201c
2020-10-26 18:20:25 +08:00
markchien
4607c5535b Add the flag and default enable selectAllPrefixRange
Also add MtsTetheringTest which only run if tethering mainline
module is installed.

Bug: 166057846
Bug: 170265597
Test: atest TetheringTests
Change-Id: I434dda81eb5fab700d873a8ff3429b4222f0c7e6
2020-10-19 16:50:29 +08:00
Mark Chien
8565b0244a Merge "Fix miss tracking downstream problem in PrivateAddressCoordinator" 2020-10-15 12:07:19 +00:00
markchien
634f0a8ec1 Fix miss tracking downstream problem in PrivateAddressCoordinator
The downstream do not be tracked if PrivateAddressCoordinator just
return cached address. Then, PrivateAddressCoordinator would not notify
that downstream if conflict happen.

Also remove the null check in getDownstreamPrefix because:
- An IpServer is only added to mDownstreams by requestDownstreamAddress.
- That method will only add the IpServer to mDownstreams if it has an
IPv4 address.
- As soon as that method returns, the IpServer sets mIpv4Address to the
address that was returned.
- When an IpServer is torn down, mIpv4Address is set to null after
releaseDownstream is called.

So it should never be possible for this to return null.

Bug: 168169687
Test: atest CtsTetheringTest
      atest TetheringTests
Change-Id: Ide5206b013acdc499344e1c839a830c5b245af41
2020-10-15 16:21:12 +08:00
Anton Hansson
87b8363cb9 Remove Tethering @TestApi
Modules shouldn't have TestApis, as documented in go/android-api-types.
Additionally, nothing depends on these TestApis existing.

Bug: 170395679
Test: m checkapi
Change-Id: I6e2c8298e90b4b54f0264be974d036fa08cd5632
Merged-In: I6e2c8298e90b4b54f0264be974d036fa08cd5632
2020-10-14 16:03:57 +01:00
Treehugger Robot
32456142c0 Merge "Test conflict notification work when using cached address" 2020-10-14 13:18:58 +00:00
markchien
ccf07b1dd6 Test conflict notification work when using cached address
This test catch the regression introduced in r.android.com/1432958.

Bug: 1432958
Test: atest TetheringTest

Change-Id: Id0c1afb5563954ffee1f598a3a5de6a245d77a0e
2020-10-14 17:02:29 +08:00
Mark Chien
8c9a2645d8 Merge "Allow tethering pick prefix from all of private address range" 2020-10-13 13:12:58 +00:00
markchien
d9acdccbd3 Allow tethering pick prefix from all of private address range
Currently tethering only pick prefix from 192.168.0.0/16. There is no
aviable tethering address if the upstream address is 192.168.x.y/16.
This change allow tethering to pick prefix from any private address
rnages. Now it still pick from 192.168.0.0/16 only to avoid behavior
change. Will have follow up commit to change the configuration.

Bug: 166057846
Bug: 170265597
Test: atest TetheringTests
      atest CtsTetheringTest

Change-Id: Ib6304eb8b4788e9196d0af48e72f00a6bda73a5f
2020-10-13 16:45:09 +08:00
Remi NGUYEN VAN
71b9e93a83 Use IpUtils, NetworkStackConstants in DadProxyTest
The test had TODOs to address to use IpUtils and NetworkStackConstants
classes once they were moved to frameworks/libs/net. This is now done,
so using the new classes.

Bug: 158042941
Test: atest TetheringPrivilegedTests
Change-Id: I536b4506dbc3b42547ba9cb4e7c3c7a3e9459dd1
2020-10-13 11:30:03 +09:00
Remi NGUYEN VAN
4cb4ef8333 Merge "Move IpUtils to frameworks/libs/net" 2020-10-09 00:13:40 +00:00
Mark Chien
f052e40f79 Merge "Make the IP subnet persistent till reboot" 2020-10-07 09:39:29 +00:00
markchien
a2ffad84c7 Make the IP subnet persistent till reboot
Make the IP subnet persistent if it do not conflict with upstream.
It allow client to reuse its IP that usually reduce DHCP procedure.

Bug: 168169687
Test: atest TetheringTests
Change-Id: Iddc5304730dce7b11c5d124b7eddce057d752bbd
2020-10-06 20:25:19 +08:00
Anton Hansson
b8a342e4bc Explicitly reference framework-wifi app build rule
This works around a build-system limitation where it does not know
which jars to feed r8 to resolve all classes during proguarding.

Bug: 160453030
Bug: 169931783
Test: build_mainline_modules.sh (with prebuilt sdk)
Change-Id: I3d9f2049cf898b5e551a5c5764df423abaa5e92d
Merged-In: I3d9f2049cf898b5e551a5c5764df423abaa5e92d
2020-10-05 11:43:39 +01:00
Remi NGUYEN VAN
2494a06bb3 Move IpUtils to frameworks/libs/net
The utility classes are useful for mainline modules and their tests, for
example IpClientIntegrationTest.

Bug: 168868607
Test: m && atest NetworkStaticLibTests
Change-Id: If2b1613aa18a7990391e2d31cc2951ca93f1cf3c
2020-10-05 14:38:19 +09:00
Treehugger Robot
0b1e7d8956 Merge "Make PrivateAddressCoordinator ignore vpn network" 2020-10-05 04:10:48 +00:00
Lorenzo Colitti
c99ef48090 Fix OffloadHardwareInterfaceTest.
r.android.com/1424920 changed the code but forgot to update the
unit test.

Also fix some lint errors.

Bug: 149109043
Test: atest TetheringTests TetheringPrivilegedTests
Change-Id: I53ca4b9877dcb4a759dee6ec63133653315d826f
2020-09-30 17:04:19 +09:00
Tyler Wear
7f70074abc tethering: offload: Netlink Req NfGen
Add the netfilter generic message header to
the netlink req. This is needed so the kernel
won't ignore the request for invalid params.

Bug: 149109043
Test: ConntrackSocketTest
Change-Id: I1757fdeb11a0cac5821021a22323cbd74fe22bdc
2020-09-30 15:07:47 +09:00
markchien
1a2163b972 Make PrivateAddressCoordinator ignore vpn network
If vpn app make its netmask as 0, PrivateAddressCoordinator
would not able to find suitable address for tethering downstream.
Since tethering do not support vpn as upstream, just ignore vpn
in PrivateAddressCoordinator.

Bug: 166365863
Test: atest TetheringTests
      atest CtsTetheringTest
Change-Id: Iabe265467044fea9fa437674ca29ffc7bcdefe3b
2020-09-28 17:22:19 +08:00
Treehugger Robot
18ee591257 Merge "Fix TetheredClient callback fail in InProcessTethering" 2020-09-28 08:53:53 +00:00
Treehugger Robot
f5096cc1e3 Merge "Remove double check interface by NetworkInterface" 2020-09-28 04:21:28 +00:00
markchien
f609923b4b Remove double check interface by NetworkInterface
NetworkInterface#getByName can not get the interface without IP addresses.
When setIncludeTestInterfaces(true) is called, the interface will be
placed in client mode, which will delete the link-local address. So calling
NetworkInterface#getByName to get test interface may not work before
switching to server mode.

Bug: 168215721
Test: atest CtsTethering
Change-Id: Ice8adcce1c4b2c86bd219c701b2afa9ba2339f24
2020-09-27 17:11:20 +08:00
Remi NGUYEN VAN
a8e68bb723 Merge "Remove unused testutils lib from tethering tests" 2020-09-24 08:16:21 +00:00
markchien
84ec4a397a Fix TetheredClient callback fail in InProcessTethering
TetheredClient callback would additional check whether caller has
NETWORK_SETTINGS or {MAINLINE_}NETWORK_STACK permission, but it do not
grant for self accessing. InProcessTethering run in system server, so
the services in system server would fail to call TetheredClient callback.
Grant permission for self process.

Bug: 169231588
Test: atest CtsTetheringTest
Change-Id: Ic04e44aef4df772c718ff25ed331bf02f5940c1d
2020-09-24 10:11:51 +08:00
Remi NGUYEN VAN
8f59ec090d Remove unused testutils lib from tethering tests
frameworks-base-testutils is unused in tethering integration tests, so
the dependency can be removed.
That test library also contains test classes, so removing the dependency
allows tethering tests to stop running the associated tests.

Also add jarjar rules to the unit tests to zap (remove) the test classes
from the output APK. Ideally the unit tests should stop depending on
that library too (TestableLooper can be used instead of TestLooper), or
the frameworks-base-testutils library should stop including test
classes.

Bug: 167968946
Test: m CtsTetheringTest TetheringTests
Change-Id: Ie950ce5b6181e388a7f71da430fd2dd8ada32e49
2020-09-23 17:10:42 +09:00
Remi NGUYEN VAN
72e81859f8 Merge "tethering: DAD Proxy Daemon" 2020-09-23 04:57:42 +00:00
Tyler Wear
90e4063fd2 tethering: DAD Proxy Daemon
DAD proxy daemon responsible for forwarding NS/NA between
tethered iface and upstream iface.

Change-Id: I2e58e10e7fa7dba6a6f63ad03b000549f3afc37e
2020-09-22 11:58:49 -07:00
Bill Yi
725af62a59 Merge mainline-release 6664920 to master - DO NOT MERGE
Merged-In: Id04ea331831e8b26ba99478848392b40a92548d5
Change-Id: I888da0c9475f2d00602d917d2f58169f8d7c93a4
2020-09-17 21:56:59 -07:00
Hungming Chen
56c632caed Move BPF offload program from netd to mainline
Test: as the follows.
$ adb shell ls sys/fs/bpf | grep offload
map_offload_tether_ingress_map
map_offload_tether_limit_map
map_offload_tether_stats_map
prog_offload_schedcls_ingress_tether_ether
prog_offload_schedcls_ingress_tether_rawip

$ adb shell dumpsys netd --short
  TetherController
    BPF ingress map: iif(iface) v6addr -> oif(iface) srcmac ..
      13(rmnet_data3) 2401:e180:8842:6e3:bc6a:2e45:c30:f418 -> ..
    BPF stats (downlink): iif(iface) -> packets bytes errors
      13(rmnet_data3) -> 7 488 0
    BPF limit: iif(iface) -> bytes
      13(rmnet_data3) -> 9223372036854775807

Log:
bpfloader: Loaded object: /apex/com.android.tethering/etc/bpf/offload.o

Change-Id: I71b7efb1f4bd6eb1cd469a0e1e4a56342dc6e579
2020-09-16 20:38:14 +08:00
Anton Hansson
9aed13818c Simplify module visibility post build refactor
//visibility:override is no longer needed for impl_library_visibility
to override visibility.

Removing this allows the defaults module to specify better defaults.

- Stub libraries are made publicly visible, via `visibility`
- Impl libraries are private by default, but visibility is extended
  by the modules

Bug: 165017290
Test: m
Exempt-From-Owner-Approval: build refactor
Change-Id: Ibf35bfac5c99a21125f89ba10945f3364217b90f
2020-09-07 07:54:50 +00:00
Bill Yi
6c701f5341 Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: Ibfe7031a80e38ed3fe776e195514e6c7cad418ab
2020-09-05 01:14:22 +00:00
Bill Yi
ac8f65a544 Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: I946ba0e5ca40f934bdc7588eb244969103813c4c
2020-09-03 08:32:04 +00:00