Commit Graph

43661 Commits

Author SHA1 Message Date
paulhu
b2d5b054d3 Save uid netd network permissions
PermissionMonitor only saves netd network permissions by appId.
Then apply same permision to uids which are same appId. But
UIDS_ALLOWED_ON_RESTRICTED_NETWORKS can allow single uid has
restricted network permission. Thus, save the netd network
permissions by uid that can apply different permission to each
uid.

Bug: 192431153
Test: atest FrameworksNetTests
Change-Id: I942cbe0fa30758a7497c47a1b684ed70c4e3b09e
2021-11-26 14:47:01 +08:00
Aaron Huang
2797722d0c Merge "Remove TODO that was already done" am: 93d437ba0c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1900213

Change-Id: Ie6370d66be8d4de22465b31be0b0eba680ed0a16
2021-11-26 04:16:55 +00:00
Aaron Huang
93d437ba0c Merge "Remove TODO that was already done" 2021-11-26 04:00:44 +00:00
Treehugger Robot
8edbc35d56 Merge "Stop skipping VPN tests when running ADB over TCP." am: b031a2265e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1669610

Change-Id: I7a829bc84282c940abae5e0930a9c2cbe4cc7099
2021-11-26 03:47:07 +00:00
Treehugger Robot
b031a2265e Merge "Stop skipping VPN tests when running ADB over TCP." 2021-11-26 03:30:45 +00:00
Chiachang Wang
3bc5276568 Enable strict_updatability_linting in connectivity src
Bug: 188851968
Test: m lint-check
Change-Id: I3cd06ea16f05cb37d9369a48dd0285d8239fd764
2021-11-26 10:31:58 +08:00
Treehugger Robot
40cc2bdcf6 Merge "better compatibility for unusual Qualcomm/Mediatek cellular ARPHRD_* values" am: edfb9232f0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1900813

Change-Id: I822c2a44b46bf78171c461a1a89f1f017a28ade6
2021-11-26 01:35:25 +00:00
Treehugger Robot
edfb9232f0 Merge "better compatibility for unusual Qualcomm/Mediatek cellular ARPHRD_* values" 2021-11-26 01:25:13 +00:00
Davor Majdandzic
2cdbbc1a32 Competing network interfaces
NetworkRequest is expecting transport type Ethernet or test. This
causes the test 'testApiCallbacks' to fail for devices that have a
non-test Ethernet network since that network is being chosen instead of
the expected test Ethernet network.

Remove network capability TRANSPORT_ETHERNET from CaptivePortalApiTest.

Bug: 204329523
Test: atest android.net.cts.CaptivePortalApiTest#testApiCallbacks

Signed-off-by: Davor Majdandzic <davor.majdandzic@aptiv.com>
Change-Id: Ie7b4d00c08f1497044e63462f1d899d1f3dea2df
2021-11-25 17:37:45 +01:00
Maciej Żenczykowski
23ff703f7a better compatibility for unusual Qualcomm/Mediatek cellular ARPHRD_* values
see kernel/private/wembley/+/refs/heads/tm-4.19/include/uapi/linux/if_arp.h
which has #define ARPHRD_PUREIP 520 (and is a Mediatek based device)

or Qualcomm based Pixel 3 and older kernels (<=4.9) which #define ARPHRD_RAWIP 530
(unlike Pixel 4/5 which are 4.14/4.19 and use the upstream ARPHRD_RAWIP of 519)

We stop supporting 520/530 starting with 5.11+ since those as GKI 2.0 only kernels
cannot be using non-upstream-ed constants (btw. this is probably true for 5.10-S
as well, but let's play it safe).  For pre-5.11 we're lucky because even now
(with 5.15 released) upstream has yet to define an ARPHRD_* for either one of
520 or 530, so there's no harm in 'squatting' on this unused space.

This approach also means there's absolutely no change in behaviour on
pre-launch-T devices, since they all are at most running 5.10 kernels.

We'll be able to get rid of this code in the far future once we stop shipping
mainline tethering updates to pre-5.10 Mediatek or pre-4.14 Qualcomm devices.
This will likely be many years.

Test: TreeHugger
Bug: 207057951
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I767b5fc56bc826e088507aea8ae7a30aa8aa424a
2021-11-25 11:03:58 +00:00
Mark Chien
000aaba95d Merge "Add defaults to enable/disable connectivity/tethering next" am: 0f56af4162
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1895326

Change-Id: I27b9d1116920c1bfb9f311f015546d56e8792b8f
2021-11-24 07:18:50 +00:00
Mark Chien
0f56af4162 Merge "Add defaults to enable/disable connectivity/tethering next" 2021-11-24 07:05:00 +00:00
markchien
598a75ba8c Add defaults to enable/disable connectivity/tethering next
The defaults can be used to enable/disable connectivity next targets
depending on the branch, while minimizing merge conflicts.

The "next" target may use unstable APIs. It need to be disabled in the
branch which only have the last stable SDK available.

Also correct TetheringTestsLatestSdkLib which should use stable API.

Test: TH
Change-Id: I00d91bbd513277c1cedf67d18ac9f56cc4037309
2021-11-24 12:20:23 +08:00
Aaron Huang
2f8e0319d4 Remove TODO that was already done
The TODO is used to track to remove dependencies from
ConnectivityService. Remove it since that was already done.

Test: remove comment only
Change-Id: Ida8c1124e110f64262a693dcddfbc7a9549510da
2021-11-23 14:39:16 +08:00
Ken Chen
335c0d4249 [NETD-BPF#4] Move bpf_shared.h from netd to module
The header file is referenced by the part going to be mainlined in Netd.
Note that some platform visibility is required with this commit, since
users of bpf_shared.h is currently located in platform. The visibility
can be removed when all users are moved out of platform.

Bug: 202086915
Test: m; flash; boot
Test: cd system/netd && atest
Test: cd packages/modules/Connectivity && atest
Test: atest FrameworksNetTests
Change-Id: I5c16511b6a2d4eb80dfd93157cbc98d5030bd5ac
2021-11-23 11:53:46 +08:00
Treehugger Robot
3046820011 Merge "isEthernet() - ARPHRD_PPP does not require ethernet headers" am: 73b42b0f95
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1897432

Change-Id: I560b34da41630c16977614a1a1e4770672dcf022
2021-11-22 09:06:23 +00:00
Treehugger Robot
73b42b0f95 Merge "isEthernet() - ARPHRD_PPP does not require ethernet headers" 2021-11-22 08:53:28 +00:00
Treehugger Robot
0061457a54 Merge "Fix a possible flake in disconnectFromWiFi" am: 1c4a66ddc4
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1892098

Change-Id: I6df297447ade42e38963855809c499c55b6ea85c
2021-11-22 07:53:43 +00:00
Treehugger Robot
1c4a66ddc4 Merge "Fix a possible flake in disconnectFromWiFi" 2021-11-22 07:34:57 +00:00
Remi NGUYEN VAN
b7fd5bd3e1 Merge "Update NSD tests without AsyncChannel" am: 469d941752
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1823893

Change-Id: I897bdce6cdaf4ea390d8ce6be03b87bacd6da82e
2021-11-22 06:19:18 +00:00
Remi NGUYEN VAN
469d941752 Merge "Update NSD tests without AsyncChannel" 2021-11-22 05:58:15 +00:00
Aaron Huang
4fc403c3b0 Merge "Use real ProxyTracker in ConnectivityServiceTest" am: c7037475fa
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1885529

Change-Id: Id685a51b37d59a822aaa9307f9d4b55053211612
2021-11-22 05:41:34 +00:00
Aaron Huang
c7037475fa Merge "Use real ProxyTracker in ConnectivityServiceTest" 2021-11-22 05:25:28 +00:00
Ken Chen
bb57fa9eec [NETD-BPF#3] Relocate Tethering/bpf_progs and rename bpf_tethering_headers
The folder is currently used by tether offload only. Because we will
move netd.c and clatd.c to it, the folder should be moved to the upper
tier.

Also, rename bpf_tethering_headers to bpf_connectivity_headers so that
other connectivity code besides to tethering are justified to use it.

Bug: 202086915
Test: atest FrameworksNetTests
Change-Id: I95943c6e909f1fdca12604ef0c55d67c39ca686b
2021-11-20 18:31:08 +08:00
Remi NGUYEN VAN
e03f77170a Remove unused service and test dependencies am: f96ecf2708
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1895317

Change-Id: I677a6b4c0b68648b4fab0e6f67edc88aa8be77b2
2021-11-19 15:59:07 +00:00
Remi NGUYEN VAN
f96ecf2708 Remove unused service and test dependencies
Nothing uses StateMachine in service-connectivity, and
FrameworksNetTestsLib pulled a lot of unused dependencies with
services.core and services.net.

Remove unused dependencies. This helps measure code coverage more
accurately.

Bug: 207020032
Test: atest ConnectivityCoverageTests
Change-Id: I39857865594a3263c4b1deeda23312c8e4f86a77
2021-11-19 21:14:39 +09:00
Maciej Żenczykowski
c8c36b9407 isEthernet() - ARPHRD_PPP does not require ethernet headers
(this is required to make ipv6 tethering work with at least S.LSI modems)

Test: TreeHugger
Bug: 207057951
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ic178db928ec7f74f69d7d4739b3b8439ff026625
2021-11-18 23:31:56 -08:00
Xin Li
c96c26077b Merge "Merge sc-qpr1-dev-plus-aosp-without-vendor@7810918" into stage-aosp-master 2021-11-18 21:29:06 +00:00
Treehugger Robot
d42bf9e53b Merge "Disable CtsNetTestCases if needed" am: 2c75c0444d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1892477

Change-Id: I3e3d8fde1970407f40657136d3a411008aaa99c0
2021-11-18 11:56:24 +00:00
Treehugger Robot
2c75c0444d Merge "Disable CtsNetTestCases if needed" 2021-11-18 11:43:07 +00:00
Remi NGUYEN VAN
cd4b4ee973 Update NSD tests without AsyncChannel
Update the tests to use the newer NsdManager based on Binder interfaces
instead of AsyncChannel.

Bug: 190249673
Test: atest NsdManagerTest NsdServiceTest
Change-Id: I0991b598331e335a0bc211f010da7f034fb2441b
2021-11-18 18:22:45 +09:00
Maciej Żenczykowski
961b290878 explicitly specify that offload.o & test.o bpf programs are S+ am: a457bf7ea8
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1895606

Change-Id: I39b24e96b5adc766473e7d369b44f5bfbdc40e5c
2021-11-18 05:18:15 +00:00
Maciej Żenczykowski
a457bf7ea8 explicitly specify that offload.o & test.o bpf programs are S+
Note: due to the release version of the Connectivity/Tethering mainline
module being built from sc-mainline-prod, this won't actually take effect
until system/bpf bpfloader at version 0.6+ is merged in to that tree.

This doesn't really matter, since currently things default to v0.0+.
But there is no mainline module updatable pre-v0.2 supported OS
anyway. BpfLoader v0.2 is what shipped in Android S Beta 4 through
Android S Final.

Before S there simply was no bpfloader support for mainline updatable
ebpf code, while S Beta 3 and earlier shipped v0.0 which is badly
incompatible with even the current version of the mainline module.

Additionally v0.0 doesn't even parse this field, while v0.1 which
does was very short lived [~3 days] and can thus be utterly ignored.

As such this change is effectively a no-op, and even post merge
of bpfloader v0.6+ into sc-mainline-prod will still be effectively
a no-op.

So why do it? I want to explicitly document that these programs are S+,
so that I can change the default in the future to be T+.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I7e5d0124700c7045abe16b1f3b504c9e88054ff2
2021-11-17 12:04:44 -08:00
Treehugger Robot
bc0c9111f3 Merge "Always use OWNERS from master branch." am: d8d887bd39
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1894899

Change-Id: I7767c1ec16b4a4dcc0becdc134f195c1edd66cb0
2021-11-17 08:07:38 +00:00
Treehugger Robot
d8d887bd39 Merge "Always use OWNERS from master branch." 2021-11-17 07:55:00 +00:00
Chalard Jean
66bd87f0d4 S- not to crash on NetworkInfo(null) or setDetailedState(null) am: dece0d805f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1892101

Change-Id: Idfb993a40d43a4ead862c229c93b8cb680b7bc1a
2021-11-17 06:49:44 +00:00
Maciej Żenczykowski
101f39bb66 Always use OWNERS from master branch.
Since you cannot include yourself we need an extra level of indirection,
to make sure that OWNERS remains current even in historical branches.

Also vastly increase the number of OWNERS

Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I19723fd9fbcee8fe3d8c9386ec5290d2764f2104
2021-11-17 05:58:02 +00:00
Taras Antoshchuk
bc3f86dfa3 Disable CtsNetTestCases if needed
Apply NetworkStackNextEnableDefaults to CtsNetTestCases to disable it
in branches where NetworkStackNext and related targets should not be
built.

Test: presubmit
Change-Id: I850b4294aa4c3c01f8871760185ca7fedc0f8584
2021-11-15 17:40:42 +01:00
Chalard Jean
dece0d805f S- not to crash on NetworkInfo(null) or setDetailedState(null)
When NetworkInfo(null) or setDetailedState(null, any, any) are
called, S used to not crash but plant a null bomb for later
which may explode in some calls (notably, parceling) : see the
bug referenced below for details.

To help catching these errors earlier a patch was made to crash
as soon as one of these methods is called with a null argument,
but this will also crash incorrect use on existing code that
may never actually step on the mine, crashing code that used not
to crash. For safety, implement the new behavior only on T.

Bug: 145972387
Test: NetworkInfoTest
Change-Id: Ib710497d83b2d26439c2bd4d2f572310db97d6fd
2021-11-15 21:18:25 +09:00
Aaron Huang
e3879abb07 Use real ProxyTracker in ConnectivityServiceTest
Currently CS test uses a mock ProxyTracker object to verify that
the sendProxyBroadcast() is called. Also, if the network is a
default network then sendProxyBroadcast() will be indirectly
called in setDefaultProxy(). This only verifies that the method
is called but it doesn't verify that the broadcast is sent.

Instead of testing setDefaultProxy() is called, it is better to
verify that the broadcast is actually sent. Therefore, use a
real ProxyTracker in the test to verify the broadcast is sent.

Test: FrameworksNetTests:ConnectivityServiceTest
Change-Id: Id5c9e07e8326f24bd2665b4bb08f96d6d57d999c
2021-11-15 20:01:12 +08:00
Chalard Jean
05c291e5a3 Fix a possible flake in disconnectFromWiFi
1. There is a theoretical issue where the callback is not yet
   registered when wifi is disabled, but there is no evidence
   of it actually happening
2. 2 minutes timeout makes no sense for these tests that have a
   total 1 minute timeout anyway

Bug: 196387278
Test: CtsNetTestCases
Change-Id: I120af9b312ca34431d0e62dd85233fcdaa1b09b9
2021-11-15 11:58:07 +00:00
Maciej Żenczykowski
694ecd1c53 Merge changes from topics "rename-libbpfmapjni", "rename-libtetherutiljni" am: ff81692077
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1886108

Change-Id: I14463253c218b1a6f7964566fbc1c93fe48de672
2021-11-11 13:42:41 +00:00
markchien
de93cf9aba Rename tethering jni and get the jni by its package name am: f967b11087
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1885530

Change-Id: Icc18029f126a4845d6d2071d9e36458cbab4c313
2021-11-11 13:42:39 +00:00
Maciej Żenczykowski
ff81692077 Merge changes from topics "rename-libbpfmapjni", "rename-libtetherutiljni"
* changes:
  Rename libbpfmapjni and include bpf common util library
  Rename tethering jni and get the jni by its package name
2021-11-11 13:19:48 +00:00
Treehugger Robot
d5ad273033 Merge "replace R + 1 with S" am: 7eb9f88a6e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1888235

Change-Id: I81fd120c00c876399a69644fa2fe2dd2738b2310
2021-11-11 07:41:53 +00:00
Treehugger Robot
7eb9f88a6e Merge "replace R + 1 with S" 2021-11-11 07:26:39 +00:00
markchien
782a56809b Rename libbpfmapjni and include bpf common util library
1. libbpfmapjni.so is rename to libnet_utils_device_common_bpf.so
2. net-utils-device-common-bpf.jar is separated from
   net-utils-device-common-netlink.jar

Bug: 205088391
Test: atest TetheringTests
      atest CtsTetheringTest
      atest TetheringPrivilegedTests

Change-Id: If59b35b3429ebd597c18678499ff458183f89026
2021-11-11 13:49:15 +08:00
Remi NGUYEN VAN
31969c1dc5 Merge "Fix NetworkCapabilitiesTest on S" am: 4638c093ed
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1887835

Change-Id: I7e2c6a22a7314584c05bf12083648cad45249bb2
2021-11-11 04:54:53 +00:00
Remi NGUYEN VAN
4638c093ed Merge "Fix NetworkCapabilitiesTest on S" 2021-11-11 04:42:36 +00:00
Remi NGUYEN VAN
daa03defee Fix NetworkCapabilitiesTest on S
Mark NetworkCapabilitiesTest as ConnectivityModuleTest so that it is
only run in MTS with the Connectivity module installed, and fix
parceling tests to use the right number of fields in that case.

NetworkCapabilitiesTest is only useful to test the Connectivity module,
and not other modules like NetworkStack, as it is a unit test of a class
in the Connectivity module.

Bug: 205901761
Test: atest NetworkCapabilitiesTest
Change-Id: I10ba0f866bc7a39b2c90bdde12a79feefea2d5ee
2021-11-11 12:30:07 +09:00