340 Commits

Author SHA1 Message Date
TreeHugger Robot
412d7631e5 Merge "Determine the multipath hint from data usage." 2018-01-25 03:49:19 +00:00
Nathan Harold
41002e3080 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
Change-Id: If5fc63e9ad8b9b2d4c2fee47ff4bab2ab190a05a
(cherry picked from commit bd4093be7cab51d6ad031854324134a9c8637c2c)
2018-01-24 10:26:04 -08:00
Lorenzo Colitti
d260ef2b30 Determine the multipath hint from data usage.
Bug: 35142602
Test: builds, boots
Change-Id: I0f5de5e313ead442aa210f163db035fcf7de5e73
2018-01-25 01:25:09 +09:00
Chalard Jean
918a68b3ca Move constants into a new file.
Also audit all constants, make some private, annotate some
with @VisibleForTesting.

Test: runtest framework && cts
Change-Id: Iaf5ea7abd36fd8d544dcc84654f6cb529196d654
2018-01-23 21:38:00 +09:00
Erik Kline
be83aebfeb Move DhcpClient SM thread onto IpClient's SM thread
Test: as follows
    - built
    - flashed
    - booted
    - runtest frameworks-net passes
    - basic wifi usage nominal
Bug: 62476366
Change-Id: I9a74e001bc86972e31b7e0898711628e65d9cf7a
2018-01-11 12:48:08 +09:00
Erik Kline
8bd00d5f7c Refactor to InterfaceParams utility class
NetworkInterface throws Exceptions every time you look at it askance.
Try to make something we instantiate fully, once, and pass it around.

Partial MacAddress-ification as well, for good measure.

Test: as follows
    - built
    - flashed
    - booted
    - runtest frameworks-net passes
    - basic IPv6 tethering works
Bug: 32163131
Bug: 62476366
Change-Id: I16c145fddb4e76387370338d792a438eed886d7f
2018-01-11 09:47:40 +09:00
Erik Kline
e8a4cb13e9 Merge "Revert "Send empty LinkProperties when entering StoppedState."" 2017-12-15 07:09:24 +00:00
Erik Kline
652044a7db Revert "Send empty LinkProperties when entering StoppedState."
This reverts commit 94209ab7686b202cfad6e42e07056bb9511006a8.

Reason for revert: should not have auto-submitted prior to more extensive wifi team testing.

Change-Id: Ie81b10473caf34971226948038bc20dc4fa6a1ae
2017-12-15 06:36:50 +00:00
Treehugger Robot
5557fe3e2d Merge "Send empty LinkProperties when entering StoppedState." 2017-12-15 06:29:15 +00:00
Hugo Benichi
959ee4a7b1 Extend connectivity OWNERS
Also remove 'build.master@android.com' which is deprecated, not
declared by anybody else, and makes the linter unhappy.

Bug: 70394432
Test: built
Merged-In: I9c0ba41386129379f82259fcc5e745562b014fae

(cherry pick from commit 626eed2ac826a34b3ac9b1d4ddb9a783222187ec)

Change-Id: Ie802113d61f693d73f7234b44ac2a9bd462b3fbf
2017-12-14 09:56:56 +09:00
Erik Kline
94209ab768 Send empty LinkProperties when entering StoppedState.
Additionally, no longer try to transition from within a State's
enter() method (this can encounter Log.wtf()s). Introduce some
CMD_JUMP_* commands and use deferMessage().

Test: as follows
    - built
    - flashed
    - booted
    - runtest frameworks-net passes (except for IpConnectivityMetricsTest failures)
    - manual changing from DHCP to static configurations works:
  2017-12-11T19:06:19.082 - INVOKE onLinkPropertiesChange({{InterfaceName: wlan0 LinkAddresses: []  Routes: [] DnsAddresses: [] Domains: null MTU: 0}})

Bug: 69800563
Bug: 70394432
Change-Id: Ice249a48b66806c0270ec3f11dd2e8e387d4e29b
2017-12-13 12:13:36 +09:00
Colin Cross
5319777274 Merge "Convert services to Android.bp" 2017-12-12 23:25:09 +00:00
Colin Cross
eb652a47a1 Convert services to Android.bp
See build/soong/README.md for more information.

Test: m checkbuild
Change-Id: I417409281c928ea667d937090d2a0d9d72a449a2
Merged-In: I417409281c928ea667d937090d2a0d9d72a449a2
Exempt-From-Owner-Approval: trivial conversion
(cherry-picked from commit e0b2ee52d2f274a2d46b2e6695e42d2764c39fa7)
2017-12-12 23:22:25 +00:00
Treehugger Robot
e339662247 Merge "Revert "Send empty LinkProperties when entering StoppedState."" 2017-12-09 01:34:07 +00:00
Roshan Pius
f1967c4125 Revert "Send empty LinkProperties when entering StoppedState."
This reverts commit b3f9f4a30502477e71fc93037dc58080fddb1853.

Reason for revert: Crash in WifiStateMachine (b/70394432)

Change-Id: I3a96c822eddcebcdd6621cee878b865171d094e8
2017-12-08 22:29:50 +00:00
Treehugger Robot
b501e7e25b Merge "Refactor to IpNeighborMonitor and single-threaded semantics" 2017-12-08 05:44:26 +00:00
Erik Kline
84714bffa1 Refactor to IpNeighborMonitor and single-threaded semantics
IpReachabilityMonitor (and IpNeighborMonitor) are only accessed from
the IpManager StateMachine's thread. Consequently lots of locking can
now be removed.

Additionally:
    - rename BlockingSocketReader to PacketReader
    - incorporate IpReachabilityMonitor output in dump()

Test: as follows
    - runtest frameworks-net passes
    - "adb shell ip neigh change <address> dev wlan0 nud failed"
      triggers wifi to disconnect
Bug: 62476366
Bug: 67013397
Change-Id: I18aca29ae0019a72a7e559c2832e0d9b0e33d81e
2017-12-08 11:12:05 +09:00
Erik Kline
b3f9f4a305 Send empty LinkProperties when entering StoppedState.
Test: as follows
    - built
    - flashed
    - booted
    - runtest frameworks-net passes
    - changing from DHCPv4 to static while continuously pinging the
      default gateway works jsut fine
    - dumpsys log shows that during the change we send the empty LP:
  12-06 08:46:51.085 - CMD_ON_QUIT wlan0/23 0 0 null [rcvd_in=StoppingState, proc_in=StoppingState]
  12-06 08:46:51.092 - INVOKE onLinkPropertiesChange({{InterfaceName: wlan0 LinkAddresses: []  Routes: [] DnsAddresses: [] Domains: null MTU: 0}})

Bug: 69800563
Change-Id: I01047e9a72fce718a167c592bf14406c3bab3ba9
2017-12-07 18:07:38 +09:00
Hugo Benichi
7216636a62 Refactor ApfFilter creation
This patch introduces a helper ApfConfiguration class for passing filter
parameters to the constructor of ApfFilter. The benefits are:
  - less parameter boilerplate across IpManager, ApfFilter, ApfTest
  - easier to add more parameters in the future (useful for hardware
    counters options and further gservices configurable options)

There is no functional changes otherwise.

Test: runtest frameworks-net
Change-Id: I47231c21df80bc36b6d4e15369748017b50b8da1
2017-11-07 21:42:39 +09:00
Erik Kline
22526e0139 Rename withIPv6AddrGenMode{Type}() methods to using{Type}MacAddress()
Callers of IpClient can tell it via the Builder whether a stable or
a random link-layer identifier is used.  IpClient will make the
appropriate IP-layer adjustments (for now this means RFC 7217
addresses or not).

Test: as follows
    - built
    - flashed
    - booted
    - runtest frameworks-net passes
    - ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh runs as well
      as possible on AOSP (no new errors)
Bug: 62476366
Change-Id: Ic9d52ea4f2c6c3588852ed41c81f8664d5cc298a
2017-11-05 15:34:08 +09:00
Erik Kline
5526d44916 Remove unused method on VersionedBroadcastListener
Test: as follows
    - built
    - flashed
    - booted
    - runtest frameworks-net passes
    - manually enabling USB tethering toward Wi-Fi worked
Bug: 32163131

Change-Id: I38e4b77a7d59584ebeb450ebe5a9dcbcb36f4fa1
2017-10-27 14:17:04 +09:00
Erik Kline
de63772eff Switch to listening for CarrierConfig changes for provisioning rechecks
This change switches the signal used for provisioning rechecks from:

    ACTION_SIM_STATE_CHANGED

to:

    ACTION_CARRIER_CONFIG_CHANGED

Additionally:
    - reexamine carrier config overrides during provisioning re-checks
      (this just was never happening before).
    - refactor shared code out to VersionedBroadcastListener

Test: as follows
    - built
    - flashed
    - booted
    - runtest frameworks-net
Bug: 63400667
Bug: 67755969
Change-Id: Ib9d222eb7ca0e0dd988a1bd97ab32059189ada2c
2017-10-20 19:56:27 +09:00
Treehugger Robot
5c7128c070 Merge changes I3b56e75d,I36255a2c
* changes:
  Skeletal IpManager proxying to the new IpClient
  Rename IpManager to IpClient
2017-10-20 02:29:41 +00:00
Erik Kline
6d8b80a5b9 Skeletal IpManager proxying to the new IpClient
Test: as follows
    - built
    - flashed
    - booted
    - runtest frameworks-net passes
    - both wifi and ethernet connectivity works
Bug: 62476366

Change-Id: I3b56e75d545594b88849a621e4ae09f2e1d45c69
2017-10-19 12:37:58 +09:00
Erik Kline
1b2935806f Rename IpManager to IpClient
Test: as follows
    - built
    - flashed
    - booted
    - runtest frameworks-net passes
Bug: 62476366
Change-Id: I36255a2c8e1a2f52693716b445359cce0b4304af
2017-10-19 12:37:58 +09:00
Tobias Thierer
6217e37d30 Framework: Prefer android.system.Os over libcore.io.Libcore.os
This is a pure refactoring with no a behavior change other than
that these calls now go through android.system.Os, which immediately
delegates to Libcore.os.

This is a first step towards separating framework (via
android.system.Os) vs. libcore (via Libcore.os) clients of these
low level APIs. Separating these is a prerequisite towards moving
the API parts of android.system into framework, and moving the
rest into a different package in libcore.

Test: Treehugger
Bug: 67901714

Change-Id: Ifd8349ec5416e5693f40dba48fdf2bef651b7d81
Merged-In: Ifd8349ec5416e5693f40dba48fdf2bef651b7d81
2017-10-18 14:53:57 +01:00
Treehugger Robot
ed0b030e17 Merge "IpManager: add display name for helpful logging, and Network" 2017-10-11 12:42:41 +00:00
Erik Kline
e42502d2bb IpManager: add display name for helpful logging, and Network
Test: as follows
    - built
    - flashed
    - booted
    - runtest frameworks-net passes
Bug: 62476366
Change-Id: I509506814fa704e54f3d67158203276312a24fa1
2017-10-11 19:48:40 +09:00
Erik Kline
126171b2cc Log upstream network suspend/resume callbacks
Also log signal strength while we're at it:

    2017-10-10T14:05:00.968 - [UpstreamNetworkMonitor] preferred upstream type: WIFI
    2017-10-10T14:06:07.654 - [UpstreamNetworkMonitor] upstream network signal strength: -62 -> -67
    2017-10-10T14:06:13.704 - [UpstreamNetworkMonitor] upstream network signal strength: -67 -> -64

Test: as follows
    - built
    - flashed
    - booted
    - runtest frameworks-net passes
Bug: 29337859
Bug: 32163131
Bug: 64976634
Bug: 67396342

Merged-In: I9121798bba0be9dcdf1e45d39c092020620fa53b
Merged-In: I1d3420380691efd886315275598134b98f4041ed
Change-Id: Id6e143edc9f5b0256aa637643680f6c8dce70d90
(cherry picked from commit 60caf7d29132262dd4a077b68daa807d22773524)
2017-10-11 11:37:45 +09:00
Chalard Jean
e5659bd316 Add some useful helpers and constants.
Test: Pulled out of a client app ; the client app is behaving
Test: identically to how it was behaving before. Wrote unit
Test: tests in frameworks-net.

Change-Id: I397137748a95c65cee2e1e1b243a1a260e83a6f7
2017-10-06 13:38:46 +09:00
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