340 Commits

Author SHA1 Message Date
Hugo Benichi
357b58cdab Add first OWNERS files for core networking
Covering
  core/java/android/net/
  core/java/com/android/server/net/
  packages/CaptivePortalLogin/
  services/core/java/com/android/server/
    ConnectivityService.java
    NsdServic.java
    NetworkManagementService.java
  services/core/java/com/android/server/connectivity/
  services/net/
  tests/net/

Android core networking files not covered:
  services/core/jni/com_android_server_connectivity_tethering_OffloadHardwareInterface.cpp
  services/core/proto/ipconnectivity.proto (path unique to aosp)

Bug: 63408147
Test: builds
Change-Id: Ifbb923d5ffdcada83864b5e0eb07911682d66efa
2017-07-12 09:25:15 +09:00
Lorenzo Colitti
97e7afe8d0 Merge "Make failure to set addrgenmode a non-fatal error."
am: 9c170157a8

Change-Id: Ia4074f720ce0db69c86cd58ddc574d595cfceeee
2017-07-10 13:43:02 +00:00
Lorenzo Colitti
00886760d7 Make failure to set addrgenmode a non-fatal error.
Bug: 17613910
Test: bullhead builds, boots, connects to wifi
Change-Id: I310dcacc6784c13904fca79b839b5f4d94bfc45e
2017-07-10 19:10:35 +09:00
Erik Kline
59079c2f8e Merge "Switch IpManager and IpReachabilityMonitor to use SharedLog"
am: a3ea0e2337

Change-Id: I380551a59a1278df4cb6a0e7e590edae38e79881
2017-07-03 08:19:25 +00:00
Erik Kline
9e6655945a Switch IpManager and IpReachabilityMonitor to use SharedLog
Test: as follows
    - built
    - flashed
    - booted
    - "runtest frameworks-net" passes
    - frameworks/opt/net/wifi/tests/wifitests/runtests.sh passes
    - frameworks/base/wifi/tests/runtests.sh passes
    - roamed from AP to AP watching IpRM logs accumulate
Bug: 62476366
Bug: 62162774

Merged-In: I4bef3b6b1975fa3c73cca0a0e95fad99708f061e
Merged-In: I265566158f3e5ebd21fb43e2eb0b8ba016fca76a
Change-Id: I155a26259420919eeed74166bacce3311caa49da
(cherry picked from commit 0fc10b2b1d7be649c80dda4ebdb2e31af216bfcc)
2017-07-03 16:08:28 +09:00
Hugo Benichi
834cf8d664 Merge "IpManager: always log immediate provisioning errors" am: 98f2decdad
am: 2d2f66d277

Change-Id: If1e885c13ce7ec1f480add63940bf9bc929d5072
2017-06-26 12:07:12 +00:00
Hugo Benichi
61f54d3fcd IpManager: always log immediate provisioning errors
And also migrate remaining Log.e usage to logError.

Bug: 62716267
Test: built and flashed
Change-Id: I61a6cec081d2bc0fe3d73e46fd52f1a42684e58c
2017-06-26 10:47:19 +09:00
Joel Scherpelz
8a4667b911 Merge "Use RFC 7217 stable privacy addresses" am: a88b12ce5e
am: 4c4d5477d4

Change-Id: I7f286484a31c7209e48e93a94d2a16849af6dace
2017-06-22 06:48:09 +00:00
Joel Scherpelz
2db1074e4f Use RFC 7217 stable privacy addresses
Ask Netd to setup WiFi interfaces to use stable privacy addresses. This
should fail benignly on devices with kernels lacking RFC 7217 support.

Test: as follows
    - built
    - flashed
    - booted
    - Manually observed persistent stable secret
    - Manually observed randomized IPv6 addresses (with flags = 800)
Bug: 17613910

Change-Id: I9465de16685b1eb0fd842446a530cf98d77a0c28
2017-06-22 13:31:06 +09:00
Joel Scherpelz
5bb63befb8 Merge "Ignore flow label when comparing RAs in APF" am: 81fda77884 am: 6ccdb3fe19
am: ef0bd781b1

Change-Id: I53c2a493946ecc4e5617bcd3f5e64ff0b82fedf2
2017-05-25 00:18:44 +00:00
Joel Scherpelz
967dec794b Ignore flow label when comparing RAs in APF
This change modifies the RA filter generation code to ignore bytes 1-3
of the IPv6 header. It also updates testApfFilterRa such that it fails
without the updates to ApfFilter.

Test: as follows
        - built
        - flashed
        - booted
        - sent RAs from OS X with differing flow labels and observed
	      that they were filtered
	- ApfTest passes
Bug: 31166495

(cherry picked from commit 7006bd4fe5eba4b6fad43dd28d9cad2d26ce140a)

Change-Id: I32153238193ac13a0e59be1875d983a0567c41c7
2017-05-24 15:24:24 +09:00
Erik Kline
308ed7f467 Merge "Expand logging capabilities of Tethering subsystem" am: 0373340b07 am: 96f9371a66
am: 945ff184c2

Change-Id: Ia9d15f0dcc49ce070f8684eb8c8481310859faa5
2017-05-18 03:54:30 +00:00
Erik Kline
7747fd4ce0 Expand logging capabilities of Tethering subsystem
Introduce a SharedLog that can be shared among all Tethering
components.  All log entries go to the same log, and each includes
its subsystem name.  Additionally, all entries emitted to the
system log shared the same tag, so can easily be watched.

More subsystems can inherit a SharedLog, but to minimize cherry-pick
conflicts we limit ourselves to these changes only.

Test: as follows
    - built
    - flashed
    - booted
    - log output observed via dumpsys
    - runtest frameworks-net passes
Bug: 32163131
Bug: 36988090
Bug: 38218697
Change-Id: I1229d4c55987402d84b0d4a2c8a595e0c829aa3e
2017-05-18 09:46:45 +09:00
Erik Kline
211bd49c9d Merge "Clarify some IpManager/ApfFilter debugging output." am: ce94c07ffd am: 3cc7ccfc69
am: b1914ebb50

Change-Id: If64f2b8a5cdf8b946a82a0c97a42cf61ef5e0b08
2017-04-27 00:35:25 +00:00
Erik Kline
af579eb5b5 Clarify some IpManager/ApfFilter debugging output.
Test: as follows
    - built
    - flashed
    - booted
    - "runtest frameworks-net" passes
    - "adb shell dumpsys wifi ipmanager" shows updated output
Bug: 34793131
Change-Id: I6dec135b97343943efb421ef7b2e84c4751dd5ea
2017-04-26 17:14:47 +09:00
Hugo Benichi
7a0191b355 Merge "Move byte logics from ApfFilter into BitsUtil" am: 21b9b3a8ff am: 12c1074c8b
am: a80bb82b4e

Change-Id: I5f13b006b57cc8a3ab0560626077d003ce4fe8c8
2017-04-24 19:07:37 +00:00
Hugo Benichi
495a17b332 Move byte logics from ApfFilter into BitsUtil
This patch extracts into BitUtils byte manipulation helper methods
and unsigned type manipulation helper methods from ApfFilter into
an independent and reusable structure.

Test: $ runtest frameworks-net
Change-Id: I0f33af10457a63dbde5983f14353a79b8cd877d9
2017-04-22 10:07:03 +09:00
Erik Kline
f700d5cad7 Merge "Tethering: support Local-only Hotspot mode for downstreams" am: d3128d4b55 am: 908ce167eb
am: f6626e812c

Change-Id: I79677f7e8e7ae5abec2a13b5e5391b8f07857a36
2017-04-10 12:21:57 +00:00
Erik Kline
ea9cc488eb Tethering: support Local-only Hotspot mode for downstreams
Test: as follows
    - built (bullhead)
    - flashed
    - booted
    - "runtest frameworks-net" passes
Bug: 31466854

Change-Id: Ia50e28c8ce0af8cdd7ac63217d921aff213668e7
2017-04-10 19:11:08 +09:00
Lorenzo Colitti
46aa9c022e Add an API hint for metered multipath traffic.
This allows an application that knows how to provide seamless
network connectivity (e.g., using QUIC multipath) to find out if
doing so is desired.

(cherry picked from commit 2de4925f5cc64aeb92e02a8f740d3ff20f36dddd)

Test: builds, boots, runtest frameworks-net passes.
Bug: 34630278
Change-Id: Ic7fd0b9e1cd879fdfaf84009d7125391895e9087
2017-04-06 16:50:06 +09:00
Joel Scherpelz
84b192e10e Merge "Partially revert "Add blocking and retrying wrappers for INetd uses."" am: 8b560611bf am: a084e3283f
am: 016bd9b699

Change-Id: I24debea7c7d90186705d0fee27617dc9aca798b5
2017-03-31 01:00:38 +00:00
Joel Scherpelz
a084e3283f Merge "Partially revert "Add blocking and retrying wrappers for INetd uses.""
am: 8b560611bf

Change-Id: I65e9137ae4c4f48e5484059244833edeab41f001
2017-03-31 00:42:57 +00:00
Joel Scherpelz
8b560611bf Merge "Partially revert "Add blocking and retrying wrappers for INetd uses."" 2017-03-31 00:28:13 +00:00
Joel Scherpelz
d8ea68ddc9 Partially revert "Add blocking and retrying wrappers for INetd uses."
Direct access to Netd from the bluetooth process is disallowed by
SELinux policy. This change reverts to the old behavior where IpManager 
interacts with NetdService indirectly via NetworkManagementService.

Bug: 36492299

This partially reverts commit af39244a34f4449c12a5f925222c9bc8d8049320.

Change-Id: Icf20b1e24abf7dd3123760f8637928bde7afe06b
2017-03-30 01:18:44 +00:00
Erik Kline
7f9bbae035 Merge "Add null check to IpManager.dump()" am: 58406d1df2 am: c5bca697ba
am: e398bae572

Change-Id: I172f23945a79191b777e2daf6795e2d228f510a6
2017-03-28 02:38:20 +00:00
Erik Kline
c5bca697ba Merge "Add null check to IpManager.dump()"
am: 58406d1df2

Change-Id: I68f644a305d58e1396522d73c0983e1eb201cb1c
2017-03-28 02:30:18 +00:00
Erik Kline
0ea70fc38b Add null check to IpManager.dump()
Test: as follows
    - built (bullhead)
    - flashed
    - booted
    - runtest frameworks-net passes
Bug: 36650508
Change-Id: I2270bec20b966de487048f0ea0c97360e242cd9d
2017-03-28 05:30:41 +09:00
Joel Scherpelz
b58609d7a6 Merge "Revert "Set accept_ra_rt_info_max_plen to 64 before enabling IPv6 interfaces"" am: 63d26caa38 am: 84c2fb2070
am: c3e0dcf082

Change-Id: I9a48897312a785ea7e0338aa68c8bb4877a741e6
2017-03-27 05:35:41 +00:00
Joel Scherpelz
84c2fb2070 Merge "Revert "Set accept_ra_rt_info_max_plen to 64 before enabling IPv6 interfaces""
am: 63d26caa38

Change-Id: I367506eee558dbd7abeeabf09716f7024c2e43d8
2017-03-27 05:24:09 +00:00
Joel Scherpelz
6a35f3c3e2 Revert "Set accept_ra_rt_info_max_plen to 64 before enabling IPv6 interfaces"
On second thought, let's set accept_ra_rt_info_m**_plen in 
Netd (InterfaceController::initializeAll())

This reverts commit 25870a2c9effd7a7d31c0678c34a6e952b2d56a1.

Change-Id: I22b000623bb852e375385d4aae789d007e84ba3d
2017-03-27 00:54:41 +00:00
Hugo Benichi
948a85948d Connectivity metrics: change how interface names are logged
This patch deprecates the ifname field for specific metrics events of
types DhcpClientEvent, DhcpErrorEvent, IpReachabilityEvent and
IpManagerEvent.

Instead ifnames are logged in ConnectivityMetricsEvent, allowing for
link layer inference.

Test: updated unit tests, $ runtest frameworks-net passes
Bug: 34901696
Change-Id: I8bfabcb115bbd5289471d653c153a40bb48f28cd
2017-03-21 10:18:56 +09:00
Joel Scherpelz
5e1eb40c8f Merge "Set accept_ra_rt_info_max_plen to 64 before enabling IPv6 interfaces" am: 52f8421b77 am: b8933942fc
am: f9cd5cd81b

Change-Id: I5ebbe1a63da43f28b0d582bc7e6480ffe74195b7
2017-03-17 03:05:45 +00:00
Joel Scherpelz
b8933942fc Merge "Set accept_ra_rt_info_max_plen to 64 before enabling IPv6 interfaces"
am: 52f8421b77

Change-Id: I5b5d5460f9fe7ed228ab32b2c63cb601be5e1edb
2017-03-17 02:53:11 +00:00
Joel Scherpelz
25870a2c9e Set accept_ra_rt_info_max_plen to 64 before enabling IPv6 interfaces
This patch tries to change accept_ra_rt_info_max_plen to 64 from its
default value of 0 on kernels that support router advertisements with
route information options. The code fails silently on older unsupported
platforms.

Also factor existing startIPv6() code into a self documenting function
enableInterfaceIpv6PrivacyExtensions()

Bug: 33333670
Test: as follows
    - build sailfish
    - flashed
    - booted
    - runtest frameworks-net passes
    - runtest frameworks-wifi passes

Change-Id: I10ec83b9e04836089477d74417b7222499820066
2017-03-17 09:41:43 +09:00
Erik Kline
b7a55f4a4b Merge "Add blocking and retrying wrappers for INetd uses." am: ba8c613e16 am: 143d0853a2
am: 300c56a977

Change-Id: Ia9d45d8fd636e918c8299b26163de0650f8ddac5
2017-03-16 02:58:10 +00:00
Erik Kline
143d0853a2 Merge "Add blocking and retrying wrappers for INetd uses."
am: ba8c613e16

Change-Id: Iae8ea51852ed6991e3b9ed89297c8a932b9224f3
2017-03-16 02:49:36 +00:00
Treehugger Robot
ba8c613e16 Merge "Add blocking and retrying wrappers for INetd uses." 2017-03-16 02:42:17 +00:00
Erik Kline
af39244a34 Add blocking and retrying wrappers for INetd uses.
Test: as follows
    - built (bullhead)
    - flashed
    - booted
    - runtest frameworks-net passes

Change-Id: I1a8e15149bf9dbedc6a09c0d8ab6abb2ef4f8fee
2017-03-15 16:23:29 +09:00
TreeHugger Robot
1809db5cb1 Merge "IP connectivity metrics: add new APF counters." 2017-03-15 04:24:30 +00:00
Hugo Benichi
22d9b2d430 IP connectivity metrics: add new APF counters.
This patch adds a few missing counters to APF events:
 - an actual lifetime duration to ApfProgramEvent.
 - counters for total number of updates to ApfStatistics.

ApfProgramEvents are now recorded at program removal in order to
populate the actual lifetime of the program. ApfProgramEvents whose
actual lifetime was less than 1 second are filtered out.

Finally, instance fields of ApfProgramEvent and ApfStats classes are
made mutable to allow for simple record-like creation. This was not
possible when these classes were tagged @SystemApi.

Test: - manually verified output of $ dumpsys connmetrics list
      - unit tests updated.
Bug: 34901696

Change-Id: I02694ebb9421ce1c2aa757fa6aa209d19a654dcd
2017-03-15 11:49:48 +09:00
Erik Kline
9f5e699093 Merge "Add comment with packet tracker debugging tip" am: 40aa5ee583 am: 17dd8723b7
am: 663269bae2

Change-Id: Iacf172a6b6e1b62bc84af8b5fcdd1745acfe987f
2017-03-15 02:47:52 +00:00
Erik Kline
17dd8723b7 Merge "Add comment with packet tracker debugging tip"
am: 40aa5ee583

Change-Id: I0f5f139f81af23ddc33e37ddf489a477e37c394f
2017-03-15 02:38:51 +00:00
Erik Kline
c6f796aa91 Add comment with packet tracker debugging tip
Test: as follows
    - built (bullhead)
    - flashed
    - booted
    - "runtest frameworks-net" passes
    - "adb shell dumpsys wifi ipmanager" shows the debugging tip

Change-Id: Ifcccbdd81a0fc8beb7801ec7c3f78e8a941bc72b
2017-03-14 20:03:14 +09:00
Lorenzo Colitti
2de4925f5c Add an API hint for metered multipath traffic.
This allows an application that knows how to provide seamless
network connectivity (e.g., using QUIC multipath) to find out if
doing so is desired.

Test: builds, boots, runtest frameworks-net passes.
Bug: 34630278
Change-Id: Ic7fd0b9e1cd879fdfaf84009d7125391895e9087
2017-02-01 17:02:29 +09:00
Lorenzo Colitti
e45952c825 Rename AvoidBadWifiTracker to MultinetworkPolicyTracker am: 58ebe1c6f1 am: 0bc8070fce am: 338241de94
am: d526434f05

Change-Id: I5aefc453c022286e6ee2332a53e6c9f36472e9a5
2017-02-01 03:17:19 +00:00
Lorenzo Colitti
d526434f05 Rename AvoidBadWifiTracker to MultinetworkPolicyTracker am: 58ebe1c6f1 am: 0bc8070fce
am: 338241de94

Change-Id: I91f1338f3488cfc60eef0c2147aa7b1d61107cdd
2017-02-01 02:59:42 +00:00
Lorenzo Colitti
58ebe1c6f1 Rename AvoidBadWifiTracker to MultinetworkPolicyTracker
Rename the class and ensure that all code related to bad wifi
avoidance has names that reflect its purpose.  This will allow us
to reuse most of the the code for other purposes in future CLs.

Test: runtest frameworks-net passes
Bug: 34630278
Change-Id: Ida190e5a79e7a12f4eec07e1a3e4d9d138e83bcd
2017-01-31 15:42:57 +09:00
Hugo Benichi
db11740a01 Merge "ApfTest: fix flaky testApfFilterRa." am: c2e8588396 am: 60e1375f79 am: 811f6c86da
am: 488ffdc784

Change-Id: Ib4223b548b434211dda4e750f660eb68a30a9d96
2017-01-31 06:16:43 +00:00
Hugo Benichi
488ffdc784 Merge "ApfTest: fix flaky testApfFilterRa." am: c2e8588396 am: 60e1375f79
am: 811f6c86da

Change-Id: Idd738e1a4c9f0a865f5b84270535a94c492341ce
2017-01-31 06:11:35 +00:00
Hugo Benichi
4456f33a95 ApfTest: fix flaky testApfFilterRa.
testApfFilterRa is failing with probabiliy 1/10 ~ 1/15 on the following
assert: assertDrop(program, packet, lifetime/6), for lifetime values
that are multiple of 6, where 6 is the hardcoded fraction of RA lifetime
to filter in ApfFilter.java.

When the lifetime is not a multiple of 6, the remainder of 1 to 5
seconds gives enough margin so that when the APF program is simulated
the faked lifetime of the program is less than lifetime/6 away and the
packet is dropped.

However for lifetimes which are exact multiples of 6, this margin is
always 0s and that result in nondeterminism in the result. This is
consistent with the obervation that the only failed assert was for a
lifetime of 300s, the only multiple of 6.

This can be observed by detecting the age limit at which the filter
stops dropping packet oscillating between lifetime/6 and lifetime/6 + 1
for lifetimes which are multiple of 6.

This patch fixes the flakyness by freezing the flow of time in tests so
that the expected filter age threshold is consistent and stable.

Test: no failure observed in 1000 runs.
Bug: 32561414
Change-Id: I5251d047039f34b82ce8a5d20ae46563e1e0cce8
2017-01-31 11:13:44 +09:00