310 Commits

Author SHA1 Message Date
Erik Kline
f840e07f82 Change BlockingSocketReader to use MessageQueue fd handling
Convert the simplistic blocking read in a separate thread model to
the MessageQueue OnFileDescriptorEventListener model, albeit still
on a separate thread.

Test: as follows
    - built
    - flashed
    - booted
    - "runtest frameworks-net" passes
    - basic IpManager functions still work,
      including ConnectivityPacketTracker
Bug: 62476366
Bug: 67013397
Change-Id: I1f4a6707eba402338947fe3f5392a26660f05714
2017-09-28 18:22:40 +09:00
Erik Kline
fc105bb6d8 Support NAT keepalives
Test: as follows
    - built
    - flashed
    - booted
    - "runtest frameworks-net" passes
    - turned on debugging and walked around watching IpReachabilityMonitor
      force neighbors into NUD_PROBE state without error
    - observed NAT callbacks happening without any reported errors
    - watched:
        adb shell cat /proc/net/nf_conntrack | egrep '192[.]168[.]43[.]' | sort -n -k5
      for correct timeout updates

Bug: 29337859
Bug: 32163131

Merged-In: I82ac60e5ad79ec64a13df6ec56b5b51b223f8dde
Merged-In: I09bc685e821ec5e871576a54c4290edea4c5160b
Merged-In: I4d180369a8f64ee494b016656988252d98a09ba4
Change-Id: Icb23da64cfaa3a19f7bc75fba426a52b0994fb0f
(cherry picked from commit 7a65bc62fbe0391f88834ab27b32033d6b957c8b)
2017-09-08 10:54:20 +09:00
Erik Kline
d3c0b5ed6f Refactor interface IP code into InterfaceController
Test: as follows
    - built
    - flashed
    - booted
    - runtest frameworks-net passes
      (except for UidRange and APF tests that are missing libvndk)
    - regular WiFi STA mode attach works for IPv4-only, dualstack,
      and IPv6-only networks
    - tethering works with dualstack upstream and downstream
Bug: 62476366

Change-Id: Id807b3091b0b2935b01aeb3644245034312b4183
2017-09-03 21:57:08 +09:00
Ahmed ElArabawy
fd424169a1 Add APF black list for ether-type
Add a configurable black for protocols which packets are to be dropped
by APF. This enales an OEM to configure the APF to filter out un-needed
packets from reaching the host

Bug: 62415182
Test: runtest frameworks-net

Merged-In: I86335a0f854d5e83a2b2767978cd69b2cc25c2f8

Signed-off-by: Ahmed ElArabawy <arabawy@google.com>

(cherry picked from commit caffbe127726c6a9ab5dd023a9b09cfa43eac617)

Change-Id: I15a758d18464d73d24ba8364a867904bb3cd3b34
2017-09-01 14:03:58 +09:00
Erik Kline
afe7935991 Shutdown more reliably
Also: collapse largely unused VDBG/DBG into just DBG.

Test: as follows
    - built
    - flashed
    - booted
    - runtest framworks-net passes
Bug: 64914645
Change-Id: Ifbb6b1ce18c52c9cb58c89b9661248a155f7b4a8
2017-08-30 17:19:53 +09:00
Erik Kline
b3bb26eaa7 Send add/removeDownstream info to offload HAL
Test: as follows
    - built
    - flashed
    - booted
    - "runtest frameworks-net" passed
Bug: 29337859
Bug: 32163131

Merged-In: I0cb81ac054fc2bf6c8b8bfe658e9404a15091d7a
Merged-In: I7abcdcc2d7d967179c47081a6db2b417164891f3
Change-Id: I6c59aa7cb80b54f376f294b24c1409710c553d74
(cherry picked from commit ed962a84122ab950a103fbbc0bf911f61b6b9500)
2017-08-23 20:55:47 -07:00
Hugo Benichi
c6a9b5564a Merge "IpManager: use InitialConfiguration for provisioning"
am: 5b218bdc8e

Change-Id: I131589680b68222e4fda4e9165ac2f50894ee28e
2017-08-21 12:08:28 +00:00
Hugo Benichi
d00ddf5672 IpManager: use InitialConfiguration for provisioning
This patch changes IpManager to take into account static provisioning
information specified in the InitialConfiguration for IPv6 static
configuration.

When a valid InitialConfiguration with IPv6 content is specified,
IpManager will do the following things:

- at start(), it will push the IPv6 addresses in the config to netd
- it will observe all addresses be notified via Netlink
- when all addresses are there, it will patch in the associated IPv6
  routes in the config, so that they get passed to ConnectivityService
  through the usual mechanism

The logic triggering onProvisioningSuccess is also changed to take into
account InitialConfiguration: when all addresses and all routes in the
config are seen the provisioning is successful.

Bug: 62988545
Test: runtest frameworks-net, with newly added tests
Change-Id: I77ed7c576c4b198de7a4726be70c78b74689e98b
2017-08-21 16:00:31 +09:00
Hugo Benichi
a22fbf4534 Merge "Connectivity OWNERS: let owners modify Android.mk"
am: 05be68698b

Change-Id: Iff94ca7089c074cc44f8e09cbce01f741c0b5c67
2017-08-08 07:34:39 +00:00
Hugo Benichi
afd2346bcc Connectivity OWNERS: let owners modify Android.mk
Since per-file overwrites the directory default, just allowing
build.master@android.com for Android.mk with a per-file rule prevents
the owners of the directory to modify Android.mk files without bypassing
OWNERS check in gerrit.

This patch fixes this issue for Connectivity OWNERS files by explicitly
listing Connectivity members for a few Android.mk files.

Test: build
Change-Id: I9c2a2519c3e7dd27e66334b090e074968b408cbc
2017-08-08 10:46:57 +09:00
Hugo Benichi
39a707813b Merge "Bootstrap IpReachabilityMonitor unit tests"
am: a9889c94aa

Change-Id: Ic3b145159a4c0430cc248a19b8527af40fa67696
2017-07-25 14:33:45 +00:00
Hugo Benichi
06b1f2b173 Bootstrap IpReachabilityMonitor unit tests
Bug: 62918393
Test: runtest frameworks-net

Change-Id: I236029f460dc3631ef9f5d8312dc1c6faf9807df
2017-07-25 14:59:48 +09:00
Ahmed ElArabawy
70291ef1d7 Merge "Add Configuration to APF Policy"
am: d27a6d62c6

Change-Id: I491bad86e4e9ae7a813ac214b06273719a583079
2017-07-20 03:46:08 +00:00
Ahmed ElArabawy
8537c58cc8 Add Configuration to APF Policy
in b/37702435 battery was drained due to reception of
Ethernet frames with Eth-type < 0x600 (non ehternet II frames)

This change adds an XML file to drop/allow these frames
Dropping helps tp avoid acquiring a wakelock for the
reception of these packets, while allowing them may be needed
for some protocols
The Change allow the OEM to override the system settings

Bug: 37702435
Test: runtest frameworks-net
Merged-In: Idb6c215896ef230a8136ff4ecefc90ccdc5c1c6d
Merged-In: I16346bb98a0b9259f7c3f51e318c472cfc1bb492

Signed-off-by: Ahmed ElArabawy <arabawy@google.com>

(cherry pick from commit 4dd7c58fc8fcc5a2c50de5e8eff05ddc5c3b0b8b)

Change-Id: Ie466baf1e6395d6c28245e41179232ea8e523845
2017-07-20 11:22:46 +09:00
Hugo Benichi
a428392c1d resolve merge conflicts of 4f2a0fe213e5 to stage-aosp-master
Test: I solemnly swear I tested this conflict resolution.
Change-Id: I61cfb2d4798350f28f1bb36aed67ee8f18895031
2017-07-14 07:25:51 +09:00
Treehugger Robot
4f2a0fe213 Merge "IpManager: define InitialConfiguration" 2017-07-13 20:45:21 +00:00
Hugo Benichi
fd31b9d46e IpManager: define InitialConfiguration
This patch adds a InitialConfiguration class to IpManager for specifying
IP information in IpManager ProvisioningConfiguration at IpManager
startup.

At the moment this InitialConfiguration is not used, but is validated in
startProvsiioning if ProvisioningConfiguration includes one. It will be
integrated into IpManager IP provisioning logic in follow-up patches.

This patch also includes an example of data driven unit tests using a
table of test case. The highlights of this methodology are:
  1) easy extensibility for new test case,
  2) rich and informative error messages,
Unfortunately Java support for inlined data structure literals is poor
and some companion static methods for data generation are required for
enabling this methodology.

Bug: 62988545
Test: added new test in FrameworksNetTests,
      $ runtest frameworks-net
      $ runtest frameworks-wifi
Merged-In: I060b02603af7d73a6407df89344bf0c000574af2

(cherry pick of commit 2757fcf3a13b0addc4a168a12c72ac2fc418b012)

Change-Id: I48dbf89232d7758f1b07ed4d76ce93281e5c6b53
2017-07-14 04:26:42 +09:00
Erik Kline
ae21b89414 Merge "Program offload-exempt local prefixes into the HAL"
am: de837a97aa

Change-Id: I741b6e31fb3adc922f47df824188786ff35e3aa9
2017-07-13 09:00:56 +00:00
Erik Kline
5acb4e3b62 Program offload-exempt local prefixes into the HAL
Test: as follows
    - built
    - flashed
    - booted
    - "runtest frameworks-net" passes
    - observed calls to the HAL setLocalPrefixes in tethering log
Bug: 29337859
Bug: 32163131
Merged-In: I3c3bd4ee83ffe86ddbe6a16fbbfa0756bf5064d4
Merged-In: Iaf80e584df458010741401fc1a19e7f6e21923c1
Merged-In: Ifaf23c6179ead9de6ccfcf41e0c203025153167b
(cherry picked from commit 32179ff81511e00aef31e8fda705be3df074ece6)

Change-Id: I65ea833ac6fe7a75ebe546cfa358c4cffdf2de05
2017-07-13 16:43:34 +09:00
Hugo Benichi
531cae76fd Merge "Add first OWNERS files for core networking"
am: 4066930a36

Change-Id: Ib8e1b85be03ad5e75a89a7951a59b9bc2a04d112
2017-07-12 03:54:57 +00:00
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