Commit Graph

452 Commits

Author SHA1 Message Date
Robert Greenwalt
ad35b13305 Fix networking API per scripting checks.
bug:17389242
Change-Id: I6017f559788ee16a1721b387796e5bda5e07280d
2014-09-04 16:50:29 -07:00
Robert Greenwalt
949b25423e Merge "Catch creation of NetworkRequest without NetCap" into lmp-dev 2014-09-04 21:08:11 +00:00
Jason Monk
f098cfcbbe Proxy fixes from API review feedback
Bug: 17389383
Change-Id: Ib5e40f55d02687ee917ba30773123cf3e4c2a97d
2014-09-04 15:39:56 -04:00
Robert Greenwalt
ea266c65ee Catch creation of NetworkRequest without NetCap
Using reflection you could do this and it would crash the system.
Thanks, ServiceFuzzer!

bug:17379629
Change-Id: I8b470bda78a69761ccd92496746f5d295b5d07f2
2014-09-03 20:57:41 -07:00
Lorenzo Colitti
939112e006 Kill the NetworkInfo(int type) constructor. IT'S A TRAP!
This constructor does nothing, including doing nothing with its
only argument. This causes it to return a NetworkInfo for
TYPE_MOBILE no matter what was passed in.

Bug: 16610051
Change-Id: I4ccd5ec050f7824fb06496c00fcd7901defeb7bd
2014-08-29 18:34:49 -07:00
Lorenzo Colitti
d092cb50d3 Use per-Network connection pools for openConnection.
If we don't do this, per-network HTTP requests will go over the
wrong network if any previous HTTP request was made by the same
app on another network.

Bug: 17300006
Change-Id: I1854c16dee6adb9e81fb12b097577439d69a644e
2014-08-29 18:13:19 -07:00
Lorenzo Colitti
860a7aa21a Pass the socket mark for DNS queries to dnsmasq.
This makes tethered clients use the correct DNS servers when
tethering to non-default networks like the DUN APN.

Bug: 16357676
Change-Id: I8933b6de198a92c2aaf0291931ace8966ddba275
2014-08-29 10:21:58 -07:00
Robert Greenwalt
419e1b4362 Clean up Connectivity Logging.
bug:17285109
Change-Id: I61b98aa636996f8d4915fd954d49a22c20cfe9ab
2014-08-27 14:49:14 -07:00
Paul Jensen
becb073b12 Merge "Remove captive portal sign-in actions." into lmp-dev 2014-08-25 18:52:32 +00:00
Paul Jensen
af9351f884 Remove captive portal sign-in actions.
This reverts commit e0101cd and removes the related NetworkMonitor code.
The thinking is the broadcasts are not robust enough as they rely on apps
working together and are not sufficiently tested.

bug:17115050
Change-Id: I433032867cc4fea7191a1b13842b16825dc74df4
2014-08-22 09:42:56 -04:00
Lorenzo Colitti
45aca20cd7 Rework the per-network URL API.
This addresses API council comments.

Bug: 17112978
Change-Id: I698b243b2b685d1f25414cee72450be3ae0c2bf0
2014-08-21 19:09:27 -07:00
Jeff Davidson
6047c1dc68 Less intrusive VPN dialog and other UX tweaks.
-The ability to launch VPNs is now sticky; once approved by the user,
further approvals are not needed UNLESS the connection is revoked in
Quick Settings.

-The old persistent notification has been removed in favor of the new
Quick Settings UI.

-The name of the VPN app is now pulled from the label of the VPN
service rather than the app itself, if one is set.

Bug: 12878887
Bug: 16578022
Change-Id: I102a14c05db26ee3aef030cda971e5165f078a91
2014-08-20 16:55:28 -07:00
Lorenzo Colitti
ef734f8a3b Stop using LinkProperties for static configuration.
LinkProperties can represent way more complicated configurations
than what we can actually apply to interfaces. This makes it
error-prone to use it to represent static configuration, both
when trying to apply configuration coming from LinkProperties
and when trying to save configuration from current
LinkProperties.

Instead, move static configuration (IPv4 only, since we don't
support static IPv6 configuration) into a separate
StaticIpConfiguration class.

Bug: 16114392
Bug: 16893413
Change-Id: Ib33f35c004e30b6067bb20235ffa43c247d174df
2014-08-19 11:59:43 -07:00
Robert Greenwalt
debf0e0075 Add tcp buffer size conduit to NetworkAgent.
bug: 16549611
Change-Id: I7d97dedea2c7c1aed2eccb185645889424508591
2014-08-17 15:14:29 -07:00
Robert Greenwalt
36a05df3f3 Merge "Configure MTU based on network MTU parameter" into lmp-dev 2014-08-15 19:10:34 +00:00
w19976
e714f1daa6 Configure MTU based on network MTU parameter
Add logic to obtain the mtu from the network PCO parameter and set it to kernel
when the mobile data connection is established. When there is no PCO mtu configured
from the network, the mtu size defined in the corresponding APN will be used. In case
no mtu size is defined for an APN used for data connection, the MCC/MNC based MTU
defined  in the framework overaly will be applied.

bug:17046179
Change-Id: I6465d4b8f2076aaa380ae3617fb3f24adbe136d4
2014-08-14 20:34:13 -07:00
Jeff Sharkey
f2ceed8a54 Some networks may have null ifaces, I guess?
Seems like a bug further upstream, but guard ourselves against it
for now.

Bug: 17033841
Change-Id: Id0e5895c3389b63d4e34b1fb064efef8b72cd609
2014-08-14 22:42:27 +00:00
Lorenzo Colitti
435565dd96 Switch RouteInfo to use IpPrefix instead of LinkAddress.
This addresses a TODO and also makes it possible to create
routes to destinations that are not valid LinkAddresses, such as
multicast addresses.

Bug: 16875580
Change-Id: Id4c77b00dc3064bf27d78cdcbbe035e645748cfe
2014-08-13 21:17:20 +09:00
Jeff Sharkey
0aef9341d3 Hack and ship: NetworkStats edition.
Some devices use clatd for catching raw IPv4 traffic when running on
a pure-IPv6 carrier network.  In those situations, the per-UID
stats are accounted against the clat iface, so framework users need
to combine both the "base" and "stacked" iface usage together.

This also means that policy rules (like restricting background data
or battery saver) need to apply to the stacked ifaces.

Finally, we need to massage stats data slightly:

-- Currently xt_qtaguid double-counts the clatd traffic *leaving*
the device; both against the original UID on the clat iface, and
against UID 0 on the final egress interface.

-- All clatd traffic *arriving* at the device is missing the extra
IPv6 packet header overhead when accounted against the final UID.

Bug: 12249687, 15459248, 16296564
Change-Id: I0ee59d96831f52782de7a980e4cce9b061902fff
2014-08-11 18:40:23 -07:00
Dan Sandler
3d2c4da534 Fix docs build.
Change-Id: I3be4c5b74e85d2491316986d8c3c0575cd01a8fc
2014-07-31 02:27:52 -04:00
Lorenzo Colitti
8d20c50093 Allow using third-party HTTP/... stacks for per-network URLs.
Also switch to double-checked locking for
mNetworkBoundSocketFactory and OkHttpClient.

Change-Id: Ic52776ee760036ad5623b7496156b8909dc282fa
2014-07-31 02:17:28 +00:00
Lorenzo Colitti
54a8d4c170 Use a new socket for each of the host's IP addresses.
If Socket.connect() times out, the socket cannot be used any
more - any attempt to do so fails with EBADF. Use a new
socket for each IP address.

Bug: 16664129
Change-Id: If3616df86f7c2da0eabd30dca5db65d0da85cb17
2014-07-30 17:31:04 +00:00
Sreeram Ramachandran
e458632059 Allow VPNs to add/remove link addresses dynamically.
Bug: 15409819
Change-Id: If91fc6891d7ce04060362c6cde8c57462394c4e8
2014-07-29 00:32:59 +00:00
Robert Greenwalt
73b0009b50 Merge "Remove dead code 1." into lmp-dev 2014-07-24 20:48:02 +00:00
Sreeram Ramachandran
6ba91ae8a0 Prohibit address families by default unless a VPN explicitly allows them.
Bug: 15972465
Change-Id: I3278d94536fefacc86390c1ba4231680f7be8589
2014-07-28 18:52:41 +00:00
Robert Greenwalt
c36a74f2a6 Remove dead code 1.
Starting with startUsingNetworkFeature and stop.
Figure it's easier to code review incremental changes.

Change-Id: I19aee65e740858c3a9a2a1a785663f6fee094334
2014-07-28 11:34:36 -07:00
Lorenzo Colitti
b9ab4282cf Add a getBoundURL method that returns a network-specific URL.
Change-Id: I4b57e675bb87064ab75dcc36b00fdc7a2987b86e
2014-07-28 16:16:58 +00:00
Sreeram Ramachandran
3518e37286 Implement support for bypassable VPNs.
Bypassable VPNs grab all traffic by default (just like secure VPNs), but:
+ They allow all apps to choose other networks using the multinetwork APIs.
  If these other networks are insecure ("untrusted"), they will enforce that the
  app holds the necessary permissions, such as CHANGE_NETWORK_STATE.
+ They support consistent routing. If an app has an existing connection over
  some other network when the bypassable VPN comes up, it's not interrupted.

Bug: 15347374
Change-Id: Iaee9c6f6fa8103215738570d2b65d3fcf10343f3
2014-07-25 15:17:23 -07:00
Robert Greenwalt
abbc41e859 Fix DUN-based tethering.
It was calling into dead ConnectivityService code rather than using
the new ConnectivityManager shim code.

bug:15221541
Change-Id: I1e3eea8a658a162ce36673ed1cf7b1e7e4372c42
2014-07-24 14:39:51 -07:00
Ye Wen
ca7ababe8b Infer legacy network type for ConnectivityManager.requestNetwork
ConnectivityManager.requestNetwork pass TYPE_NONE to
sendRequestForNetwork which prevents it from being used with legacy API
requestRouteToHostAddress. This CL infers the legacy network type
automatically from the network capabilities.

b/16324360

Change-Id: I591d38f875f42f56e8cfc157db2069c9eee0ee26
2014-07-23 11:41:17 -07:00
Sreeram Ramachandran
c06ec73149 Cleanup: Delete dead code.
Bug: 15413389
Change-Id: I315468832ef18ffc84174e54774ab63b86d284dc
2014-07-22 15:46:34 -07:00
Sreeram Ramachandran
b5ae69d410 Remove unnecessary code and APIs.
This stuff has been replaced by setNetworkForUser() in NetdClient.

Change-Id: If525ee259b74314191d1913f7c2a3e828e05c38f
2014-07-11 18:16:04 -07:00
Paul Jensen
5dea435dd4 Readjust location of NETID_UNSET definition.
This is a tweak to my 8ec11bb change I a-little-too-hastily committed.

Change-Id: Ibeee9382109994c66227d1c42aac749e2a274ed7
2014-07-11 16:53:39 +00:00
Paul Jensen
65743a26ad Define NETID_UNSET in ConnectivityManager.
This allows some cleanup and removal of dead code.

bug:15489928
Change-Id: Iaf0507bc2e8ec6dcc253f01f61c5b221d46581f9
2014-07-11 12:00:10 -04:00
Robert Greenwalt
bd7397eb5b Missed an entry in the copy constructor.
bug:15755597
Change-Id: Iee17ca88404a6a50258d204a12cd0c04cd15e34e
2014-07-10 14:55:14 -07:00
Robert Greenwalt
a6bc0916e7 Add networkSpecifier string to NetworkCapabilties.
Allows transport specific network selectivity where multi-sim or sta+sta
is supported.

bug:1575597
Change-Id: I9c60fe7710e988c17d63236788b492a3ddd264a1
2014-07-10 20:58:20 +00:00
Paul Jensen
8b5fc62d12 Convert Vpn from NetworkStateTracker to NetworkAgent.
This eliminates the need for the ConnectivityService.VpnCallback class.
This requires shifting VPNs to the new "network" netd API.
VpnService.protect() is modified to no longer go through ConnectivityService.
NetworkCapabilities is extended to add a transport type for VPNs and a
capability requiring a non-VPN (so the default NetworkRequest isn't satisfied
by a VPN).

bug:15409918
Change-Id: Ic4498f1961582208add6f375ad16ce376ee9eb95
2014-07-10 20:39:33 +00:00
Robert Greenwalt
1166831856 Merge "Refactor wifi p2p's startDhcpServer function" 2014-07-10 18:27:37 +00:00
Robert Greenwalt
e594a76c9f Refactor wifi p2p's startDhcpServer function
Add getTetheredDhcpRanges() interface and call it before calling
mNwService.startTethering to update dhcp ranges.  This will allow
p2p apps to run well concurently with other tethering apps.

Manual import of AOSP change 81546 by jianzheng.zhou@freescale.com

Change-Id: Iebc62f95bdcedde80e2c1d3e9580d3f625c3b50b
2014-07-10 18:56:12 +00:00
Robert Greenwalt
02fe11eba3 Add Network inspection API.
Adds getNetworksNetworkInfo.
Adds getAllNetworks.

Cleans up some synchronization issues.

Change-Id: I82c7a4b554e3c6c1adfe6027cc54b028ed6dbac9
2014-07-10 10:48:23 -07:00
Robert Greenwalt
a134636a4b Add Trust to NetworkCapabilities.
Indicates the user has indicated implicit trust of a network.  This
generally means it's a sim-selected carrier, a plugged in ethernet,
a paired BT device or a wifi they've asked to connect to.  Untrusted
networks are probably limited to unknown wifi AP.

Change-Id: I89490bdaa3c2d63d33f876c72d8b088dc155fa3d
2014-07-08 23:55:18 +00:00
Robert Greenwalt
ce7a144472 Remove dead code.
Also adds a TYPE_VPN so the VPN can be strongly typed.

Change-Id: Ibf39450c480f16ce5ab4c25b47965691b844fb92
2014-07-07 17:09:01 -07:00
Robert Greenwalt
f7c7336625 Merge "Remove unused api." 2014-07-02 18:55:10 +00:00
Glenn Kasten
b20d886bce Fix build
Change-Id: I7d0787e4a1f778008c979c4174ef445a950c4250
2014-07-07 07:12:29 -07:00
Robert Greenwalt
e0b0051472 Remove unused api.
bug:15595155
Change-Id: Ifd79365bd45f20f531782244f471a4cfc32a4135
2014-07-02 13:50:33 -07:00
Paul Jensen
e378679df9 Add captive portal sign-in actions.
Change-Id: I70a6c2efc4f3fa48d5b65e8d630682fe74abfe2c
2014-07-02 16:47:48 +00:00
Paul Jensen
bb427685db Make sure callback handler is in place before callbacks handled.
When making Network requests in ConnectivityManager, make sure we install the
callback prior to a response from ConnectivityService arriving causing us to
search for the callback and inadvertently not find it.

bug:15928097
Change-Id: Ie5feb9cc8f5effc19870f54dba07218b2e11d82a
2014-07-02 13:50:53 +00:00
Ram
693d07a0b4 MS: Adding Support for Emergency APN in Telephony Framework
(base/telephony)

Replacement for https://partner-android-review.googlesource.com/#/c/171175/

Change-Id: I16fc37f5c00ed79f2370bc46554fc7a24c52c4cb
Conflicts:
	core/java/android/net/ConnectivityManager.java
2014-07-01 02:00:51 +00:00
Paul Jensen
10ba60a4a1 Use return values from JNI functions binding sockets and processes to networks.
bug:15757549
Change-Id: If23b14febc923b9a0348f0cf9029fd4bf6e8d725
2014-06-26 16:33:58 +00:00
Lorenzo Colitti
131eb31373 Modify DNS server update methods.
1. Make addDnsServer not add duplicate servers and return a
   boolean value incating whether it changed anything. This is
   consistent with what we do for LinkAddresses and routes.
2. Add a setDnsServers method that sets all the DNS servers to
   the specified collection. This is consistent with what we do
   for LinkAddress.

Bug: 9180552
Change-Id: I5baed09253261b66ea42ae2ea82398118e3ab0ac
2014-06-26 17:04:38 +09:00