Commit graph

51,864 commits

Message SHA1
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

Wayne Ma   commited 2022-05-09 19:35:53 +08:00
7ecded8248
Merge "Follow-up 2076940: Allow device owner to configure profile network preference "
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-02 15:00:55 +00:00
a14bd2a032
Merge "remove spurious ifdef POSIX_SPAWN_CLOEXEC_DEFAULT"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-02 14:30:53 +00:00
6867bb686e
Follow-up 2076940: Allow device owner to configure profile network preference
https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2076940

Fixes build failure


Bug: 231104107
Test: tests/unit/java/com/android/server/ConnectivityServiceTest.java
Change-Id: I7b6a3880ce0b0b9ad6fc6aa7a5fd4e249bb1606d

Vadim Caen   commited 2022-05-02 09:22:32 +00:00
baade1ca1e
Merge "Allow device owner to configure profile network preference"
Sooraj Sasindran   authored and   Gerrit Code Review   commited 2022-05-02 07:13:21 +00:00
07a20408db
Allow device owner to configure profile network preference
isMangedProfile returns true for managed profiles.
But enterprise device can be fully managed like device owner.
Hence check specifically if request is coming on fully managed
device.

Bug: 226966328
Bug: 231071836

Test: ran DevicePolicyManager CTS and ConnectivityServiceTest
Change-Id: I7827466bd61e24ba9c36c3a2e25043257e2ed602

Sooraj Sasindran   commited 2022-05-01 21:20:36 -07:00
bb65aa8fc2
Merge "[MS83] Add Cts for NetworkStatsCollection/History builders"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-02 02:26:55 +00:00
6a957c70c0
remove spurious ifdef POSIX_SPAWN_CLOEXEC_DEFAULT
(due to automerge to sc-mainline-prod being turned off,
and tm-dev already having this #define'd)

Test: N/A, trivial, TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ibf18b2c414f4916301476aa715ef465c8a98ec99

Maciej Żenczykowski   commited 2022-04-29 21:23:30 +00:00
3c75dff2eb
Merge "Fix targetSdkVersion gate for EXCLUDED_ROUTES compat change"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-04-29 08:57:25 +00:00
134d5ec884
Merge changes from topics "CATEGORY_ERROR_IKE", "CATEGORY_ERROR_NETWORK", "CATEGORY_ERROR_USER_DEACTIVATED", "CATEGORY_EVENT_ALWAYS_ON_STATE_CHANGED"
* changes:
  Test VpnManager event for CATEGORY_EVENT_NETWORK_ERROR
  Test VpnManager event for CATEGORY_EVENT_IKE_ERROR
  Test VpnManager event for CATEGORY_EVENT_ALWAYS_ON_STATE_CHANGED
  Test VpnManager event for CATEGORY_EVENT_DEACTIVATED_BY_USER

Lucas Lin   authored and   Gerrit Code Review   commited 2022-04-29 08:13:51 +00:00
025a3c993a
Merge "Add test dependencies for CtsHostsideNetworkTests"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-04-29 03:07:47 +00:00
5672613027
Fix targetSdkVersion gate for EXCLUDED_ROUTES compat change
Bug: 230726333
Test: check Developer options > App Compat Changes
Change-Id: Ia80efd07e6a8c6e6cc043411fbc2b56b07b4dd06

Taras Antoshchuk   commited 2022-04-28 15:47:29 +02:00
af3c360ed4
Merge "Unicast state of existing ethernet interfaces when registering new Ethernet Listener."
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-04-28 12:20:06 +00:00
baa5442dd9
Unicast state of existing ethernet interfaces when registering new Ethernet Listener.
When adding a listener via the addInterfaceStateListener API, the
expectation is that ethernet service calls that listener immediately
with a list of all interfaces and their respective state. However,
this doesn't work as expectation due to the EthernetManager stores
all registered listeners within one global service listener class,
the new registered listener will be invoked until the state of any
interface has changed.

Instead of storing all registered listeners within one global service
listener class, associate each new registered listener to an instance
of IEthernetServiceListener, and pass it to the EthernetService, that
will be invoked when iterating the state of all existing interfaces.

In order to avoid the scanning of all registered listeners, that would
be slow if there are lots of registered callbacks, moving the service
listener to the ListenerInfo class, where the service listener can
access the executor and listener passed from the caller naturely,
unnecessary to iterate the whole list.

Bug: 229125889
Test: atest android.net.cts.EthernetManagerTest --iterations
Change-Id: I111eba78d1066794c414ab5fb4a31258ea311413

Xiao Ma   commited 2022-04-28 18:59:44 +09:00
bb9a49cf72
Merge "Make a defensive copy when sending NetworkInfo change"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-04-28 09:29:27 +00:00
8eda07cff7
Make a defensive copy when sending NetworkInfo change
The issue scenario is:
- Telephony registers a network agent and calls markConnected().
- NetworkAgent set mNetworkInfo to CONNECTED and call
  queueOrSendNetworkInfo() with mNetworkInfo, but NetworkAgent
  don't actually send a message to CS yet because the agent is
  not registered.
- Telephony calls unregister because the cellular network is
  disconnected.
- NetworkAgent set mNetworkInfo to DISCONNECTED, overwriting the
  previous CONNECTED state, and then call queueOrSendNetworkInfo
  again with mNetworkInfo. Again this doesn't send any message
  because the agent is not connected.
- EVENT_AGENT_CONNECTED arrives. NetworkAgent replies all the
  messages in mPreConnectedQueue, but NetworkAgent send two
  DISCONNECTED NetworkInfos eventually.

The CONNECTED state should be sent to CS instead of latest state
DISCONNECTED. Thus, make a defensive copy when sending
NetworkInfo change to prevent state overwriting.

Without the NetworkAgent fix, the test will fail with no
onAvailable callback. Because the Network has never been martk as
CONNECTED.

Bug: 228623362
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I11681743d3ff87ff9affd0b7e766894dc5111028

Paul Hu   commited 2022-04-28 14:57:43 +08:00
0869af65b4
Merge "Add tests to verify app has network access in onResume."
Sudheer Shanka   authored and   Gerrit Code Review   commited 2022-04-27 17:47:16 +00:00
310ca20b33
Merge "ClatCoordinator: dump BPF forwarding rules"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-04-27 14:54:16 +00:00
722346dce4
[CLATJ#28] ClatCoordinator: spawn clatd with flag POSIX_SPAWN_CLOEXEC_DEFAULT
Close the leaking fds before spawning a process. The leaking fds
are unused by clatd and they cause unexpected avc denials. Close
the unused fds before clatd forked.

Bug: 230071136
Bug: 212345928
Test: atest FrameworksNetTests
      manual test
      1. Connect to ipv6-only wifi.
      2. Try IPv4 traffic.
         $ ping 8.8.8.8

Change-Id: I4f095cccd999b7dfd7fe87032bf7de81a925a4da

Hungming Chen   authored and   Nucca Chen   commited 2022-04-27 05:25:22 +00:00
88ca23c28f
Merge "Disable data stall recovery for DnsResolverTest"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-04-27 05:18:31 +00:00
91c0bcba04
Disable data stall recovery for DnsResolverTest
DnsResolverTest#testPrivateDnsBypass is flaky due to data stall recovery
attempting to tear down and reconnect the disconnected connection.
Disable data stall recovery so the test can run without a potential race
condition due to data stall recovery.

Test: atest DnsResolverTest
Bug: 230427128
Change-Id: I3057540d1b261bd51513c568072c8252c5d6959a

Sarah Chin   commited 2022-04-26 17:35:45 -07:00
217f55f8b9
ClatCoordinator: dump BPF forwarding rules
This is a preparation for moving clat map dump from netd to
mainline module.

Test: compare dumpsys connectivity and netd

$ adb shell dumpsys connectivity
Nat464Xlat:
  ClatCoordinator:
    Forwarding rules:
      BPF ingress map: iif nat64Prefix v6Addr -> v4Addr oif
        47 /64:ff9b::/96 /2a00:79e1:abc:6f02:4aac:17dd:b40e:8bcc -> /192.0.0.4 52
      BPF egress map: iif v4Addr -> v6Addr nat64Prefix oif
        52 /192.0.0.4 -> /2a00:79e1:abc:6f02:4aac:17dd:b40e:8bcc /64:ff9b::/96 47 ether

$ adb shell dumpsys netd
ClatdController
  BPF ingress map: iif(iface) nat64Prefix v6Addr -> v4Addr oif(iface)
    47(wlan0) 64:ff9b::/96 2a00:79e1:abc:6f02:4aac:17dd:b40e:8bcc -> 192.0.0.4 52(v4-wlan0)
  BPF egress map: iif(iface) v4Addr -> v6Addr nat64Prefix oif(iface)
    52(v4-wlan0) 192.0.0.4 -> 2a00:79e1:abc:6f02:4aac:17dd:b40e:8bcc 64:ff9b::/96 47(wlan0) ether

Change-Id: I597709663477b62005b0bc5cc1bf0fc22743e10b

Hungming Chen   authored and   Nucca Chen   commited 2022-04-26 06:44:14 +00:00
707675511a
Test VpnManager event for CATEGORY_EVENT_NETWORK_ERROR
Bug: 191413541
Test: atest FrameworksNetTests:VpnTest
Change-Id: Idffd5f5f8fc6614281f3fb0884228a797d783fe3

lucaslin   authored and   Lucas Lin   commited 2022-04-26 01:10:10 +00:00
cfec723ef9
Test VpnManager event for CATEGORY_EVENT_IKE_ERROR
Bug: 191413541
Test: atest FrameworksNetTests:VpnTest
Change-Id: Iebc0ac281eb03fac9626c64e44cdd14be1462d89

lucaslin   authored and   Lucas Lin   commited 2022-04-26 01:10:03 +00:00
827b44daea
Test VpnManager event for CATEGORY_EVENT_ALWAYS_ON_STATE_CHANGED
Bug: 225010642
Test: atest FrameworksNetTests:VpnTest
Change-Id: I078be4e00470efd9d7a2a87b40919116b99c83b8

lucaslin   commited 2022-04-26 09:09:03 +08:00
0772c169b5
Test VpnManager event for CATEGORY_EVENT_DEACTIVATED_BY_USER
Bug: 191413541
Test: atest FrameworksNetTests:VpnTest
Change-Id: Idc876275b88c2f4ddeb85c43d37d5f657b0f307b

lucaslin   commited 2022-04-25 23:12:26 +08:00
c5bf088ced
Merge "Add EthernetTestInterface to list of created interfaces"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-04-25 10:45:07 +00:00
79b38b491c
Merge "Test Ikev2VpnProfile provisioned with IkeTunnelConnectionParams"
Chiachang Wang   authored and   Gerrit Code Review   commited 2022-04-25 08:44:45 +00:00
2e670756ac
improve mts bpf_existence_test to cover netd/clatd maps and programs in new location
Test: TreeHugger, test bpf_existence_test
Bug: 218408035
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I2b183e66d0c4c8750873ae7f0a30b9809e2c8295

Maciej Żenczykowski   commited 2022-04-23 09:20:29 -07:00
e9d5ad0b88
adjust for new T bpfloader net_shared location
(this is safe because on pre-T none of these maps and programs are mainlined
 and thus safe to access from mainline code anyway)

Test: TreeHugger, manual
Bug: 218408035
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I23e565d665247f33e084978890a1ee8ffe0fe568

Maciej Żenczykowski   commited 2022-04-23 09:03:06 +00:00
0736d7bd91
Add tests to verify app has network access in onResume.
We already have tests that verify this but these new tests
launch the activity repeatedly a few times and verify the
network access as there are multiple race conditions
involving AMS, NPMS and the app that could result in an
inconsistent network rules state.

Bug: 226299593
Test: atest atest tests/cts/hostside/src/com/android/cts/net/HostsideConnOnActivityStartTest
Change-Id: I6372820fd2b21ebd759a3c44c7280c6699726bde

Sudheer Shanka   commited 2022-04-22 11:37:59 -07:00
dcde1b0092
Merge "Add a method to create a TAP interface with a given interface name."
Xiao Ma   authored and   Gerrit Code Review   commited 2022-04-22 13:10:19 +00:00
7d7e7cd1fe
Merge "Remove UserId from UID when checking against BLUETOOTH_UID"
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2022-04-22 06:51:41 +00:00
64ac247056
Merge "Update TEST_MAPPING file."
Sudheer Shanka   authored and   Gerrit Code Review   commited 2022-04-21 17:27:38 +00:00
8300421bc5
Merge "[CLATJ#27] Use ClatdCoordinator since T+ devices"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-04-21 14:00:23 +00:00
b4bf6cea38
Merge "[Tetheirng] Refactor carrier config to EntitlementManager"
Tom Hsu   authored and   Gerrit Code Review   commited 2022-04-21 13:43:14 +00:00
1135676150
Merge "[SettingsProvider] fix connectivity test"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-04-21 12:41:49 +00:00
5e64a14ccf
Merge "Update some descriptions and refine code"
Paul Hu   authored and   Gerrit Code Review   commited 2022-04-21 09:13:58 +00:00
db9f10c8cc
Add a method to create a TAP interface with a given interface name.
Add a method that allows the caller to specify whether to create a
tap interface with a given specific interface name instead of the
default one. So far only the given name that starts with "v4-testtap"
or "v4-testtun" prefix is allowed. That's helpful to create a clat
interface which always has "v4-" clat prefix in the IpClient integration
test, to verify the callbacks happend on adding/removing clat interface.

Bug: 163492391
Test: atest CtsNetTestCases
Change-Id: I9ea7013fce919cafb719998a123164b5507f9ac0

Xiao Ma   commited 2022-04-21 16:57:22 +09:00
8bbb8089d7
Test Ikev2VpnProfile provisioned with IkeTunnelConnectionParams
Bug: 223841137
Test: atest CtsNetTestCases FrameworksNetTests
Change-Id: I683f6242e4ed4a469893e3a17fe7b479a7a768e5

chiachangwang   commited 2022-04-21 14:49:41 +08:00
476e2a08bf
Merge "Remove the legacy ethernet config resource check."
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-04-21 05:55:07 +00:00
59e5df01d2
[CLATJ#27] Use ClatdCoordinator since T+ devices
- For clatd start and stop, use ClatdCoordinator on T+ and Netd on S-
- Fix the unit test for T+ and S- devices
  Note that mokito.verify(.., times(1)) is replaced by verify(..)
  because times(1) is the default and can be omitted.
  See verify in mockito/src/main/java/org/mockito/Mockito.java

Note that this commit needs to be merged with aosp/1956072.

Bug: 212345928
Test: atest FrameworksNetTests
      manual test
      1. Connect to ipv6-only wifi.
      2. Try IPv4 traffic.
         $ ping 8.8.8.8
      3. Check bpf entries are added
      4. Disconnect from ipv6-only wifi.
      5. Check bpf entries are removed
      6. testipv4.com shows 10/10

Change-Id: I7dfda6eec19de94e4258971effcd8a1210542473

Hungming Chen   commited 2022-04-21 13:24:36 +08:00
eb15a2d816
[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

tom hsu   commited 2022-04-21 12:44:26 +08:00
f0d60e9902
Merge "Deflake testStartStopVpnProfileV6 and testStartStopVpnProfileV4"
Chiachang Wang   authored and   Gerrit Code Review   commited 2022-04-21 03:44:45 +00:00
b458c41700
Remove the legacy ethernet config resource check.
The legacy ethernet config resource check isn't required any more
when the legacy resource cleanup in outside callers finishes, just
read the resource config from Connectivity module, but the value
still can be overlaid with pre-built RRO.

Bug: 214348333
Test: atest FrameworksNetTests
Change-Id: I86f6229343f9d48f0bd822e8086bdc880b81135f

Xiao Ma   commited 2022-04-21 10:51:15 +09:00
b8e0167935
Update some descriptions and refine code
Address aosp/2052545 leftover comments:
- Log a wtf when the received user is unknown.
- Move the code to where it's used.
- PermissionMonitor is using BpfNetMaps for sending traffic
  permission. So it’s useless to do the netd null check before
  sending permission. Thus, remove this redundant check.

bug: 224775316
Test: atest FrameworksNetTests
Change-Id: I5c1291b6b855747d7900372b800dd039dd0730fe

Paul Hu   commited 2022-04-21 09:44:02 +08:00
c2b5f83a70
Merge "ConnectivityNativeBinderTest: Check Kernel Version"
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2022-04-21 00:00:14 +00:00
76ff404153
Remove UserId from UID when checking against BLUETOOTH_UID
A UID can be a concatenation of a UserID with a 5 digit package UID.
E.g., Bluetooth under User10 would have UID 1001002. This CL removes the
UserID (if any), before checking against BLUETOOTH_UID.

Bug: 228598338
Test: m
Change-Id: I532583345cc9ab474fc848a3ede6be9d8be9c5b0

Andrew Cheng   commited 2022-04-20 18:27:23 +00:00
2ae5c735b6
[SettingsProvider] fix connectivity test
TestOnly flag allows the test to read restricted @Readable setting
ALWAYS_ON_VPN_LOCKDOWN_WHITELIST.

BUG: 177239688
Test: atest com.android.server.ConnectivityServiceTest
Change-Id: If41708ad31de9cec3a102b4de4d237e96a448ef1

Songchun Fan   commited 2022-04-20 09:29:40 -07:00
0cb706a0f4
Merge "Add bpf forwording packet count test"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-04-20 11:37:18 +00:00
faaaffc8a0