Commit Graph

7715 Commits

Author SHA1 Message Date
Aaron Huang
2b7e2960e3 Merge "Add LinkProperties methods to system APIs"
am: 5966c91e94

Change-Id: Ib6cc8dff09ed97bdcf8504f8318461e742c34f7a
2019-12-19 00:06:31 -08:00
Aaron Huang
5966c91e94 Merge "Add LinkProperties methods to system APIs" 2019-12-19 08:01:58 +00:00
Paul Hu
d73f6baa90 Fix PermissionMonitor issues
PermissionMonitor#hasPermission only checks permssions that app
requested but it doesn't check whether the permission can be
granted to this app. If requested permission doens't be granted
to app, this method still returns that app has this permission.
Then PermissionMonitor will pass this info to netd that means
this app still can use network even restricted network without
granted privileged permission like CONNECTIVITY_INTERNAL or
CONNECTIVITY_USE_RESTRICTED_NETWORKS.

PermissionMonitor#hasUseBackgroundNetworksPermission only uses
the first package name of the uid for checking permission.
This is incorrect since each package declared different
permissions. So using the mApps which already checked both
network and using restricted network permissions. If uid is in
the mApps list that means uid has one of permission at least.

Bug: 144679405
Test: Build, flash, manual test
      atest FrameworksNetTests

Change-Id: I2da730feda4d7ebed1f158b073167bb3964b3e7d
Merged-In: I8b03c9e23ffc9ff46264d6307fb841a7eda76a76
Merged-In: Ib08a940a6e5d3365c392ab7174d8484c197e0947
(cherry picked from commit 2e1da35b3b903f4aa01435c46b7014b88a41328d)
2019-12-19 13:43:40 +08:00
waynema
c4e888bf64 Remove tlsFingerprints init value
Initializing the value is no longer necessary because ResolverParamsParcel has
 a default value now

Bug:146100043
Test: FrameworksNetTests pass
Change-Id: Ieb151c0cbb330d25f887cbd2eba9db392699d36e
2019-12-19 11:39:44 +08:00
Automerger Merge Worker
f72923e980 Merge "Fix parceling of LinkProperties Inet6Addr" am: 98460b6863 am: d33931f634
Change-Id: Ie5b7782d788717dd1cc440e502d6cdf2d1c18eaa
2019-12-19 03:29:50 +00:00
Remi NGUYEN VAN
d33931f634 Merge "Fix parceling of LinkProperties Inet6Addr"
am: 98460b6863

Change-Id: I7e4de0ecf06d34f050a881250755c8c0456269fc
2019-12-18 19:12:04 -08:00
Remi NGUYEN VAN
98460b6863 Merge "Fix parceling of LinkProperties Inet6Addr" 2019-12-19 03:07:43 +00:00
Remi NGUYEN VAN
3a59a925e0 Fix parceling of LinkProperties Inet6Addr
IPv6 addresses parceled for DNS servers, private DNS servers, PCSCF
servers were parceled without the scope. This causes issues with
link-local DNS servers.

Test: atest FrameworksNetTests
Bug: 145181158
Change-Id: I0ed24e51d4d0656f4a1f932b5e9f646b35b4b971
2019-12-18 19:52:30 +09:00
paulhu
6c93075645 Fix security problem on PermissionMonitor#hasPermission
PermissionMonitor#hasPermission only checks permssions that app
requested but it doesn't check whether the permission can be
granted to this app. If requested permission doens't be granted
to app, this method still returns that app has this permission.
Then PermissionMonitor will pass this info to netd that means
this app still can use network even restricted network without
granted privileged permission like CONNECTIVITY_INTERNAL or
CONNECTIVITY_USE_RESTRICTED_NETWORKS.

Bug: 144679405
Test: Build, flash, manual test
Change-Id: Iae9c273af822b18c2e6fce04848a86f8dea6410a
Merged-In: I8a1575dedd6e3b7a8b60ee2ffd475d790aec55c4
Merged-In: I2da730feda4d7ebed1f158b073167bb3964b3e7d
2019-12-18 07:17:28 +00:00
paulhu
7307d27ff9 Fix security problem on PermissionMonitor#hasPermission
PermissionMonitor#hasPermission only checks permssions that app
requested but it doesn't check whether the permission can be
granted to this app. If requested permission doens't be granted
to app, this method still returns that app has this permission.
Then PermissionMonitor will pass this info to netd that means
this app still can use network even restricted network without
granted privileged permission like CONNECTIVITY_INTERNAL or
CONNECTIVITY_USE_RESTRICTED_NETWORKS.

Bug: 144679405
Test: Build, flash, manual test
Change-Id: I5eba4909e4c2e1d9f275f66be90ac36466b93e90
Merged-In: I8a1575dedd6e3b7a8b60ee2ffd475d790aec55c4
Merged-In: Iae9c273af822b18c2e6fce04848a86f8dea6410a
2019-12-18 03:47:28 +00:00
Aaron Huang
441e499861 Add keepalive related methods and fields to system APIs
Add KeepalivePacketData to system API for mainline support.
Also, remove InvalidPacketException class from SocketKeepalive
and create a new InvalidPacketException class in android.net

Bug: 139268426
Bug: 135998869
Bug: 138306002
Test: atest FrameworksNetTests
      atest NetworkStackTests
      atest FrameworksTelephonyTests
      ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh
      atest android.net.cts
      atest android.net.wifi.cts
      atest android.telephony.cts

Change-Id: I2d982e8abb5cb6b4c74a20483550b18cf814320d
Merged-In: I2d982e8abb5cb6b4c74a20483550b18cf814320d
2019-12-17 16:21:19 +00:00
Automerger Merge Worker
814bfc5c14 Merge changes from topic "dec13_netrevert" am: 9ea156af87 am: 5ca4b7fbf7
Change-Id: I9f6e7079d8e5d2e978ba618800c98df6e19e022b
2019-12-14 08:20:21 +00:00
Andrew Chant
5ca4b7fbf7 Merge changes from topic "dec13_netrevert"
am: 9ea156af87

Change-Id: I45543535ee0a394adcb4474ae51a0ce803c01f33
2019-12-14 00:06:02 -08:00
Andrew Chant
9ea156af87 Merge changes from topic "dec13_netrevert"
* changes:
  Revert "[NS A24] Add an object to represent changes in assignment"
  Revert "[NS A25] Send all listen callbacks after all rematches"
  Revert "[NS A26] Move available callbacks out of the rematch computation"
  Revert "[NS A27] Remove useless logs and a useless var"
2019-12-14 07:10:08 +00:00
Andrew Chant
6b569b2d62 Revert "[NS A24] Add an object to represent changes in assignment"
This reverts commit c375dccad3.

Reason for revert: Toggling wifi on/off causes networking to
 stop working with these four patches applied.
Bug: 146230156

Change-Id: Ie0217796c89abf0dc86e6a4f8324811155dc57cd
2019-12-14 03:35:07 +00:00
Andrew Chant
9e299b5f30 Revert "[NS A25] Send all listen callbacks after all rematches"
This reverts commit b56e56916f.

Reason for revert: Toggling wifi on/off causes networking to
 stop working with these four patches applied.
Bug: 146230156

Change-Id: Icd368df5ef76991dd2b4c1fa530cbc5fae2f61fa
2019-12-14 03:33:51 +00:00
Andrew Chant
6f9f854916 Revert "[NS A26] Move available callbacks out of the rematch computation"
This reverts commit be083a195f.

Reason for revert: Toggling wifi on/off causes networking to
 stop working with these four patches applied.
Bug: 146230156

Change-Id: I9af7f8b9af1a6279f2b9f1249824da705164c6b5
2019-12-14 03:32:41 +00:00
Andrew Chant
06a8edd342 Revert "[NS A27] Remove useless logs and a useless var"
This reverts commit dbb4dff52e.

Reason for revert: Toggling wifi on/off causes networking to
 stop working with these four patches applied.
Bug: 146230156

Change-Id: I6c75ac179bcc08cc5979194eea69525b333e2ba7
2019-12-14 03:31:20 +00:00
Automerger Merge Worker
e4b05fdcb6 Merge changes I4b793e86,I6f86add0,I2db9535b,I703db6d3 am: ff54f522a6 am: 149ad76a9a
Change-Id: Ib7b7179a2cff581f7187293880edc1163756cf06
2019-12-13 08:18:12 +00:00
Chalard Jean
149ad76a9a Merge changes I4b793e86,I6f86add0,I2db9535b,I703db6d3
am: ff54f522a6

Change-Id: Ic4317f9edf1ca8a1d9d47f53805c57a6ed63ba65
2019-12-13 00:09:32 -08:00
Chalard Jean
ff54f522a6 Merge changes I4b793e86,I6f86add0,I2db9535b,I703db6d3
* changes:
  [NS A27] Remove useless logs and a useless var
  [NS A26] Move available callbacks out of the rematch computation
  [NS A25] Send all listen callbacks after all rematches
  [NS A24] Add an object to represent changes in assignment
2019-12-13 06:50:36 +00:00
Automerger Merge Worker
70c582b46d Merge "Fix a doc" am: dc98e9be4c am: 082a268952
Change-Id: I774c526b9fd7ae58ec690438e7de7fb532cd555f
2019-12-12 14:27:33 +00:00
Chalard Jean
082a268952 Merge "Fix a doc"
am: dc98e9be4c

Change-Id: Ic8624437203122ffb9fd6a3d07b8abe335cb68e9
2019-12-12 06:23:11 -08:00
Chalard Jean
dc98e9be4c Merge "Fix a doc" 2019-12-12 14:15:28 +00:00
Automerger Merge Worker
f5d13c5ac5 Merge "Make getNetworkSpecifier() public API." am: ad60ef88e0 am: c0f993bb04
Change-Id: I884c4e4c9ed891594845d599358f19f4a8e2ad60
2019-12-12 12:26:06 +00:00
Chalard Jean
c0f993bb04 Merge "Make getNetworkSpecifier() public API."
am: ad60ef88e0

Change-Id: I92d0b7cb179e1c0f5cb789c2c668254732fbf30a
2019-12-12 04:04:32 -08:00
Chalard Jean
2e3154435f Fix a doc
Test: FrameworksNetTests
Change-Id: I5c9aeb627d9f22aa84bc134b6c7d3c15f237a775
2019-12-12 13:56:13 +09:00
Chalard Jean
dbb4dff52e [NS A27] Remove useless logs and a useless var
These logs haven't found a bug in a long time and we now have
some structural guarantees that the conditions they check for
can't happen (like the checks that everything is happening on
the same thread).
Maybe we'll reinstate similar checks later, but for now they
are in the way and removing them is a small sacrifice for the
intended benefit.

The local was simply not used any more.

Test: FrameworksNetTests
Change-Id: I4b793e86039c204a038c1b0fecbf8a4927eef48d
2019-12-12 13:55:32 +09:00
Chalard Jean
be083a195f [NS A26] Move available callbacks out of the rematch computation
Bug: 113554781
Test: ConnectivityServiceTest
Change-Id: I6f86add0ccde221c22436ac1995ef6064b3ca69e
2019-12-12 13:55:32 +09:00
Chalard Jean
b56e56916f [NS A25] Send all listen callbacks after all rematches
Bug: 113554781
Test: ConnectivityServiceTests NetworkStackTests
Change-Id: I2db9535b1d72edd46b968b1bae66b148aa815235
2019-12-12 13:55:31 +09:00
Chalard Jean
c375dccad3 [NS A24] Add an object to represent changes in assignment
Test: ConnectivityServiceTest
Change-Id: I703db6d3f039bd67a90fad0eadffc6cfed9a50ee
2019-12-12 13:21:43 +09:00
Chalard Jean
294ebbbad8 Make getNetworkSpecifier() public API.
The builder lets clients set it, and this may be useful for
unit tests of apps. It should be public.
The need arises from uses of this in WiFi and Telephony
network factories.

Test: build
Bug: 135998869
Change-Id: I57279cac139c28e8654d2066ba0c60edd1e6cd98
2019-12-12 13:10:55 +09:00
Automerger Merge Worker
2ef66a8e66 [automerger skipped] Merge changes Iaa78a7ed,I6497b7ef into pi-dev am: 6e79d000ab -s ours am skip reason: Change-Id Iaa78a7edcf23755c89d7b354edbc28d37d74d891 with SHA-1 9ff61e4948 is in history am: f729c28373 -s ours am skip reason: Change-Id Iaa78a7edcf23755c89d7b354edbc28d37d74d891 with SHA-1 9ff61e4948 is in history am: 2e194c28b0 -s ours am skip reason: Change-Id Iaa78a7edcf23755c89d7b354edbc28d37d74d891 with SHA-1 9ff61e4948 is in history am: 422245cbac -s ours
am skip reason: Change-Id Iaa78a7edcf23755c89d7b354edbc28d37d74d891 with SHA-1 9ff61e4948 is in history

Change-Id: I761abdcdb86884e89f40ce6e616d77235a76cc7a
2019-12-12 01:19:50 +00:00
Automerger Merge Worker
422245cbac [automerger skipped] Merge changes Iaa78a7ed,I6497b7ef into pi-dev am: 6e79d000ab -s ours am skip reason: Change-Id Iaa78a7edcf23755c89d7b354edbc28d37d74d891 with SHA-1 9ff61e4948 is in history am: f729c28373 -s ours am skip reason: Change-Id Iaa78a7edcf23755c89d7b354edbc28d37d74d891 with SHA-1 9ff61e4948 is in history am: 2e194c28b0 -s ours
am skip reason: Change-Id Iaa78a7edcf23755c89d7b354edbc28d37d74d891 with SHA-1 9ff61e4948 is in history

Change-Id: I72c045aeeb3c516a286ad5ef6413fb227019a299
2019-12-12 01:00:30 +00:00
Automerger Merge Worker
2e194c28b0 [automerger skipped] Merge changes Iaa78a7ed,I6497b7ef into pi-dev am: 6e79d000ab -s ours am skip reason: Change-Id Iaa78a7edcf23755c89d7b354edbc28d37d74d891 with SHA-1 9ff61e4948 is in history am: f729c28373 -s ours
am skip reason: Change-Id Iaa78a7edcf23755c89d7b354edbc28d37d74d891 with SHA-1 9ff61e4948 is in history

Change-Id: I33d00fde7d89d4cd84876bc982c6b28fa95287f5
2019-12-12 00:38:49 +00:00
Automerger Merge Worker
f729c28373 [automerger skipped] Merge changes Iaa78a7ed,I6497b7ef into pi-dev am: 6e79d000ab -s ours
am skip reason: Change-Id Iaa78a7edcf23755c89d7b354edbc28d37d74d891 with SHA-1 9ff61e4948 is in history

Change-Id: I92c1131ef02f7ca5e399b47c62993cf28719b66a
2019-12-12 00:17:28 +00:00
Lorenzo Colitti
b316f633e5 Support strict mode private DNS on VPNs that provide Internet.
Currently, strict mode private DNS does not work on VPNs because
NetworkMonitor does not validate VPNs. When a VPN connects, it
immediately transitions to ValidatedState, skipping private DNS
hostname resolution.

This change makes NetworkMonitor perform private DNS hostname
resolution and evaluation even on VPNs.

In order to ensure that the system always immediately switches to
the VPN as soon as it connects, remove the unvalidated penalty
for VPN networks. This ensures that the VPN score is always 101
and the VPN always outscores other networks as soon as it
connects. Previously, it would only outscore other networks
when no-op validation completed.

Backport of c455822846.

Bug: 122652057
Test: atest FrameworksNetTests
Test: manually ran a VPN with private DNS in strict mode
Test: atest android.net.cts.ConnectivityManagerTest com.android.cts.net.HostsideVpnTests
Change-Id: Iaa78a7edcf23755c89d7b354edbc28d37d74d891
Merged-In: Iaa78a7edcf23755c89d7b354edbc28d37d74d891
2019-12-11 20:19:40 +09:00
Lorenzo Colitti
7c9b1c757a Add test coverage for strict mode private DNS.
Support faking out the DNS lookups used by NetworkMonitor to
resolve strict mode DNS, and add more test coverage.

These tests were partly adapted from tests we have in Q but
also contain new coverage. This is because in Q the interface
between ConnectivityService and NetworkMonitor changed
substantially, and it is impractical to backport
NetworkMonitorTest.

Bug: 122652057
Test: atest FrameworksNetTests
Change-Id: I6497b7efa539267576d38d3036eef0af0df4e9cb
Merged-In: Iaa78a7edcf23755c89d7b354edbc28d37d74d891
2019-12-11 20:19:29 +09:00
Automerger Merge Worker
edf230a28c Merge changes Ibebdae14,I0c097e77,I6c889b15,I4771f2e9,I2a52f7f4 am: b24e34c19b am: 8d934b3aac
Change-Id: Ie95647b87b89337a7556f46ebf1fb577677959bf
2019-12-11 04:38:04 +00:00
Chalard Jean
8d934b3aac Merge changes Ibebdae14,I0c097e77,I6c889b15,I4771f2e9,I2a52f7f4
am: b24e34c19b

Change-Id: I8162ce9e5b1cb813d2b50325cc3a986d6a846a65
2019-12-10 20:13:20 -08:00
Chalard Jean
05cbe97f28 [NS A23.1] Minor cleanup
The argument is always true.

Test: ConnectivityServiceTest
Change-Id: Ibebdae14e63e6baf74db054038ee575ec462f6d5
2019-12-10 14:15:15 +09:00
Chalard Jean
05edd05f53 [NS A23] Move a synchronized block in a central place
As the calls to this apparently need to be synchronized, let's
do it all in the same place instead of in all callers

Test: FrameworksNetTests
Change-Id: I0c097e7756fc155ba0243834b84626e86c68340e
2019-12-10 14:15:14 +09:00
Chalard Jean
cd397a2042 [NS A22] Small refactoring
The point of this is to be able to move parts of processListenRequests
independently.

Test: FrameworksNetTests
Change-Id: I6c889b15696123c1120221977b0f36fa3d91de56
2019-12-10 14:15:14 +09:00
Chalard Jean
1123f5d067 [NS A21] More cleanup
Test: FrameworksNetTests NetworkStackTests
Change-Id: I4771f2e9151ff16a7045d9c3025ac686f244b22d
2019-12-10 14:15:14 +09:00
Chalard Jean
5c4bddb8cd [NS A20] Cleanup
A lot of this code can't be triggered at all.
• newNetwork.created in l.6488 is implied by newNetwork.everConnected
  in l.6357
• !newNetwork.isVPN() in l.6488 is implied by the fact that VPNs are
  always foreground, so oldPermission can't != newPermission in l.6488
• updateUids in l.6502 is useless because uids can't change during a
  rematch (because there is no code doing that). Metered state and
  roaming state similarly can't change during a rematch, so
  meteredChanged and roamingChanged are always false
• updateAllVpnCapabilities in l.6537 is useless because VPN do not
  inherit the foreground state of their underlying networks, which
  would be the only reason to call that in l.6537
• Object.equals() in l.6480 is necessary false because at this line
  it is known that the foreground state has changed, which must have
  caused the NET_CAPABILITY_FOREGROUND to be different, so the objects
  can't be equal

Test: FrameworksNetTests NetworkStackTest
Change-Id: I2a52f7f4a085f3eea22a1dd170af8f04671250ff
2019-12-10 14:14:57 +09:00
lucaslin
70c11a69ac Merge "Remove incorrect annotation - @TransportType" am: ac81b72e22
am: 26468789ea

Change-Id: Ia82a146de1afadcc415ba69fd5cf01480332b37f
2019-12-05 21:01:12 -08:00
lucaslin
26468789ea Merge "Remove incorrect annotation - @TransportType"
am: ac81b72e22

Change-Id: I99b74e5e67f5ff6f8d35f627e2c40ef4ca001c0c
2019-12-05 20:57:08 -08:00
Treehugger Robot
ac81b72e22 Merge "Remove incorrect annotation - @TransportType" 2019-12-06 04:50:27 +00:00
lucaslin
387ce1a837 Remove incorrect annotation - @TransportType
This annotation is mis-adding by aosp/929879, and now it also
makes compilation failure for Telephony Mainline.

Bug: 145755373
Test: atest FrameworksNetTests
Change-Id: Ic22ce6bf17c4300b8cd52217976bfb215a123f68
2019-12-06 11:17:25 +08:00
markchien
25797f3843 Merge "Expose netId to SystemApi" am: ed2644bf65
am: 4127bbc6bf

Change-Id: I23f6428954d08761d9671b419887d58dd29171fd
2019-12-04 18:39:46 -08:00