Commit Graph

3170 Commits

Author SHA1 Message Date
nharold
0f7857e587 Merge "Require NETWORK_STACK Permission for IpSec Tunnel Mode" am: 43699e90f3
am: e736f83caf

Change-Id: If7330b4fdf5d2ccbddb590ab81a4b19c1f612b66
2018-02-10 01:57:50 +00:00
Nathan Harold
5a920ca377 Require NETWORK_STACK Permission for IpSec Tunnel Mode
At least until further permissions are agreed upon,
the NETWORK_STACK permission is sufficient to ensure
that access to the tunnel mode APIs is secure, and
this permission will always be a sufficient condition.
Thus, adding NETWORK_STACK.

Bug: 66955045
Test: compilation
Change-Id: I2dc36896a52d2e71fad55041507d68ca91191ffc
2018-02-08 21:16:51 +00:00
Jong Wook Kim
b6b2957b8e Merge "MacAddress: Use SecureRandom and add a 46 bit randomized MAC generator" am: 9f16828767
am: 775861bb12

Change-Id: I6dba4e244c660d29f107e471250d39e9caafb17e
2018-02-07 05:32:01 +00:00
Jong Wook Kim
f0a55cc9ed MacAddress: Use SecureRandom and add a 46 bit randomized MAC generator
Use SecureRandom instead of Random since Random is time based and can
increase the chance of generating same MAC address across multiple
devices.

createRandomUnicastAddress should randomize all bits of the address,
except for locally assigned bit and unicast bit. The previous method
that only randomizes NIC and use Google Base OUI is renamed to
createRandomUnicastAddressWithGoogleBase.

Bug: 72450936
Test: runtest frameworks-net
Change-Id: Icda650638c2c1c9fd90d509a87e86347c0e05f2d
2018-02-07 01:28:46 +00:00
Hugo Benichi
9a70530107 Merge "Update OWNER files for connectivity" am: 771e229a23
am: ce0c31d392

Change-Id: I5a995856aa347874b534312212ca73ffff0193c0
2018-02-05 00:39:54 +00:00
Hugo Benichi
771e229a23 Merge "Update OWNER files for connectivity" 2018-02-04 23:18:52 +00:00
Pavel Maltsev
3379a3eff9 Merge "Enable multiple active Ethernet interfaces" am: 0a6c539901
am: ac908d6728

Change-Id: I95a4e5d519857950297f5948525990c4808cd5fd
2018-02-03 01:25:34 +00:00
Treehugger Robot
0a6c539901 Merge "Enable multiple active Ethernet interfaces" 2018-02-02 23:13:54 +00:00
Chenbo Feng
7b5487cd0a Merge "Return non-negetive value in getMobileStats method" am: bb1d07e681
am: 515a54a93e

Change-Id: I54a400b4231c38db25aa1b717f302a8a52e1773e
2018-02-02 17:02:10 +00:00
Adam Vartanian
6e6d44012f Merge changes from topic "am-f1eb5cc5-7ac1-4540-b9cf-e0577f9334e7" into oc-dev am: 36c202ed80 am: cf31e066a9
am: f64dcd5bb5

Change-Id: I5980a614656d41f648da5a57c933533705a89c63
2018-02-02 07:05:29 +00:00
Treehugger Robot
bb1d07e681 Merge "Return non-negetive value in getMobileStats method" 2018-02-02 04:22:34 +00:00
Hugo Benichi
1c8756154a Update OWNER files for connectivity
Test: no functional change
Change-Id: I25276c769468c37970cb1915660fee29e589008c
2018-02-02 12:49:45 +09:00
Adam Vartanian
f64dcd5bb5 Merge changes from topic "am-f1eb5cc5-7ac1-4540-b9cf-e0577f9334e7" into oc-dev am: 36c202ed80
am: cf31e066a9

Change-Id: I774ce7a4046548222c3a0d913bbfcc3e0759ede3
2018-02-02 03:46:04 +00:00
Adam Vartanian
cf31e066a9 Merge changes from topic "am-f1eb5cc5-7ac1-4540-b9cf-e0577f9334e7" into oc-dev
am: 36c202ed80

Change-Id: Ieb4b5cd2cafd20d4898bc781c43e41d3bed0d7dc
2018-02-01 23:44:18 +00:00
Benedict Wong
dcb9219764 Merge "Fix minor bugs with tunnel mode implementation" am: cb9cd96c50
am: b7afa3f6fb

Change-Id: I9c2a844d9ccc401a34d0e6318506406e8c33fab6
2018-02-01 03:49:45 +00:00
Android Build Merger (Role)
4f46378ab7 [automerger] Adjust URI host parsing to stop on \ character. am: fa3afbd0e7 am: 97668ae137 am: fddbf1b6b2 am: d3c0db66b9 am: 373cfa75c0 am: bdff04aba3 am: 7341805cac am: 885a2ecf96 am: 54f1b302ab am: 6b1b3c9bdc
Change-Id: Iceaaaec271c590da862e65002396222aab9219e8
2018-01-31 11:21:07 +00:00
Android Build Merger (Role)
6b1b3c9bdc [automerger] Adjust URI host parsing to stop on \ character. am: fa3afbd0e7 am: 97668ae137 am: fddbf1b6b2 am: d3c0db66b9 am: 373cfa75c0 am: bdff04aba3 am: 7341805cac am: 885a2ecf96 am: 54f1b302ab
Change-Id: I09260b353e45dac4c59b920b0166d40b3eb810aa
2018-01-31 11:21:02 +00:00
Android Build Merger (Role)
885a2ecf96 [automerger] Adjust URI host parsing to stop on \ character. am: fa3afbd0e7 am: 97668ae137 am: fddbf1b6b2 am: d3c0db66b9 am: 373cfa75c0 am: bdff04aba3 am: 7341805cac
Change-Id: Ib4cb67450dcb8e35693030d77e2ec815d23275d1
2018-01-31 11:20:48 +00:00
Android Build Merger (Role)
7341805cac [automerger] Adjust URI host parsing to stop on \ character. am: fa3afbd0e7 am: 97668ae137 am: fddbf1b6b2 am: d3c0db66b9 am: 373cfa75c0 am: bdff04aba3
Change-Id: Ieddabe1b12f34bd7632ce893ef4e0c298f5c44df
2018-01-31 11:20:41 +00:00
Android Build Merger (Role)
bdff04aba3 [automerger] Adjust URI host parsing to stop on \ character. am: fa3afbd0e7 am: 97668ae137 am: fddbf1b6b2 am: d3c0db66b9 am: 373cfa75c0
Change-Id: Ia7b1157fb7f2066e26dc82ec703f39cd9fa69fd7
2018-01-31 11:20:28 +00:00
Android Build Merger (Role)
373cfa75c0 [automerger] Adjust URI host parsing to stop on \ character. am: fa3afbd0e7 am: 97668ae137 am: fddbf1b6b2 am: d3c0db66b9
Change-Id: If07298bb4ecf8a55391a014568a3ea264358b0e9
2018-01-31 11:20:21 +00:00
Android Build Merger (Role)
d3c0db66b9 [automerger] Adjust URI host parsing to stop on \ character. am: fa3afbd0e7 am: 97668ae137 am: fddbf1b6b2
Change-Id: I3fd20a3ee5eaa6be1c1989f13d40aed34136557e
2018-01-31 11:20:15 +00:00
Android Build Merger (Role)
fddbf1b6b2 [automerger] Adjust URI host parsing to stop on \ character. am: fa3afbd0e7 am: 97668ae137
Change-Id: Ic336b5fafebabdd4a5ad4d775a96d76739189a09
2018-01-31 11:20:08 +00:00
Android Build Merger (Role)
97668ae137 [automerger] Adjust URI host parsing to stop on \ character. am: fa3afbd0e7
Change-Id: I20336a5786e753e6941b9a784068480475415110
2018-01-31 11:19:56 +00:00
Adam Vartanian
fa3afbd0e7 Adjust URI host parsing to stop on \ character.
The WHATWG URL parsing algorithm [1] used by browsers says that for
"special" URL schemes (which is basically all commonly-used
hierarchical schemes, including http, https, ftp, and file), the host
portion ends if a \ character is seen, whereas this class previously
continued to consider characters part of the hostname.  This meant
that a malicious URL could be seen as having a "safe" host when viewed
by an app but navigate to a different host when passed to a browser.

[1] https://url.spec.whatwg.org/#host-state

Bug: 71360761
Test: vogar frameworks/base/core/tests/coretests/src/android/net/UriTest.java (on NYC branch)
Test: cts -m CtsNetTestCases (on NYC branch)
Change-Id: Id53f7054d1be8d59bbcc7e219159e59a2425106e
2018-01-31 11:14:45 +00:00
Benedict Wong
b8ef541cbc Fix minor bugs with tunnel mode implementation
This change makes sure tunnel mode transforms are properly activated
upon construction, and corrects bugs with how policy selectors were being
generated for tunnel mode policies. Specifically, the source/destination could
not be empty strings, even for cases where an empty selector was desired.

Bug: 72457770
Test: GTS tests run
Change-Id: I9a9f64c34b07883a02a5c996614f958486d214fc
2018-01-31 01:16:53 +00:00
nharold
a325e4dac1 Merge changes from topic "cherry-pick-cell-keepalive" am: 8cabb012fa
am: 02fecd46de

Change-Id: Ib4ba3f739a91ea2700611732f71afec0cc997ae4
2018-01-30 19:52:22 +00:00
Chenbo Feng
20328e8df0 Return non-negetive value in getMobileStats method
The current implementation of getMobileRxBytes and all the similiar
method adds up the return values for multiple calls to getRxBytes so if
all of them return UNSUPPORTED for any reason, getMobileRxBytes() would
return a value such as -3. This behavior is not compliance with the cts
TrafficStatsTest which always assume getMobileRxBytes to return a
non-negetive value. The method now will check tha stats get from
getRxBytes method and add them up only if the stats is valid.

Bug: 72473294
Test: run cts -m CtsNetTestCases -t android.net.cts.TrafficStatsTest
Change-Id: I656970ebc8f6506cf17c4353ad46c0178bb65cfd
2018-01-29 12:19:26 -08:00
Nathan Harold
70224716b3 Rework KeepalivePacketData for Compatibility with Cell
KeepalivePacketData currently mixes multiple concepts: the
list of parameters that are used to generate a keepalive
packet, the keepalive packet itself, and the parameters that
are needed to send a keepalive packet over an ethernet link.

The KeepalivePacketData is now a parcelable that can be used
generically by any NetworkAgent, regardless of how that Agent
fulfills its duty to initiate and maintain a keepalive session.

Bug: 69063212
Test: verified with SL4A, additional tests pending
Merged-In: I23dc4827ae729583356a8ff0f02e39a2ad2b81f5
Change-Id: I23dc4827ae729583356a8ff0f02e39a2ad2b81f5
(cherry picked from commit 26deacfbe7)
2018-01-29 11:20:20 -08:00
Nathan Harold
26de1d3b90 Relocate KeepalivePacketData to frameworks/base
Due to an issue resolving the boot classpath, the
KeepalivePacketData structure cannot be referenced
by frameworks/opt/telephony while it is in services.

-Move KeepalivePacketData to android.net
-Also, relocate IpUtils without changing the package
 name.

Bug: 38350389
Test: compilation
Merged-In: If5fc63e9ad8b9b2d4c2fee47ff4bab2ab190a05a
Change-Id: If5fc63e9ad8b9b2d4c2fee47ff4bab2ab190a05a
(cherry picked from commit 41002e3080)
2018-01-29 11:19:43 -08:00
Pavel Maltsev
c07a96d1e4 Enable multiple active Ethernet interfaces
- add Ethernet interface configurations to config.xml; no vendors can
specify network capabilities (in particular they can mark network as
restricted which make sense for embedded applications + static IP
configuration)
- extend EthernetManager to support multiple interfaces, use interface
name as an identificator
- extend IpConfigStore to store IP configuration based on string
identifier (e.g. ethernet name)

Test: runtest -x frameworks/base/services/tests/servicestests/ -c com.android.server.net.IpConfigStoreTest
Change-Id: Ic1e70003f2380ca8edb4469d6b34e27c5e8cf059
2018-01-29 10:11:05 -08:00
Hugo Benichi
65bbfa1c6c Merge "Tcp socket metrics: implement INetdEventListener callback" am: 93b1787a3d
am: 5ba62a2194

Change-Id: I6c30a47ed35394d63b266250e3525976844b0e8f
2018-01-25 22:19:53 +00:00
Treehugger Robot
93b1787a3d Merge "Tcp socket metrics: implement INetdEventListener callback" 2018-01-25 19:23:18 +00:00
nharold
461aeb4689 Merge "Move Keepalive out of IpSecTransform.Builder" am: af3fb3efe4
am: bbb4b05a64

Change-Id: I383aa402d9d570ee7c7d5a603d022d1dade267a5
2018-01-25 07:49:59 +00:00
Chalard Jean
16897eb4aa Merge "Fix a bug where a NetworkAgent gets repeatedly torn down" am: a8452ed2a6
am: 806f0191d4

Change-Id: Ifd63fdf47348dc3a1c1871deacc61470784bdbb6
2018-01-25 07:41:44 +00:00
nharold
af3fb3efe4 Merge "Move Keepalive out of IpSecTransform.Builder" 2018-01-25 05:50:33 +00:00
Chalard Jean
cf8c3fe19c Fix a bug where a NetworkAgent gets repeatedly torn down
mUids is not marshalled correctly when null so if the
NetworkAgent runs in another process and is not a VPN then
the system will see its allowed Uids as being the empty
list (= nobody can use this network) instead of a null
list (= everybody can use this network). This breaks
emulator networking.

Bug: 72436966
Test: runtests frameworks-net
Test: also manual testing, this does fix emulator networking
      and seems not to break phone networking
Change-Id: Id2bbf3808e80b19cd055c832c11cf72372710942
2018-01-25 04:51:44 +00:00
Hugo Benichi
f90773cf4f Tcp socket metrics: implement INetdEventListener callback
This patch implements the new INetdEventListener.onTcpSocketStatsEvent
callback added in INetdEventListener.

For the time being, tcp socket stats are tracked inside TcpMetrics only
for dumpsys printing and bug report integration as a first step.

Bug: 64147860
Test: manually tested, watching output of
      $ adb shell dumpsys connmetrics
Change-Id: I10ab24c6da4bb654d9198a4d8d00ccdc972cc0d5
2018-01-25 13:26:43 +09:00
Nathan Harold
c43e89f973 Move Keepalive out of IpSecTransform.Builder
The lifecycle of Keepalive offloading is, unfortunately
different from that of an IpSecTransform. Because starting
a keepalive is fundamentally asynchronous, and isn't valid
until after a transform exists, it will now be a separate
optional procedure that may succeed or fail. It remains
linked with a Transform by the need for a Transform to exist
in order to initiate a Keepalive.

Bug: 38350389
Test: compilation
Change-Id: Ia76fccee41f86d694dff436043293d0c0762c041
2018-01-24 19:32:04 -08:00
Benedict Wong
eacecc37e8 Merge "Add TunnelInterface API and KernelResourceRecords" am: f811dff3bc
am: e1aa92f1c1

Change-Id: If27d78708ce225a900ad78a82d9f323770223808
2018-01-24 09:02:56 +00:00
Benedict Wong
22734c40b4 Merge "Add xfrm mark in IpSecConfig" am: 73f79ceae9
am: 4077e802ad

Change-Id: I03ddca0611c4e0b41edc705cdb39b415205bb14b
2018-01-24 08:19:16 +00:00
Benedict Wong
8149f6eb6c Add TunnelInterface API and KernelResourceRecords
This change adds one KernelResourceRecord type (TunnelInterfaceRecord),
and adds methods for the creation of TunnelInterfaces, as well as the
application of Transforms to the given TunnelInterfaces

As part of the generation of ikeys/okeys, a ReserveKeyTracker manages a
java bitset to avoid collisions and reserve/release keys.

Bug: 63588681
Test: Compiles, CTS, unit tests all pass on AOSP_marlin
Change-Id: I9e9b6455e27073acd4491eae666aa966b3b10e0f
2018-01-24 07:24:27 +00:00
Chalard Jean
69791b6883 Merge changes I3b16caad,Iaf5ea7ab,I09a94042,I69a39039,I35300309, ... am: 6568170b32
am: 84af3a7b2b

Change-Id: I3f2185330789a8b02cc5e05912e3f17256ba1b86
2018-01-24 06:11:06 +00:00
Benedict Wong
73f79ceae9 Merge "Add xfrm mark in IpSecConfig" 2018-01-24 05:53:29 +00:00
Chalard Jean
6568170b32 Merge changes I3b16caad,Iaf5ea7ab,I09a94042,I69a39039,I35300309, ...
* changes:
  Let network requests see VPNs.
  Move constants into a new file.
  Make sure listen requests from VPN apps see their own networks
  Add a test for new UID checking code.
  Remove UID_RANGES_ADDED and REMOVED.
  Move VPN allowed UIDs into NetworkCapabilities.
  Pre-import to remove a conflict.
2018-01-24 04:09:44 +00:00
Benedict Wong
9aaff41725 Merge "Expose applyTunnelModeTransform as a system API" am: d056f32bd9
am: c2253ff48d

Change-Id: I85c761df4b77dba0b62adfd3488f66cdcf780fa3
2018-01-24 02:50:47 +00:00
Benedict Wong
e0d448f31e Expose applyTunnelModeTransform as a system API
Simple change to expose systemAPI for applyTunnelModeTransform

Bug: 36033193
Test: All CTS, unit tests passing
Change-Id: I2d857c048bc0dc80c3949387f946b1f5adf0527e
2018-01-23 23:25:54 +00:00
Lorenzo Colitti
f5c668bf38 Add metered, roaming, and defaultNetwork info to NetworkTemplate. am: 0f9bce6883
am: e383807d7f

Change-Id: I1faf95edec0e836c69016c84ad2a2c8518f8eb53
2018-01-23 19:39:18 +00:00
Lorenzo Colitti
5d50149710 Add the defaultNetwork element to the netstats.proto. am: 9781f785bc
am: adcb94472a

Change-Id: I292e903617d3af1867529e68eb20538afb66f665
2018-01-23 19:30:57 +00:00
Chalard Jean
dda156ab0c Let network requests see VPNs.
Test: runtest frameworks-net
Test: also tested with VPN app
Test: also cts passing
Change-Id: I3b16caad7787c3c1f2921ca1583815c89efbadc5
2018-01-23 21:38:00 +09:00