Commit graph android_packages_modules_Co.../service/src/com/android/server/ConnectivityService.java
Message SHA1
Merge "Clat dump information improvement" am: 2438b2f5c6 am: 3e47c16116
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2100994

Change-Id: Ib1cf2708e47fe80348831da10cee9dfadf6bc3ad
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Treehugger Robot   authored and   Automerger Merge Worker   commited 2022-05-19 08:35:05 +00:00
da1deefb01
Merge "Clat dump information improvement"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-19 06:35:16 +00:00
2438b2f5c6
Clat dump information improvement
This is a followup commit for aosp/2017317.

1. Reorder the NAT464 information in dumpsys connectivity
2. Reword message when clat not started

Bug: 212345928
Test: dumpsys connectivity
Change-Id: I31c7066787dc7db8e5fe225f3918368b25bb7f5e

Hungming Chen   authored and   Nucca Chen   commited 2022-05-18 14:49:57 +00:00
c6e00ea74e
Merge changes I03e7cda7,I675c4ef5 am: af7101ff0f am: ec586c6cdb
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2072767

Change-Id: I7e55796d79e6a88ae2a43f7851ef8bccc6ccea04
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Treehugger Robot   authored and   Automerger Merge Worker   commited 2022-05-18 04:07:26 +00:00
caf8c958ed
Merge changes I03e7cda7,I675c4ef5
* changes:
  Allow ethernet on automotive to set allowed UIDs
  Updating Eth CTS to account for existing ifaces

Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-18 02:52:24 +00:00
af7101ff0f
Merge changes I5ffa2faf,Id5f14d6e am: b6ac308b50 am: ba33b34c61
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2099718

Change-Id: I5a560ee1c5111a2e8cd7f8c3be3fd881a6ea690c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Treehugger Robot   authored and   Automerger Merge Worker   commited 2022-05-17 23:10:56 +00:00
7227bc1cff
Allow ethernet on automotive to set allowed UIDs
Allow ethernet factories on automotive devices to set the allowed UIDs
on NetworkCapabilities.

Bug: 229419469
Test: atest FrameworksNetTests
Change-Id: I03e7cda75f1c530e0d0e4a756330bc9847a96668

James Mattis   commited 2022-05-17 15:32:13 -07:00
46491d7546
Merge changes I5ffa2faf,Id5f14d6e
* changes:
  add proper minimum bpfloader version annotations for block/clatd/dscp_policy/netd
  move netd maps and progs into /sys/fs/bpf/netd_shared/...

Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-17 15:39:02 +00:00
b6ac308b50
Merge changes If52ece61,Iedf344f6 am: f6131c483b am: 9d6decd77f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2095365

Change-Id: I6b73daf579d926f693ccb741615092b69200b82f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Motomu Utsumi   authored and   Automerger Merge Worker   commited 2022-05-17 02:45:29 +00:00
1f96b8833d
move netd maps and progs into /sys/fs/bpf/netd_shared/...
(out of current /sys/fs/bpf/net_shared/...)

This will allow genfscon regexp changes in a followup selinux commit.

Note that this has a hard dependency on system/bpf change
  'bpfloader: add support for netd_shared and net_private subdirs'
which also bumps bpfloader to v0.13.

This was merged May 12, 2022 (into both aosp/master and tm-dev)
and it is in Android T starting with Beta 3 release.

This isn't really an issue since amusingly T Beta 2 is already
incompatible with current mainline releases due to the snap
reverting a previous required bpfloader system/bpf change:
  move net_shared bpf programs into net_shared subdirectory
See: http://b/232050459#comment14

So this doesn't break T Beta1/2, since they already don't work,
and Beta3 will work.

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

Maciej Żenczykowski   commited 2022-05-16 23:24:37 +00:00
6d116d0f38
Block incoming packets in VPN Lockdown mode.
Currently, even when VPN Lockdown mode is enabled, incoming packets are
not dropped if VPN is not connected.

This commit fixed this issue.
After this commit, If VPN Lockdown mode is enabled, incoming packets
are dropped regardless of the VPN connectivity.

Bug: 206482423
Test: atest TrafficControllerTest ConnectivityServiceTest PermissionMonitorTest
Change-Id: If52ece613c8aac1073355e43b6fb9cb3fcc87d1d

Motomu Utsumi   commited 2022-05-16 10:40:59 +00:00
b08654ca04
Refactor VPN interface filtering necessity check
Test: atest ConnectivityServiceTest
Change-Id: Iedf344f6275d4c6b23716eb11e3eecf54c6a2f9a

Motomu Utsumi   commited 2022-05-16 10:38:01 +00:00
77a794868f
Merge "Limit data usage request per uid" am: fc938cf026 am: 26acc088a5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2085772

Change-Id: I8a9bee88f0f8ddec5f19b8bf5ce05d110d3f5aca
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Junyu Lai   authored and   Automerger Merge Worker   commited 2022-05-13 10:20:59 +00:00
702e0f3deb
Merge "Limit data usage request per uid"
Junyu Lai   authored and   Gerrit Code Review   commited 2022-05-13 09:06:41 +00:00
fc938cf026
Merge "Fallback should be evaluated for each preference" am: 5ea6f517a6 am: 8522fc4532
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2092882

Change-Id: I232ff4d279e7e2d26654637247967055f2e666e4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Sooraj Sasindran   authored and   Automerger Merge Worker   commited 2022-05-12 00:56:06 +00:00
95aa795f56
Merge changes I5eaeb415,I236f1550 am: 7d180e679a am: af3dffefd7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2015175

Change-Id: Ib20e505f1a6776a49e0c7bfc31a709328e77edf5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Paul Hu   authored and   Automerger Merge Worker   commited 2022-05-12 00:55:45 +00:00
0554b3e11b
Limit data usage request per uid
Currently, there is no limtation for an app to request
data usage callback, which is dangerous if the app fire
hundreds of thousands requests and potientially this might
cause OOM if the apps don't free them.

Test: atest NetworkStatsObserversTest#testRegister_limit
Bug: 229103088
Change-Id: I8299f46fd47a82ec9b25ba2e0d3c95db5512c331

Junyu Lai   commited 2022-05-12 08:53:21 +08:00
f3c946278c
Merge "Fallback should be evaluated for each preference"
Sooraj Sasindran   authored and   Gerrit Code Review   commited 2022-05-11 21:05:18 +00:00
5ea6f517a6
Fallback should be evaluated for each preference
1) alowFallback flag was incorrectly not reset while setting profile
   preference. Corrected it.

2) Threw exception if default preference and enterprise preference are
set together

3) renamed clearUser to withoutUser

Bug: 231670730
Test: ConnectivityServiceTest

Change-Id: Iaf49237bdc791c7e1dd884d069eff64e74757477

Sooraj Sasindran   commited 2022-05-10 22:11:55 -07:00
b0e283c900
Merge changes I5eaeb415,I236f1550
* changes:
  Check carrier privilege for CBS network requests synchronously
  Allow 3p apps to request restricted networks

Paul Hu   authored and   Gerrit Code Review   commited 2022-05-10 14:38:30 +00:00
7d180e679a
Check carrier privilege for CBS network requests synchronously
Normally if an app calls requestNetwork with capabilities that it
does not have permission to request, it gets a SecurityException,
except if it requests NET_CAPABILITY_CBS, in which case the request
will not throw but the app will get an onUnavailable callback.

Make this codepath throw as well. This simplifies the code and makes
the app-visible behaviour more consistent (and consistent with what
happens in S and below). The reason the code was written this way is because the carrier privilege app should receive a callback if it
loses permission. But onUnavailable is also not the best callback to
send, since it is used very rarely and also releases the app's
request. It seems better to leave the request registered and send
onLost.

Test: atest FrameworksNetTests
Bug: 194332512
Change-Id: I5eaeb415a6654851246e38599a996fbd9366fde0

junyulai   authored and   Paul Hu   commited 2022-05-10 10:26:54 +00:00
96bd9fe4de
Allow 3p apps to request restricted networks
Since 3p apps are allowed to use restricted networks in S, they
should be allowed to request a restricted network reasonably.
Otherwise, the functionalities of 3p apps will break if they rely
on restricted networks. Thus, CS needs to allow 3p apps to
request restricted networks if 3p apps are in the allowed list.

Bug: 230509118
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I236f1550095ee2be29adbc3b28d3ac2561a8b072

Paul Hu   commited 2022-05-10 18:10:19 +08:00
8fc2a55a16
Merge "Do not remove profile network preference for different uids" am: 42791188b2 am: e625192614
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2076720

Change-Id: I6cbdc8dedb869a45190482e8c5f71d8278f5ba59
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2022-05-09 14:26:47 +00:00
784d9b492c
Do not remove profile network preference for different uids
Multiple enterprise slice can be setup within single user profile based
on different uids. So do not remove profile network preference with same
user profile but with different uids

Bug: 229644102
Test: manual system test and ConnectivityServciceTest
Change-Id: I897b643e01240958fff575de9e15182069efc698

Sooraj Sasindran   commited 2022-05-06 00:58:33 -07:00
9cc129f37d
Merge "Update VPN isolation code for excluded routes" am: a1c6dbbd53 am: 1c0a2da4f8
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2078859

Change-Id: Ib62edcdb18eb132ec96501848c3ce21caefcd160
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Prerana Patil   authored and   Automerger Merge Worker   commited 2022-05-03 18:35:15 +00:00
7caa3b8bba
Merge "Update VPN isolation code for excluded routes"
Prerana Patil   authored and   Gerrit Code Review   commited 2022-05-03 17:40:12 +00:00
a1c6dbbd53
Merge "Allow device owner to configure profile network preference" am: 07a20408db am: 87f4d52d9f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2076940

Change-Id: I3c170a47f89bfe87cacdc7332cb318b63c05d5a0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Sooraj Sasindran   authored and   Automerger Merge Worker   commited 2022-05-02 07:43:12 +00:00
19f11ae93c
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
Update VPN isolation code for excluded routes
Bug: 230058738
Test: atest LinkPropertiesTest

Result: https://paste.googleplex.com/4706859672928256

Change-Id: I970fca6b0e2cd358e9bd77152563d13367867c74

Prerana   authored and   Prerana Patil   commited 2022-04-29 22:23:02 +00:00
2b97bbebf4
Merge "ClatCoordinator: dump BPF forwarding rules" am: 722346dce4 am: 50b8e0ebd3
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2017317

Change-Id: Ie2c13972bb9d4f54b4d874177b4d7bfda2835856
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Treehugger Robot   authored and   Automerger Merge Worker   commited 2022-04-27 17:55:08 +00:00
7f0d9d7351
Merge "ClatCoordinator: dump BPF forwarding rules"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-04-27 14:54:16 +00:00
722346dce4
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
adjust for new T bpfloader net_shared location am: 0736d7bd91 am: 2d59dc9854
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2071008

Change-Id: I1c90acd36a7105fcf9997c08443d3b624d487f76
Ignore-AOSP-First: this is an automerge
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Maciej Żenczykowski   authored and   Automerger Merge Worker   commited 2022-04-23 09:56:36 +00:00
d560797e5e
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
Merge "Remove UserId from UID when checking against BLUETOOTH_UID" am: 64ac247056 am: f271aed404
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2065564

Change-Id: Ie54acb1363d96fdfcec25656cf09ff2c90feda4a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2022-04-22 07:50:28 +00:00
dfcab7ca28
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 "[CLATJ#27] Use ClatdCoordinator since T+ devices" am: b4bf6cea38 am: 8d75a93995
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1951099

Change-Id: I3878e5359349d8195e8741ea69ae437edab68909
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Maciej Żenczykowski   authored and   Automerger Merge Worker   commited 2022-04-21 14:34:12 +00:00
2fadc5413c
[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
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
Merge "Improve dumpsys logs for NetworkProvider and NetworkOffer" am: 58f5b1a89e am: 7bc11250bd
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2067234

Change-Id: I4cc65e510fcc39ae4e9da0c6821b0ac5f8a97195
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Junyu Lai   authored and   Automerger Merge Worker   commited 2022-04-20 11:27:41 +00:00
b540407e4b
Improve dumpsys logs for NetworkProvider and NetworkOffer
It will look like below:

NetworkProviders for:
  2: WIFI_AWARE_FACTORY
  1: Ethernet

Network Offers:
  NetworkOffer [ Provider Id (1) Score(...) Caps [...] Needed by [1, 2, 3]]
  NetworkOffer [ Provider Id (2) Score(...) Caps [...] Needed by [4, 5, 6]]

Test: manual
Bug: 227408533
Change-Id: I84cb03757877d7127d39c359010c8092a8ca87d9

Junyu Lai   commited 2022-04-20 15:55:09 +08:00
0da479b280
Fix permission bypass problem for Tethering deprecated APIs
Since the tethering functions in ConnectivityService is delegated
to TetheringManager instance and get caches informataion in
TetheringManager without checking ACCESS_NETWORK_STATE permission.
If application use reflection call getTetherXXX functions in
ConnectivityService, it can get tethering status with no additional
execution privileges needed.

Bug: 162952629
Test: manual
Ignore-AOSP-First: security fix
Change-Id: I5b897f216db19fead6ba6ac07915aa0f6ff5bf42

markchien   commited 2022-04-19 19:13:10 +08:00
28160b3141
Add IPv6 Handling for DSCP Policies and Support Interfaces with MAC Addresses
Add bpf functionality to handle IPv6 packets and apply
DSCP value.
Also support DSCP policy rules on multiple interfaces
simultaneously.

Test: atest DscpPolicyTest

Bug: 217166486
Change-Id: I452a87355fd0382a4c38b84aa3465505951d9bf0

Tyler Wear   commited 2022-04-15 07:53:51 -07:00
3ad8089d19
Allow the bluetooth UID to register network factories.
This ensures that bluetooth can register bluetooth tethering
NetworkAgents without having to make NETWORK_FACTORY a privileged
or role permission.

Test: m
Bug: 221949454
Change-Id: I24a5da444b10dde740c1e449c8630de56946d4e1

Lorenzo Colitti   commited 2022-04-06 11:15:12 +09:00
d12af7ebfe
Merge "Add @RequiresPermission for setUnderlyingNetworks"
Lucas Lin   authored and   Gerrit Code Review   commited 2022-03-29 15:34:17 +00:00
41ed965e68
Api review: change updateFirewallRule to setUidFirewallRule
Bug: 218494748
Test: TH

Change-Id: I52a02ebe109b687359f579c16fded4af3c9cd242
Merged-In: I52a02ebe109b687359f579c16fded4af3c9cd242

markchien   commited 2022-03-25 18:49:08 +08:00
3c04e66da0
Rename destroyAndAwaitReplacement to unregisterAfterReplacement.
Rename requested by API council.

Fix: 224764301
Test: existing CTS tests updated
Change-Id: Ibab9c9cd64bf0dde1e22705e81cff11d356fc719

Lorenzo Colitti   commited 2022-03-24 01:12:26 +09:00
a63e2341d6
Add @RequiresPermission for setUnderlyingNetworks
setUnderlyingNetworks() is mainly for the NetworkAgents who hold
the NETWORK_FACTORY to set its underlying networks.

And the underlying networks are only visible and useful for the
caller of getNetworkCapabilities() or the receiver of
onCapabilitiesChanged() who hold one of NETWORK_FACTORY,
NETWORK_SETTINGS and MAINLINE_NETWORK_STACK permissions.
Otherwise, the underlying networks field will be cleard before
sending.

Bug: 205738644
Test: atest CtsNetTestCases:ConnectivityManagerTest
      atest CtsHostsideNetworkTests:HostsideVpnTests
      atest FrameworksNetTests
Change-Id: Ife7630d9676a31ee5ab977cb1b87aec3b6fd7080

lucaslin   commited 2022-03-22 18:15:09 +08:00
69e1aa9117
Allow sending of Administrator UIDs for *NETWORK_STACK
This change allows callers with the NETWORK_STACK or
PERMISSION_NETWORK_STACK to receive administrator UIDs. This will be
used by the VCN to ensure that administrator UIDs are accurately
populated, ensuring that the ConnectivityDiagnostics are triggered for
the VCN.

Bug: 193204385
Test: atest ConnectivityServiceTest
Change-Id: I3ecfbef6847dcc78adac05d0229719c97e3a220c

Benedict Wong   commited 2022-03-18 21:52:57 +00:00
a5604ea50f