Commit Graph

2012 Commits

Author SHA1 Message Date
junyulai
88da121dfe Fix cannot create Nat-T keepalive on mobile data
Currently phone process fail to unparcel NattKeepalivePacketData
since it is not in framework. Moves NattKeepalivePacketData to
framework to make it can be utilized by telephony.

This change also removes the error feedback triggered by calling
add keepalive packet filter to an unsupported network agent. This
is misinterpreted by KeepaliveTracker that start keepalive is
failing.

Bug: 134048171
Test: 1. atest android.net.cts.ConnectivityManagerTest#testSocketKeepaliveLimitTelephony
      2. atest android.net.cts.ConnectivityManagerTest
      3. atest FrameworksNetTests
      4. atest FrameworksTelephonyTests
Change-Id: If630d5b339aa722717258c721daa8ead8c431e2d
2019-06-04 18:22:15 +08:00
Luke Huang
976e09ab5c Fix issue for DnsResolver#query
1. Previously, getDnsNetId doesn't handle all the cases.
Fix it with cosidering bypass private DNS flag.
2. Make getDnsNetId return Network instead of netId,
and change name from getDnsNetId to getDnsNetwork

Bug: 129530368
Test: atest DnsResolverTest DnsUtilsTest

Merged-In: Ibb5080acd3c296650d56532fc7da525e9fa95e8f
(cherry picked from commit 3854966dc9499e39187835606397b16367e5e27b)

Change-Id: I37353642088bcc17da0cf17f78a5ed9efc9aefc3
2019-05-30 11:58:25 +00:00
Luke Huang
36fecce5a1 Merge "Fix issue for DnsResolver#query" am: 7edc776afc
am: da47327520

Change-Id: I819fa9eb0abab64951fdb8adb7b1fc660544a1ad
2019-05-30 04:36:42 -07:00
Luke Huang
be164b2db8 Fix issue for DnsResolver#query
1. Previously, getDnsNetId doesn't handle all the cases.
Fix it with cosidering bypass private DNS flag.
2. Make getDnsNetId return Network instead of netId,
and change name from getDnsNetId to getDnsNetwork

Bug: 129530368
Test: atest DnsResolverTest DnsUtilsTest
Change-Id: Ic8d45b802d72a266f9ec97bfea620c1ede6967e5
2019-05-30 06:34:03 +00:00
Luke Huang
a771bede7c Merge "Minor changes for DnsUtils and its test" am: 8c4ef95cbb
am: dfda15715d

Change-Id: Ic1990922e599884582606d1a4d7da3950200d25c
2019-05-29 03:33:34 -07:00
Luke Huang
3b14d4641a Minor changes for DnsUtils and its test
fix nits for ag/7671031

Bug: 129530368
Test: atest DnsUtilsTest
Change-Id: I562d33870a933a5fe55c89137a2d9574e3c59b90
2019-05-29 13:56:27 +08:00
Chalard Jean
e97ef6d1d9 Merge "Reinstate access to a forgotten member" into qt-dev 2019-05-28 09:38:51 +00:00
Luke Huang
d8bc2b5a15 Merge changes from topic "am-851f19c8d7d34bb48accd48868aae501-qt-dev" into qt-dev
* changes:
  Remove broken test testRfc6724Sort
  Add Rfc6724 style sort for DnsResolver and fix potential bug
2019-05-28 05:38:49 +00:00
Chalard Jean
ddfa1f5f4d Reinstate access to a forgotten member
Followup to aosp/964440

Bug: 131764329
Test: none
Merged-In: I6f6b2cf75793532d3d537a223b8e15d7304a1e3f
Change-Id: Ib279c0076016c53e0491fc0df8cefff8ae280d66
(cherry picked from commit 41bd3c57b4ba347ac6eb4546855daf5473264a29)
2019-05-27 12:21:15 +00:00
Chalard Jean
bdee05bfd1 Merge "Reinstate access to a forgotten member" am: c73af87b45
am: 2f4bd91b99

Change-Id: Ib279c0076016c53e0491fc0df8cefff8ae280d66
2019-05-27 04:33:13 -07:00
Treehugger Robot
c73af87b45 Merge "Reinstate access to a forgotten member" 2019-05-27 11:14:37 +00:00
Etan Cohen
0da57a8b67 [CM] Fix NPE due to unvalidated callback value
When unregistering callback due to ON_UNAVAILABLE did not check for
a non-null callback.

Bug: 132950880
Test: atest ConnectivityServiceTest
Merged-In: Ib3fde31d88c36469cdee1e3578606d130a9817cb
Change-Id: Ib3fde31d88c36469cdee1e3578606d130a9817cb
(cherry picked from commit 51ddc176abd23bd3ddbc26124e5541a983a1db07)
2019-05-23 16:20:15 +00:00
Luke Huang
51b9f6c069 Add Rfc6724 style sort for DnsResolver and fix potential bug
1. pass default network explicitly to fix potential
   mis-sync network problem in DnsResolver#query
2. Add rfc6724 sort and related test
3. DnsResolver do rfc6724 sort before response InetAddress answers
4. move haveIpv* function from DnsResolver to DnsUtils

Bug: 129530368
Test: atest DnsResolverTest DnsUtilsTest

Merged-In: I0323f5c7f32fc3fa589b9e87f8e7c9caf744dbd4
(cherry picked from commit d352f4ca85ff8418a5a58d32fb03b85d7e0b843b)

Change-Id: I98455045fa43cc5a5902a08232251c1734feaac3
2019-05-23 14:36:21 +00:00
Luke Huang
387e63d68b Merge "Add Rfc6724 style sort for DnsResolver and fix potential bug" am: 7a1133eb44
am: d352f4ca85

Change-Id: Ic356f42b46a3ad170fb01f22d9b3e0b7bf1585d4
2019-05-23 07:23:31 -07:00
Chalard Jean
8759c1ec9e Reinstate access to a forgotten member
Followup to aosp/964440

Bug: 131764329
Test: none
Change-Id: I6f6b2cf75793532d3d537a223b8e15d7304a1e3f
2019-05-23 03:32:30 +00:00
Luke Huang
26c1cdb19d Add Rfc6724 style sort for DnsResolver and fix potential bug
1. pass default network explicitly to fix potential
   mis-sync network problem in DnsResolver#query
2. Add rfc6724 sort and related test
3. DnsResolver do rfc6724 sort before response InetAddress answers
4. move haveIpv* function from DnsResolver to DnsUtils

Bug: 129530368
Test: atest DnsResolverTest DnsUtilsTest
Change-Id: I4efa599c0605f6a9e4ef2dd1a36572c69b3c433f
2019-05-23 11:23:41 +08:00
Etan Cohen
2ab18250bb Merge "[CM] Fix NPE due to unvalidated callback value" am: 43c1536c6b
am: 51ddc176ab

Change-Id: Idf439c1f6badd715776eaaced1a781b066ba6d37
2019-05-22 10:44:37 -07:00
Etan Cohen
43c1536c6b Merge "[CM] Fix NPE due to unvalidated callback value" 2019-05-22 13:53:31 +00:00
Chalard Jean
b95ade4679 Merge "Update throws documentation for requestNetwork*" into qt-dev 2019-05-22 13:42:29 +00:00
Chalard Jean
8ad1afb8f8 Update throws documentation for requestNetwork*
Bug: 78126688
Test: builds
Change-Id: Iaabcc52b3e6537752990b88a24e11217f73ce8e7
(cherry picked from commit 75f1329f927202f39ae29d2acaad97d01f5c8cb8)
Merged-In: I8b5bb052bf73feed0dfafafaf44fcd07f58186ce
2019-05-22 12:02:51 +00:00
Chalard Jean
6f1f2df72b Let clients access StaticIpConfiguration members through reflection.
Bug: 131764329
Test: none
Change-Id: Ice5c4fd4d469a55410129310c5a25874b94e2219
(cherry picked from commit 6736fb0465e3cc9f38ee1340e6b831a6dcd195e8)
Merged-In: I0fa84390f6c289571afa9d86cb922835fe2b7e77
2019-05-22 12:01:31 +00:00
Chalard Jean
884b5f480e Merge "Update throws documentation for requestNetwork*" am: bfcbf4b450
am: 411f1efc02

Change-Id: Iaabcc52b3e6537752990b88a24e11217f73ce8e7
2019-05-22 02:55:10 -07:00
Chalard Jean
93f36d6d7e Merge "Let clients access StaticIpConfiguration members through reflection." am: 65663acf34
am: 892038673e

Change-Id: Ice5c4fd4d469a55410129310c5a25874b94e2219
2019-05-22 02:42:25 -07:00
Chalard Jean
bfcbf4b450 Merge "Update throws documentation for requestNetwork*" 2019-05-22 08:34:43 +00:00
Chalard Jean
65663acf34 Merge "Let clients access StaticIpConfiguration members through reflection." 2019-05-22 07:17:52 +00:00
Etan Cohen
b58e366f2d [CM] Fix NPE due to unvalidated callback value
When unregistering callback due to ON_UNAVAILABLE did not check for
a non-null callback.

Bug: 132950880
Test: atest ConnectivityServiceTest
Change-Id: I8f3322963f322e6690f1403681bf66e8b38b35f8
2019-05-22 04:56:09 +00:00
junyulai
0121a21ff7 Merge "Move keepalive constants to their right place" am: ac6f142334
am: 292f73b0dc

Change-Id: Id45981af5b42ec1423aff8b0ec1bc07d7c71c6b9
2019-05-20 22:09:19 -07:00
junyulai
654be392b6 Move keepalive constants to their right place
The constants CMD_{ADD,REMOVE}_KEEPALIVE_PACKET_FILTER are too
high in the file and not in order. These constants should be
moved back to their rightful place.

Bug: 123987395
Test: 1. m -j 2. m -j doc-comment-check-docs
Change-Id: I44c827d3a2011cf7c66c0444566e14192fec1b1b
2019-05-21 00:23:41 +00:00
Chalard Jean
b4368bed5a Let clients access StaticIpConfiguration members through reflection.
Bug: 131764329
Test: none
Change-Id: I0fa84390f6c289571afa9d86cb922835fe2b7e77
2019-05-20 16:58:08 +09:00
Chalard Jean
31740e4ed3 Update throws documentation for requestNetwork*
Bug: 78126688
Test: builds
Change-Id: I8b5bb052bf73feed0dfafafaf44fcd07f58186ce
2019-05-14 22:16:29 +09:00
junyulai
ec4eb8f448 Support customization of supported keepalive count per transport
This change specifies the required minimum supported keepalives
in SDK, and allows OEMs to customize supported keepalive count
per network through resource overlay.

Bug: 129371366
Test: 1. m -j doc-comment-check-docs
      2. atest FrameworksNetTests

Clean cherry-pick of aosp/946359

Change-Id: I06840834d0ee8121358bf4829fe47ecf9964d395
Merged-In: I0218f3674628c13ead63fc9a873895ba7f113033
Merged-In: Ia667386c1a8949839871a6949d79552d9c8b88f0
2019-05-13 15:52:07 +09:00
Junyu Lai
04a972ec05 Merge changes Ibcb91105,I0218f367 am: 6a5c545890
am: 278e66a401

Change-Id: Ia667386c1a8949839871a6949d79552d9c8b88f0
2019-05-10 02:13:34 -07:00
Junyu Lai
6a5c545890 Merge changes Ibcb91105,I0218f367
* changes:
  Limit unprivileged keepalives per uid
  Support customization of supported keepalive count per transport
2019-05-10 05:47:23 +00:00
junyulai
4dca18aa31 Support customization of supported keepalive count per transport
This change specifies the required minimum supported keepalives
in SDK, and allows OEMs to customize supported keepalive count
per network through resource overlay.

Bug: 129371366
Test: 1. m -j doc-comment-check-docs
      2. atest FrameworksNetTests

Change-Id: I0218f3674628c13ead63fc9a873895ba7f113033
2019-05-10 00:36:58 +08:00
Lorenzo Colitti
80045d35e7 Merge "[CS] Unregister callback as part of onUnavailable dispatch" into qt-dev 2019-05-09 09:42:38 +00:00
Etan Cohen
abc0036a8b Merge "[CS] Unregister callback as part of onUnavailable dispatch" am: e2ba92c411
am: 477211720f

Change-Id: Ida684c441e7aaedce9a29da071ef5a68403d08b3
2019-05-08 22:42:55 -07:00
Etan Cohen
2f9a465841 [CS] Unregister callback as part of onUnavailable dispatch
The onUnavailable semantics promise that it is equivalent to calling
the unregister callback method. But - it doesn't unregister the callback
allowing it to be reused. Fixed.

Additionally, modified the unregisterNetworkCallback method to not fail
on duplicate unregistration (since a callback could now self
unregister). Instead simply print a log.

Bug: 130651445
Test: atest ConnectivityServiceTest
Merged-In: I4c54b003a733eb0b1e4fd8674ed13081b1bef8e3
Change-Id: I4c54b003a733eb0b1e4fd8674ed13081b1bef8e3
2019-05-09 03:57:54 +00:00
Etan Cohen
6cb6599ddd [CS] Unregister callback as part of onUnavailable dispatch
The onUnavailable semantics promise that it is equivalent to calling
the unregister callback method. But - it doesn't unregister the callback
allowing it to be reused. Fixed.

Additionally, modified the unregisterNetworkCallback method to not fail
on duplicate unregistration (since a callback could now self
unregister). Instead simply print a log.

Bug: 130651445
Test: atest ConnectivityServiceTest
Change-Id: I4c54b003a733eb0b1e4fd8674ed13081b1bef8e3
2019-05-09 02:41:40 +00:00
Luke Huang
53578de5d1 Correct buffer size limitation for DnsResolver API
Bug: 131055651
Test: atest DnsResolverTest
(cherry picked from commit f6726c2c5456887aaebe3f821a86a83bbed92f3d)

Change-Id: I69ad9428ddfb70437e47ef4740930a97aece69d9
2019-05-02 09:37:13 +00:00
Luke Huang
26052432e3 Merge "Correct buffer size limitation for DnsResolver API" am: c586bdf976
am: 7077ae7361

Change-Id: If779ada4dbc1e67b28067235f5055d7f94692c69
2019-05-01 23:39:32 -07:00
Luke Huang
fbd8ecfe17 Correct buffer size limitation for DnsResolver API
Bug: 131055651
Test: atest DnsResolverTest
Change-Id: I29decd480172eacb452ccb0da524ef1bf2ffadcf
2019-05-02 11:48:54 +08:00
TreeHugger Robot
65caa406e7 Merge changes from topic "natt-aidl+aidl-freeze" into qt-dev
* changes:
  Add AIDL parcelable for NattKeepalivePacketData
  Move NattKeepalivePacketData out of the framework
2019-04-29 16:26:23 +00:00
Aaron Huang
8cf997d1c1 Move NattKeepalivePacketData out of the framework
For implementing parcelable interface for NattKeepalivePacketData.
Move this class out of framework.jar and move to services.jar

This class is used in telephony-common.jar and it also loads
service.jar.

Bug: 33530442
Test: - build pass
      - atest NetworkStackTests
      - atest ConnectivityServiceTest

Change-Id: Ie1d02bb7bccb76415cf71824147466cabf6b88b6
Merged-In: Ie1d02bb7bccb76415cf71824147466cabf6b88b6
Merged-In: Idf7c25b6b553d8c0cc4ef2ea8193438480420fb4
(cherry picked from commit 58a1f931eba8716c4a630863f658b070cda623de)
2019-04-29 20:24:24 +08:00
Rubin Xu
dc587d75e1 Block incoming non-VPN packets to apps under fully-routed VPN
When a fully-routed VPN is running, we want to prevent normal apps
under the VPN from receiving packets originating from any local non-VPN
interfaces. This is achieved by using eBPF to create a per-UID input
interface whitelist and populate the whitelist such that all
non-bypassable apps under a VPN can only receive packets from the VPN's
TUN interface (and loopback implicitly)

This is the framework part of the change that build the whitelist.
The whitelist needs to be updated in the following cases:
* When a VPN is connected and disconnected
    This will cover the change to allowBypass bit, since that can't be
    changed without reconnecting.
* When a VPN's NetworkCapabilites is changed (whitelist/blacklist app changes)
* When a new app is installed
* When an existing app is removed
* When a VPN becomes fully-routed or is no longer fully-routed

New user/profile creation will automatically result in a whitelist app change
transition so it doesn't need to be handled specially here.

Due to the limitation of the kernel IPSec interacting with eBPF (sk_buf->ifindex
does not point to the virtual tunnel interface for kernel IPSec), the whitelist
will only apply to app VPNs but not legacy VPN connections, to prevent breaking
connectivity with kernel IPSec entirely.

Test: atest PermissionMonitorTest
Test: atest android.net.RouteInfoTest
Test: atest com.android.server.ConnectivityServiceTest
Test: atest HostsideVpnTests
Bug: 114231106

Merged-In: I5af81bc80dadd086261ba4b1eb706cc873bb7cfa
Change-Id: I5af81bc80dadd086261ba4b1eb706cc873bb7cfa
(cherry picked from commit 65968ea16bf49f678d4a43c220e1d67393170459)
2019-04-24 11:56:46 +01:00
Aaron Huang
82184fd8ce Merge "Move NattKeepalivePacketData out of the framework" am: d3ee38785b
am: 382b3d2a63

Change-Id: Idf7c25b6b553d8c0cc4ef2ea8193438480420fb4
2019-04-23 21:26:03 -07:00
Aaron Huang
d3ee38785b Merge "Move NattKeepalivePacketData out of the framework" 2019-04-24 04:00:56 +00:00
Benedict Wong
8b2466b437 Merge "Add configurability of LinkProperties, meteredness for Test Networks" am: a57dada482
am: 248e00b41e

Change-Id: I9c8220efd56f72aabae028b48ac2f88ec7b8f659
2019-04-22 11:18:52 -07:00
TreeHugger Robot
3f6b2004ce Merge "Restrict access to dangerous methods to <= P" into qt-dev 2019-04-22 07:14:10 +00:00
Benedict Wong
6259ad2be9 Add configurability of LinkProperties, meteredness for Test Networks
This commit adds the ability to pass in LinkProperties and meteredness
for additional testing use cases.

Bug: ?
Test: Compiles. Test utility only.
Change-Id: Idf6c3bcae2dea5e61c0418b72b889496919be8ba
2019-04-19 10:46:56 -07:00
Aaron Huang
f7adc47367 Move NattKeepalivePacketData out of the framework
For implementing parcelable interface for NattKeepalivePacketData.
Move this class out of framework.jar and move to services.jar

This class is used in telephony-common.jar and it also loads
service.jar.

Bug: 33530442
Test: - build pass
      - atest NetworkStackTests
      - atest ConnectivityServiceTest

Change-Id: Id2fdec5c4015d2cefd8a93e0cfdcc3c304fc9b64
2019-04-20 00:37:19 +08:00