summaryrefslogtreecommitdiff
path: root/services/java/com/android/server/NetworkManagementService.java
Commit message (Collapse)AuthorAgeFilesLines
* Move some system services to separate directoriesAmith Yamasani2013-12-191-1810/+0
| | | | | | | | Refactored the directory structure so that services can be optionally excluded. This is step 1. Will be followed by another change that makes it possible to remove services from the build. Change-Id: Ideacedfd34b5e213217ad3ff4ebb21c4a8e73f85
* Add address flags and scope to LinkAddress.Lorenzo Colitti2013-12-061-12/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is necessary so that the framework can know whether an IPv6 address is likely to be usable (i.e., if it's global scope and preferred). Also, it will simplify the address notification methods in INetworkManagementEventObserver, which currently take the address, the flags, and the scope as separate arguments. 1. Add flags and scope to the class and update the unit test. Use the IFA_F_* and RT_SCOPE_* constants defined by libcore. Since most callers don't know about flags and scope, provide constructors that default the flags to zero and determine the scope from the address. Addresses notified by the kernel will have these properly set. Make multicast addresses invalid. Update the class documentation. 2. Provide an isSameAddressAs() method that compares only the address and prefix information between two LinkAddress objects. This is necessary because an interface can't have two addresses with the same address/prefix but different flags. 3. Update LinkProperties's addLinkAddress and removeLinkAddress to identify existing addresses to add/remove using isSameAddressAs instead of implicit equals(). Specifically: - If addLinkAddress is called with an address that is already present, the existing address's flags and scope are updated. This allows, for example, an address on an interface to go from preferred to deprecated when it expires, without it having to be removed and re-added. - If removeLinkAddress is called with an address that is present but with different flags, it deletes that address instead of failing to find a match. 4. Update the INetworkManagementEventObserver address notification methods to take just a LinkAddress instead of LinkAddress, flags, and scope. While I'm at it, change the order of the arguments for consistency with the other functions in the interface. Change-Id: Id8fe0f09a7e8f6bee1ea3b52102178b689a9336e
* Use LinkAddress in address notifications.Lorenzo Colitti2013-11-261-6/+10
| | | | | | | | | | | | | Currently address{Updated,Removed} pass in the address as a string such as "fe80::1/64". Use LinkAddresses instead, since that's what it is. This makes the code more robust in the unlikely case that netd passes in an invalid string. In the future we can move flags and scope into the LinkAddress itself and simplify the code further. Bug: 9180552 Change-Id: I66599f9529cf421caa7676fdd0141bb110b8589e
* Pass DNS server info notifications to observers.Lorenzo Colitti2013-11-251-0/+36
| | | | | | | | | | | These are sent if the device receives IPv6 Router Advertisements with DNS server configuration options. Currently, nothing listens to them; in a future change we will use them as IPv6 DNS servers. [Cherry-pick of 416740ad4d9132005a71dc0883334e852235a18a] Bug: 9180552 Change-Id: I05000c0cd3867a68ab390102e8470b6912a9d3aa
* Minor cleanups to NetdCallbackReceiver.onEvent.Lorenzo Colitti2013-11-251-14/+9
| | | | | | | | | | - Clean up identical error messages. - Fix the array length check for InterfaceAddressChange. [Cherry-pick of 59be800e7fe81842aa8c77b91319f58ab165983d] Bug: 9180552 Change-Id: Id871f481445b530c3ad749725f1548df0e3a1228
* Request all tethering interfaces, fix corruption.Jeff Sharkey2013-09-101-45/+34
| | | | | | | | | | | | | netd now tracks statistics for tethered interfaces across tethering sessions, so switch to asking for all tethering stats. (Currently we're double-counting all tethering data, ever since it started tracking across sessions.) Also catch OOME to handle corrupt stats files, which we then dump to DropBox and then start over. Bug: 5868832, 9796109 Change-Id: I2eb2a1bf01b993dd198597d770fe0e022466c6b9
* Setting MTU size for specific network.sy.yun2013-09-061-0/+12
| | | | | | | | | | | | Able to config network specific MTU size. Normally, the default size of MTU is 1500. US - ATT 1410, TMUS 1440, SPRINT 1422 KR - SKT 1440, KT 1450, LGU+ 1428 JP - KDDI 1420, SoftBank 1340 CA - RGS 1430, FIDO 1430, MTS 1430, BELL 1358, SaskTel 1358 AU - TEL 1400 Bug: 10195070 Change-Id: Ie18650b37a3d44af944f2dae4aa97c04fb12cd5e
* Add a simple test for NetworkManagementService.Lorenzo Colitti2013-08-231-4/+10
| | | | | | | | | | For now, this only tests network observers. It works by starting NetworkManagementService with a fake netd socket, feeding it inputs, and seeing if the appropriate observer methods are called. Bug: 10232006 Change-Id: I827681575642a4ee13ae48b81272521544b676bd
* Notify IP address changes to interface observers.Lorenzo Colitti2013-08-201-0/+57
| | | | | | | | | | | | | 1. Add addressUpdated and addressRemoved methods to INetworkManagementEventObserver. (The -Updated method is not called -Added because it gets called for both adds and changes.) Update all its callers in the tree. 2. Make NetworkManagementService parse IP address notifications from NetlinkHandler and call the address{Removed,Updated} on its observers. Bug: 10232006 Change-Id: Ieb185dbba052bdbff03caafc0cf5397a7f04dc6d
* Fix supplimentary network connections with VPNsChad Brubaker2013-07-191-0/+20
| | | | | | | Enables the use of supplimentary mobile networks like MMS, and HIPRI while VPNs are running. Change-Id: I313f57a905b4e16bd4322c68687cbff1cfbe9d3e
* Add NetworkManagement support for fwmark routesChad Brubaker2013-07-111-4/+56
| | | | | | Add NetworkManagementService binds for netd's fwmark routes Change-Id: I55cf6b198d56f1fb0d20818ddf176a0f779a33b6
* More work on process tracking.Dianne Hackborn2013-06-141-1/+2
| | | | | | | | | | Re-arranged code to be more flexible, now track state of services, dump ordered list of running processes while memory was critical and low. Also rename battery stats service from "batteryinfo" to "batterystats". Change-Id: I0f4f0c8d443c49d255cb84d0fc917e8ec18b152e
* Merge "Add NetworkManagement methods for netd uid binds"Geremy Condra2013-06-131-0/+73
|\
| * Add NetworkManagement methods for netd uid bindsChad Brubaker2013-06-121-0/+73
| | | | | | | | | | | | | | Add methods to NetworkManagementService for per uid routing and DNS and for setting up fwmark tables for interfaces. Change-Id: Icf2c4a46f7f422660031ef73b537745922286246
* | softap: Match new config formatDmitry Shmidt2013-06-111-2/+2
|/ | | | | Change-Id: Ic83a73678149aa56069c4a13d87e38de66243aa3 Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
* resolved conflicts for merge of e96a8207 to masterKenny Root2013-06-101-3/+3
|\ | | | | | | Change-Id: I90801b35ed0c00078a47faadc7fbb05d2e5fe381
| * Avoid logging sensitive data.Jeff Sharkey2013-06-071-3/+3
| | | | | | | | | | | | | | | | When building commands to send across NativeDaemonConnector, scrub sensitive arguments to prevent them from being logged. Bug: 8609800 Change-Id: I84b16791749264a010f7e59f9918f68d71bac6b9
* | Accumulate network statistics based on deltas.Jeff Sharkey2013-06-061-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | Network stats are now read out of the kernel in one sweep, instead of reading per-UID. We now accumulate the delta traffic between each stats snapshot using the well-tested SamplingCounter pattern. Since Wi-Fi and mobile traffic have different costs, track each separately. Avoids counting misc interfaces like loopback and ethernet under total. Bug: 5543387 Change-Id: I642004dc530113c27ef79f2abbae51d8af30117f
* | softap: Set broadcast option explicitlyDmitry Shmidt2013-04-161-2/+4
|/ | | | | Change-Id: I3f045b5427e68223d0b0be995d3d8c00a9ad21bc Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
* Add BT - DataTracker connectionRobert Greenwalt2013-03-271-27/+0
| | | | | | | | Allows the external BT stack the means to communicate with ConnectivityService during reverse tethering. bug:8445208 Change-Id: Ice7dfb0b50c9481d359aed14a51372878185171c
* Catch RuntimeException in NMService notificationsLorenzo Colitti2013-03-171-0/+6
| | | | | | | | | | | | | | | | | | Currently, NetworkManagementService only catches RemoteExceptions when calling the BaseNetworkObserver notification methods (e.g., interfaceStatusChanged). However, if the observer is in the same process, unchecked exceptions can occur as well. When this happens, finishBroadcast does not get called, and no further notifications can be sent, because any attempt to do so fails with a "beginBroadcast() called while already in a broadcast" exception. Fix this by catching RuntimeException as well. Bug: 8397534 Bug: 8276725 Change-Id: Icd6f32128707244978943c48a9ea3a2b952a2957
* Revert "Fail fast if somebody is adding default routes"Wink Saville2013-03-151-2/+2
| | | | | | | | This reverts commit 6f210bd0191e1936bbc1f036912c6efc4ea69475 Mako wouldn't boot for me, reverting for now. Change-Id: Ie92d6bf77811e7257e86d65e1e15e1973c027cd7
* Fail fast if somebody is adding default routesRobert Greenwalt2013-03-141-2/+2
| | | | | bug:2655011 Change-Id: I25da940e024825bc6e1d1ac5fe7b0d951609c1c1
* Expose clatd commands to NetworkManagementService.Lorenzo Colitti2013-02-281-0/+39
| | | | | | | | For now, we only support running one clat at a time. This is enforced by the netd ClatdController code. Bug: 8276725 Change-Id: I8a50305f9182f4da0f80716081211625a0202583
* Require command and argument separation, cleanup.Jeff Sharkey2013-02-251-15/+9
| | | | | | | | When invoking NativeDaemonCommands, require that base command and arguments are separate. Clean up reverse tethering commands, and remove deprecated throttle events. Change-Id: I302a74130b4f7c3f3045815a56d566e89c8969f6
* Parse network stats using native code.Jeff Sharkey2013-02-131-4/+20
| | | | | | | Switch to parsing detailed network stats with native code, which is 71% faster than ProcFileReader. Change-Id: I2525aaee74d227ce187ba3a74dd08a2b06514deb
* Escape arguments before passing to netd.Jeff Sharkey2013-02-131-6/+2
| | | | Change-Id: I70bb0cb1e90abd490f8893365c6bdf1844b01d18
* Second pass tying into dns cache per interfaceMattias Falk2013-02-061-0/+26
| | | | | | | | | Set dns servers for secondary nets and attach the processes (pids) that are using the secondary nets to the secondary nets associated dns cache. bug:5465296 Change-Id: I1eaf92d5c6b81d287e9fb2763b3d972d9de34395
* Merge "Revert "Second pass tying into dns cache per interface""Robert Greenwalt2013-01-191-26/+0
|\
| * Revert "Second pass tying into dns cache per interface"Robert Greenwalt2013-01-191-26/+0
| | | | | | | | | | | | This reverts commit f60f94a89e49c125f4aff6496710a0fb66579545 Change-Id: If52dffd5100a6b03275da0eabfa05e24c5ecada9
* | Merge "Second pass tying into dns cache per interface"Robert Greenwalt2013-01-171-0/+26
|\|
| * Second pass tying into dns cache per interfaceMattias Falk2013-01-111-0/+26
| | | | | | | | | | | | | | | | | | Set dns servers for secondary nets and attach the processes (pids) that are using the secondary nets to the secondary nets associated dns cache. Change-Id: Id865c2c3fdc0ec1c3e30c134e9ea4109f4f2fbeb bug:5465296
* | Removed Throttle Manager as obsoleteSasha Levitskiy2013-01-141-43/+0
|/ | | | Change-Id: I63e8514f34c880d0badaab33a347f54a80c84da6
* Support for dns domain.Robert Greenwalt2012-11-161-2/+4
| | | | | bug:6799630 Change-Id: I10070eddb65b7b60f0bc2b3e1e320e1aa4ec6e98
* Restrict lockdown and firewall to AID_SYSTEM.Jeff Sharkey2012-09-061-6/+15
| | | | | Bug: 7076289 Change-Id: Iafa3054335e8b1c3c8c3b8db2a4191d4ed4c8c41
* Always-on VPN.Jeff Sharkey2012-08-271-1/+2
| | | | | | | | | | | | | | | | | | | Adds support for always-on VPN profiles, also called "lockdown." When enabled, LockdownVpnTracker manages the netd firewall to prevent unencrypted traffic from leaving the device. It creates narrow rules to only allow traffic to the selected VPN server. When an egress network becomes available, LockdownVpnTracker will try bringing up the VPN connection, and will reconnect if disconnected. ConnectivityService augments any NetworkInfo based on the lockdown VPN status to help apps wait until the VPN is connected. This feature requires that VPN profiles use an IP address for both VPN server and DNS. It also blocks non-default APN access when enabled. Waits for USER_PRESENT after boot to check KeyStore status. Bug: 5756357 Change-Id: If615f206b1634000d78a8350a17e88bfcac8e0d0
* Clean up firewall interface method names.Jeff Sharkey2012-08-241-4/+4
| | | | Change-Id: I653f0a01af7c90fc96b201abb31ea8354b036e74
* Framework interface for netd firewall.Jeff Sharkey2012-08-241-2/+77
| | | | | Bug: 5756357 Change-Id: If8b9f738fcea2cf16bd01682220718b57346c7cc
* Setup idletimer for network interface.Haoyu Bai2012-08-101-0/+60
| | | | | | | Cherry-picked from commit f71ca8a5728e425de61ba794c9653dd0b04f16e3 in master. DO NOT MERGE Change-Id: I6101c7ae041b4cc1237ce7a9983753dbdfa301d3
* Network data activity change intent for network interfaces.Haoyu Bai2012-07-171-0/+27
| | | | | | | | The activity notification is received from netd, an intent DATA_ACTIVITY_CHANGE is then raised for other part of the system to consume. Change-Id: Idfcc4763c51c5b314c57f546c12557082f06bebf
* Netd event code for interface class acitivity.Haoyu Bai2012-07-171-0/+1
| | | | Change-Id: I83d5ca9ab854cb30ce6d9c06a977ca295f0cdbfd
* Add TODO comments to remove start/stopReverseTetheringMatthew Xie2012-07-161-4/+6
| | | | | | | Change start/stopReverseTethering permission from CHANGE_NETWORK_STATE to CONNECTIVITY_INTERNAL Change-Id: Iac76d5af6418e6a3e2d2f77bf713466981285e1a
* Non persistent adapter servicefredc2012-07-161-0/+29
| | | | | | | | | | | | | | | | | | Change-Id: Ib13d5c77416e58161df0e04d7a15ec0dddbde8b5 Conflicts: core/java/android/bluetooth/BluetoothInputDevice.java Conflicts: core/java/com/android/internal/app/ShutdownThread.java services/java/com/android/server/SystemServer.java Conflicts: services/java/com/android/server/SystemServer.java services/java/com/android/server/pm/ShutdownThread.java
* Cleanup softap interface to netdIrfan Sheriff2012-06-191-7/+6
| | | | Change-Id: I01e6c5b5a5a8ddaf05b979f9cc6d1293c86e8773
* Modify logging to debug this issueRobert Greenwalt2012-05-241-1/+1
| | | | | | | | | Logging exec time on startUsingNetworkFeature as we've had some reports suggesting it's causing ANRs. Remove some logging from NDC so it's local log is more useful. bug:6492166 Change-Id: I258ff6c59bff2c65935242d50496d84720c5d493
* Add some logging to NDC.Robert Greenwalt2012-05-151-1/+1
| | | | | bug:6492166 Change-Id: Ib7c7a0927d3e920f6c041f7252f3f24c8e597bc7
* Merge "Begin collecting xtables iface counters." into jb-devJeff Sharkey2012-05-041-2/+8
|\
| * Begin collecting xtables iface counters.Jeff Sharkey2012-05-011-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | Add method to parse new iface_stat_fmt proc stats, or return null when kernel support is unavailable. Add test and remove older, unused parsing code. Create new "xt" recorder to persist the new xtables counters when available. Add SSID support to NetworkIdentity to fix policy tests. Bug: 6422414 Change-Id: I77f70e9acb79a559ab626f3af5c4f3599801ed43
* | Push existing rules when netd reconnects.Jeff Sharkey2012-05-021-51/+98
|/ | | | | | | | | When netd drops its socket connection to framework, assume that it has restarted, and push any existing rules to keep netd and iptables consistent. Bug: 6376246 Change-Id: Id93138938321bcf885eb0e4fecaff8b150cfdfcf
* Merge "Fix softap start"Irfan Sheriff2012-03-091-1/+0
|\