History log of /system/connectivity/shill/connection.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
9429723aad30865ab4604a6074dece9c6d45c0cc 07-Oct-2015 Peter Qiu <zqiu@google.com> Mock out DNSServerProxy in unittest

Use a factory for DNSServerProxy creation, so that it can be easily
mocked out in the unittest.

Bug: 24711640
TEST=weave setup still works on dragonboard
TEST=ConnectionTest.* passed on dragonboard
TEST=Run unittest for Chrome OS

Change-Id: Ib03029a00b21ff3f6c4fd47dcbd1df8010bc0f05
/system/connectivity/shill/connection.h
d5d3482e261beaee1a13622143d4abf728165fb9 01-Oct-2015 Peter Qiu <zqiu@google.com> Support DNS server proxy on Android

There is no support for /etc/resolv.conf on Android, so a DNS
server proxy is needed to handle/redirect client DNS requests.
dnsmasq will be used to setup as a DNS server proxy, and it will
run under the "system" user.

Also add a special handling for the case when DHCP doesn't provide
DNS server addresses. We will default to use Google's DNS server
addresses in this case.

Not sure why we never had a problem with this scenario on Chrome OS,
so make this handling Android specific for now.

TODO: update connection_unittest.cc for Android.

Bug: 24543278
TEST=Manual test on dragonboard (ping to well known hosts)

Change-Id: I4573546a9987b1148a9c0e6157155a232be4f168
/system/connectivity/shill/connection.h
a330ecd23b1ce4112fd7a28f4b2a062b8df10735 02-Sep-2015 Peter Qiu <zqiu@google.com> shill: rename PermissionBrokerProxyInterface to FirewallProxyInterface

Use FirewallProxyInterface to abstract firewall functionalities. This
allows us to use different implementations (permission_broker or
firewalld) based on the target platform.

BUG=b:23756495
TEST=unittest

Change-Id: Ieeb0a56ce22efeebf3db9c775678bab1aeeea05d
Reviewed-on: https://chromium-review.googlesource.com/296833
Commit-Ready: Zeping Qiu <zqiu@chromium.org>
Tested-by: Zeping Qiu <zqiu@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5 03-Sep-2015 Peter Qiu <zqiu@google.com> License shill to Apache2

This patch automatically replaced the license on all text files from
Chromium OS (BSD style) to AOSP (Apache2), keeping the original year as
a reference.

The license header was added to .gyp and .gypi, the NOTICE was added with a copy
of the Apache2 license and MODULE_LICENSE_* file was added.

BUG=23587594
TEST=grep 'Chromium OS Authors' doesn't find anything.

Change-Id: If41ede586c2465f5831fb7fee270ff41dbfdb596
/system/connectivity/shill/connection.h
1b9546a8770b80edb45126691977121c4663cb53 30-Jun-2015 Samuel Tan <samueltan@chromium.org> shill: add ConnectionDiagnostics class

Add the ConnectionDiagnostics class to shill, which
performs connectivity-related tests to diagnose problems
that a given connection has reaching a specific URL.
The logic used for diagnostics is similar to that
used in the crosh network_diag script.

BUG=chromium:216691
TEST=Compile shill and run unit tests.

Change-Id: I024c7110b2073205a25189edc211023f29685a9c
Reviewed-on: https://chromium-review.googlesource.com/283505
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Samuel Tan <samueltan@chromium.org>
Commit-Queue: Samuel Tan <samueltan@chromium.org>
/system/connectivity/shill/connection.h
608ec29525f553d51f0a92e84176e3d4b45930a9 31-Jul-2015 Peter Qiu <zqiu@chromium.org> shill: use ControlInterface to create proxy objects

So that appropriate proxy objects can be created based on the type of
the control interface.

While there, remove ProxyFactory related files.

BUG=chromium:513791
TEST=USE="asan clang cellular wimax dhcpv6" FEATURES=test emerge-$BOARD shill

Change-Id: I465b0807ab4ccacac3891638db41384f43ef83c5
Reviewed-on: https://chromium-review.googlesource.com/289855
Reviewed-by: Zeping Qiu <zqiu@chromium.org>
Commit-Queue: Zeping Qiu <zqiu@chromium.org>
Tested-by: Zeping Qiu <zqiu@chromium.org>
/system/connectivity/shill/connection.h
c8fab0c129ea3e55fd89719f6e16c78ca505e05c 29-Jul-2015 Paul Stewart <pstew@chromium.org> shill: Connection: Fix gateway reachability using link routes

Previously, in order to fix reachability to a default gateway
(in order to apply a gateway default route), shill used one
of two methods:

- Open up the prefix assigned to the local address until
both the host and gateway were in the same broadcast
domain.
- Add the gateway as a peer address for the interface.

Although this works well in most situations, there are cases
where it doesn't work as well. Specifically, modifying the
prefix may prevent the local host from reaching other peers
that are really not on the same broadcast domain.

Instead of modifying the prefix, this new change adds a
link-scoped route to the gateway. The host acts identically
(ARPs for the gateway IP address locally), but since the
prefix is preserved, it sends traffic to all other addresses
outside the provided prefix through the gateway.

BUG=chromium:515156
TEST=Unit tests + manual -- trigger this code by forcing /32 prefix

Change-Id: I71e33b6ed0dfe74e069376ab8bd5710f7d30b4bd
Reviewed-on: https://chromium-review.googlesource.com/289599
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: Andrey Ulanov <andreyu@google.com>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
a794cd60a7339d576ea2eed263a4f0a20fb255af 16-Jun-2015 Paul Stewart <pstew@chromium.org> shill: Top-level files a-e: Switch pointer/ref spacing

Switch to Chrome style spacing.

BUG=chromium:501026
TEST=Unit tests

Change-Id: Idb7252202e142098999fe0672712aded7d369259
Reviewed-on: https://chromium-review.googlesource.com/278038
Reviewed-by: Rebecca Silberstein <silberst@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
77e768323e57058b4660bb72ba2544a1cbe6d435 13-Feb-2015 Prabhu Kaliamoorthi <kaliamoorthi@chromium.org> shill: Setup Iptable entries for ThirdPartyVpn using PermissionBroker

This CL makes shill setup iptables entries to mark traffic from user
dynamically using a proxy to permission broker.

BUG=chromium:458075
TEST=Manual testing
CQ-DEPEND=CL:249140

Change-Id: Ic376c67b588ae0f82abeb6b7fab31051cd6d08a4
Reviewed-on: https://chromium-review.googlesource.com/250290
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Prabhu Kaliamoorthi <kaliamoorthi@chromium.org>
Commit-Queue: Prabhu Kaliamoorthi <kaliamoorthi@chromium.org>
/system/connectivity/shill/connection.h
762bfb8ab200a387fe732ec92423a5f0afe11bcf 06-Feb-2015 Prabhu Kaliamoorthi <kaliamoorthi@chromium.org> shill: Add support in shill to route selected traffic to ThirdPartyVpn

This CL adds capability to shill deamon to route selected network
traffic to ThirdPartyVpn by using multiple routing tables.

It further enables a list of IP blocks in CIDR notation to be excluded
from the VPN traffic rather than a single trusted_ip. The existing
trusted_ip mechanism to do this is removed to avoid redundant approaches
to solve the same problem.

Third party VPN driver is modified to make use of the new interfaces to
exclude and include a list of IP blocks in CIDR format from the VPN
traffic.

BUG=chromium:407541
TEST=Unittests and manual testing

Change-Id: Id185d3e9bf91d018b55899adaa562d3192d261cf
Reviewed-on: https://chromium-review.googlesource.com/247030
Commit-Queue: Prabhu Kaliamoorthi <kaliamoorthi@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Prabhu Kaliamoorthi <kaliamoorthi@chromium.org>
/system/connectivity/shill/connection.h
024a6c80bc8474d828af6d961ea7fe0d67d69587 23-Jan-2015 Paul Stewart <pstew@chromium.org> shill: Connection: Apply connection MTU

Honor the "mtu" field in IPConfig::Properties by applying this
MTU to the interface. Apply a default MTU to interfaces that
do not specify one, and a minimum MTU if the supplied MTU will
not work for the connected IP configuration.

BUG=chromium:450759
TEST=Unit tests, Upcoming test network_DhcpMTU (CL:243315)

Change-Id: Ie7abf937b8475d43e5a77bf9f27ec58a5433fc2a
Reviewed-on: https://chromium-review.googlesource.com/243370
Reviewed-by: Prabhu Kaliamoorthi <kaliamoorthi@chromium.org>
Reviewed-by: Zeping Qiu <zqiu@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
2cb3fa7317cfa3248cff72d0b9d64c4f2f630472 13-Nov-2014 Paul Stewart <pstew@chromium.org> shill: Device: Support same-net multi-homing

When two interfaces are connected to the same subnet, two
components of ChromeOS system behavior conspire to produce
surprising results. First, the default Linux network behavior
induces the "ARP Flux" effect where the system replies to
ARPs interchangably for both interfaces. Secondly, reverse-
path filtering (setup by default in shill) causes only one
network interface to be able to receive packets for a given
subnet at a time.

This CL adds code to recognize situations where more than
one interface is connected to the same subnet. In such
situtations reverse-path filtering is disabled and ARP
filtering is enabled. This requires the driver to keep
track of the requested reverse-path filtering state.

BUG=chromium:430041
TEST=Unit tests + manual:

(1) Attach both WiFi and Ethernet, but to _different_ IP
networks (subnet addresses should be different). Run
"sysctl -a | egrep '(rp_filter|arp_announce|arp_ignore)'".
Output should be something like:

net.ipv4.conf.all.arp_announce = 0
net.ipv4.conf.all.arp_filter = 0
net.ipv4.conf.all.arp_ignore = 0
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.arp_announce = 0
net.ipv4.conf.default.arp_filter = 0
net.ipv4.conf.default.arp_ignore = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.eth0.arp_announce = 0
net.ipv4.conf.eth0.arp_filter = 0
net.ipv4.conf.eth0.arp_ignore = 0
net.ipv4.conf.eth0.rp_filter = 1
net.ipv4.conf.lo.arp_announce = 0
net.ipv4.conf.lo.arp_filter = 0
net.ipv4.conf.lo.arp_ignore = 0
net.ipv4.conf.lo.rp_filter = 1
net.ipv4.conf.wlan0.arp_announce = 0
net.ipv4.conf.wlan0.arp_filter = 0
net.ipv4.conf.wlan0.arp_ignore = 0
net.ipv4.conf.wlan0.rp_filter = 1

In other words, rp_filter is enabled on all interfaces,
and arp_filter / arp_ignore are left as default.

(2) Attach both WiFi and Ethernet to the same router. Run
"sysctl -a | egrep '(rp_filter|arp_announce|arp_ignore)'".
Output should be something like:

net.ipv4.conf.all.arp_announce = 0
net.ipv4.conf.all.arp_filter = 0
net.ipv4.conf.all.arp_ignore = 0
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.arp_announce = 0
net.ipv4.conf.default.arp_filter = 0
net.ipv4.conf.default.arp_ignore = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.eth0.arp_announce = 2
net.ipv4.conf.eth0.arp_filter = 0
net.ipv4.conf.eth0.arp_ignore = 1
net.ipv4.conf.eth0.rp_filter = 2
net.ipv4.conf.lo.arp_announce = 0
net.ipv4.conf.lo.arp_filter = 0
net.ipv4.conf.lo.arp_ignore = 0
net.ipv4.conf.lo.rp_filter = 1
net.ipv4.conf.wlan0.arp_announce = 2
net.ipv4.conf.wlan0.arp_filter = 0
net.ipv4.conf.wlan0.arp_ignore = 1
net.ipv4.conf.wlan0.rp_filter = 2

In other words, rp_filter is set to "loose mode" on WiFi
and Ethernet. arp_filter and arp_ignore are also enabled
on those interfaces.

Change-Id: Id19e5b7101ba70f94aaa51b3ad6cc163a4bc0005
Reviewed-on: https://chromium-review.googlesource.com/229696
Reviewed-by: Will Drewry <wad@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
8d6b59704591ba9fad57751858835dc332dbdd37 28-Oct-2014 Peter Qiu <zqiu@chromium.org> shill: export a shared library for RTNL interface.

Export a shared library "libshill-net-<(libbase-ver)" from shill, which
currently includes the RTNL interface and other codes that it depends on
(mainly ByteString, IPAddress, IOHandler, TimeStamp, and Sockets). All the
library codes are moved to under "shill/net/".

Upcoming changes:
- Remove dependency for "shill/error.h" which depends on dbus-c++.
- Add Netlink interface to the shared library.

BUG=chromium:427982
TEST=unittests
CQ-DEPEND=CL:226103

Change-Id: I7f5c183b8a347c02e80ffed5e3497f691dde517c
Reviewed-on: https://chromium-review.googlesource.com/226110
Reviewed-by: Peter Qiu <zqiu@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
/system/connectivity/shill/connection.h
cc225ef3b77b5e098cc12c661a947e1737480777 30-Sep-2014 Ben Chan <benchan@chromium.org> shill: Replace NULL with nullptr.

BUG=None
TEST=`USE=wimax FEATURES=test emerge-$BOARD shill`

Change-Id: I30ab47ff32dcadad09ae7a2baf4d4123a6ef0d8e
Reviewed-on: https://chromium-review.googlesource.com/220657
Reviewed-by: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
/system/connectivity/shill/connection.h
f3a8f9064976d12c4f8ed3c6a5cc9ea4655c686d 20-Aug-2014 Peter Qiu <zqiu@chromium.org> shill: Add IPv6 connection support.

Added support to shill for it to be able to complete portal detection
using IPv6 connection. The IPv6 support is added to AsyncConnection,
DNSClient, and HTTPRequest.

BUG=chromium:394010
TEST=unit tests, manual test with future CL that initiate IPv6 portal
detection.

Change-Id: I20b768211f3ecfcd53406805038c0490a488ee78
Reviewed-on: https://chromium-review.googlesource.com/213273
Reviewed-by: Peter Qiu <zqiu@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
/system/connectivity/shill/connection.h
7fab89734d88724a288e96a9996b15548c5294c7 11-Aug-2014 Ben Chan <benchan@chromium.org> shill: Use integer types from stdint.h

This CL replaces the deprecated int* and uint* types from
'base/basictypes.h' with the int*_t and uint*_t types from 'stdint.h'.

BUG=chromium:401356
TEST=`USE='cellular gdmwimax wimax' FEATURES=test emerge-$BOARD platform2`

Change-Id: I3d4c195881203dd2a47dbb5af150b6c90b9c206e
Reviewed-on: https://chromium-review.googlesource.com/211770
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
/system/connectivity/shill/connection.h
a89154bfedfd8872242083ffe4f084fdc774c078 24-May-2014 Peter Qiu <zqiu@chromium.org> shill: Support of DNS auto fallback

Automatically switch to fallback DNS server when broken DNS setting
is detected. This feature is disabled by default (due to property
defaulting to "false").

BUG=chromium:377056
TEST=unit tests, manual test
1. Manually update the code to allow DNS auto fallback.
2. Connect a chrome device to GoogleGuest.
3. Update the name servers setting to an invalid
DNS server "192.168.1.1"
4. Browse to "chrome://net-internals/#dns", and verify
the nameserver changed from "192.168.1.1" to Google's
DNS servers "8.8.8.8" and "8.8.4.4" within a minute.
CQ-DEPEND=CL:201412

Change-Id: I31dbaf715b5b11dd2f736e0664ee432e55bdeeb9
Reviewed-on: https://chromium-review.googlesource.com/207155
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
/system/connectivity/shill/connection.h
c45688bb3881f0c2216e6ec0e19ebda0be33e871 03-Jul-2014 Ben Chan <benchan@chromium.org> shill: Fix header guards to conform to coding style.

BUG=chromium:385849
TEST=Tested the following:
1. `USE='cellular wimax' FEATURES=test emerge-$BOARD platform2`
2. `cpplint.py --filter=-build/include_order shill/*.h` reports no
'build/header_guard' issue.

Change-Id: I1a3972a1f88e5001550eccd561633bd4e5c5faba
Reviewed-on: https://chromium-review.googlesource.com/206680
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
/system/connectivity/shill/connection.h
7f5d9c0847d08ff4cd1fc7c0c8ae4117421e75c8 04-Dec-2013 Paul Stewart <pstew@chromium.org> shill: VPNService: Report Tethering state

Services should store a copy of their tethering state in the
connection. VPNService should use this stored state to report
the underlying connection's tethering state in response to
queries of the VPNService's own Tethering property.

BUG=chromium:323010
TEST=Unit tests

Change-Id: Idf0a8a6265c9cf78af00da00d638cda37b708fcc
Reviewed-on: https://chromium-review.googlesource.com/178720
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
fddc09ac26ba77cabb59810f01b705fca2efd10b 04-Jul-2013 Alex Deymo <deymo@chromium.org> Export the Physical Technology of a VPN service.

Exposes the Type of the lowest service used for a VPN service
through the "PhysicalTechnology" property of a VPN service.

TEST=cros_workon_make shill --test and tested manually.
BUG=chromium:213086

Manual Test procedure.
1. Connect to a wifi network.
2. Connect to a VPN service on that wifi network.
3. Run /usr/local/lib/flimflam/test/list-services on a terminal
and verify the first service on its output contains a service with
a Type "vpn" and a PhysicalTechnology "wifi":

[ /service/6 ]
...
Type = vpn
...
PhysicalTechnology = wifi

Change-Id: Ic843429de3f4d5a4208e271bb779c3e3160f036b
Reviewed-on: https://gerrit.chromium.org/gerrit/61510
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
/system/connectivity/shill/connection.h
23ac6b72d44c446bca88175883ba26b39c5ed817 01-Feb-2013 mukesh agrawal <quiche@chromium.org> shill: Revert "shill: resolver: Use (even) smaller DNS timeout"

The short DNS timeout was intended to work around an issue with
some DNS servers. The belief was that the DNS failure was
transient, and that a quick retry would improve DNS lookup times.

Field results didn't show any improvement, so back out this change.

Note further that, as of M25 stable, Chrome uses its own DNS
resolver. That resolver has a fixed one second timeout for the
first try, and exponential backoff thereafter.

Consequently, if this code remained in the tree, this code would
only affect system processes.

BUG=chromium:220150
TEST=unit tests

This reverts commit bf667617d573e3af4b808ed317b1d6ca04747ee4.

Conflicts:

connection.cc
connection_unittest.cc
default_profile_unittest.cc
manager.cc
manager.h
mock_resolver.h
resolver.cc
resolver.h
resolver_unittest.cc

Change-Id: Ic96c6c014a973de441ab1771539a0d9f3d5c5967
Reviewed-on: https://gerrit.chromium.org/gerrit/46944
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/connection.h
73fcc3f6560240d0d5dde15927cc0b51dc692dd5 25-Feb-2013 Paul Stewart <pstew@chromium.org> shill: Connection: Correct routability to trusted IP

In order to send outgoing traffic in a point-to-point network
bundled within a VPN to a trusted peer IP address, the gateway
IP address isn't of significance. As opposed to broadcast
networks, in the inner point-to-point network we never ARP for
the gateway IP address, but just send the IP packet addressed
to the recipient. As such, since using the external trusted
IP address as the gateway or peer wreaks havoc on the routing
rules, we remove the gateway address altogether and rely on
an interface-based route across the point-to-point link.

BUG=chromium-os:37765
TEST=Unit tests, run with Cisco-ASA (for regressions -- does
not work any worse with current configuraton; confirmed via
packet trace that output packets are encapsulated currectly
within L2TP/PPP/ESP), and IP address is set as explained above.
Also connect to customer VPN network which started the bug
above and verified end-to-end connectivity (http transfer).

Change-Id: I9dd4de28464777663da11e9f731a5746d2eebb7c
Reviewed-on: https://gerrit.chromium.org/gerrit/43927
Tested-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
df3c0a897bc74cb3a9800332b8359a364ca2f753 10-Nov-2012 Paul Stewart <pstew@chromium.org> shill: Service: Sort services based on dependency

If one connected service depends on another for connectivity,
it should be sorted first, overriding technology and priority
ordering. We evaluate this by using the "Lower binder" property
of the service's connection, which is currently the case for
VPNs connections to indicate what underlying link is used. It does
not make sense for a VPN service to be ranked at a lower priority
than its underlying technology, since the fact that it is connected
implies that the VPN is meant to be applied to it.

BUG=chromium-os:36231
TEST=Unit tests.

Change-Id: I74ee5d1213141db2c6a124ed44717c848a0e2701
Reviewed-on: https://gerrit.chromium.org/gerrit/37774
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
a016312b7470e124774aec197e3b43bc795637c3 26-Sep-2012 Ben Chan <benchan@chromium.org> shill: vpn: Create a IPv6 blackhole route for IPv4 L2TP/IPsec VPN.

BUG=chromium-os:34383
TEST=Tested the following:
1. Build and run unit tests.
2. Manually test IPv4 LT2P/IPsec VPN on an network interface with IPv4
and IPv6 addresses as follows:
- Before connecting to the VPN, run `ip -6 route` to verify that no
blackhole route exists. Confirm via http://ipv6test.google.com that
IPv6 connectivity is available.
- After connecting to the VPN, run `ip -6 route` to verify that the
blackhole route is installed. Confirm via
http://ipv6test.google.com that IPv6 connectivity is not available.
- After disconnecting from the VPN, run `ip -6 route` to verify that
no blackhole route exists. Confirm via http://ipv6test.google.com
that IPv6 connectivity is available.

Change-Id: I7ae4fab5319b5f06a6a3f5a28f439551f2825044
Reviewed-on: https://gerrit.chromium.org/gerrit/34053
Commit-Ready: Ben Chan <benchan@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
/system/connectivity/shill/connection.h
6f65c0b387f6dde8113f52745b758ca1c4f349be 11-Sep-2012 Paul Stewart <pstew@chromium.org> shill: Connection: Don't call Resolver::SetDNSFromIPConfig

Don't ever call this function (in fact, remove this from the
resolver), and refactor the code that correctly generates the
DNS search list so that it is usable both from
Connection::UpdateFromIPConfig() and from void
Connection::SetIsDefault().

BUG=chromium-os:34260
TEST=Rerun unit tests + Manual: Connect to AP that supplies only
"DomainName", and ensure that /etc/resolv.conf contains this domain
in the search field both initially and after DHCP renewal.

Change-Id: I9a0705cb54e6588915533cc343b05efcdee71293
Reviewed-on: https://gerrit.chromium.org/gerrit/32996
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
d62d6035f45ab5caf04a558a70fbc78457775f97 11-Sep-2012 Paul Stewart <pstew@chromium.org> shill: Connection: Do non-empty tests independently for DNS search

Before this change, the DNS domain search was overridden if the
DNS server paramater was non-empty. Change this so that it is
only overridden if the derived DNS domain search list is non-empty.
This is due to reports that on DHCP renewal some servers return
a non-empty server list but do not renew the DNS domain value.

BUG=chromium-os:34260
TEST=Rerun unit tests.

Change-Id: I0f95808011e13095e467c1440dce7a13059075ad
Reviewed-on: https://gerrit.chromium.org/gerrit/32952
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
ff845fc996d6742c9ce2d0cd1939745e7034411f 07-Aug-2012 Paul Stewart <pstew@chromium.org> shill: LinkMonitor: Add Metrics

BUG=chromium-os:32600
TEST=Unit tests

Change-Id: I4a7625fb006e939a5ea63efeede8ca9982115332
Reviewed-on: https://gerrit.chromium.org/gerrit/29421
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
bf667617d573e3af4b808ed317b1d6ca04747ee4 29-Jun-2012 Paul Stewart <pstew@chromium.org> shill: resolver: Use (even) smaller DNS timeout

Use the new glibc facility for sub-second timeouts, and choose
300 milliseconds for the timeout. However, only do this by
default for Ethernet and WiFi networks, since VPN networks
in particular have trouble with this configuration (due to many
name servers and search domains, as well as the additional
latency inherent to such networks). Also, increase the number
of attempts, so we still spend a reasonable amount of time
overall waiting for a DNS response.

Provide a means to change which technologies are setup in this
manner.

BUG=chromium-os:29124
TEST=Manual: Install connection manager, verify via strace that
gethostbyname now waits 300 ms, and retries 15 times per trial (*).
Ensure Chromium continues to work correctly under light loads.
Also, connect via Verizon and VPN and ensure DNS parameters
are back to the long timeout.
List manager properties and ensure it says "ethernet,wifi" for
ShortDNSTimeoutTechnologies and that this is saved out to the
profile.
New unit tests.
CQ-DEPENDS=Ib9ffc59bbfcd5bf3f57d146965c5a43a936348f8

*: Each trial consists of a nameserver / IP address pair, so
for example, if we have IPv6 connectivity and have two "server"
entries in resolv.conf, we first do 30 tries of IPv6 requests,
alternating between the two servers, then another 30 alternating
IPv4 requests between them. This was tested by intentionally
making the DNS server unreachable and instrumenting the gethostbyname
request via strace.

Change-Id: Idd331b4a9fcf96d457ab9959537aefcb86328e12
Reviewed-on: https://gerrit.chromium.org/gerrit/26493
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
6c72c972614285b2c01fb38afb2ffe06484a544a 27-Jul-2012 Paul Stewart <pstew@chromium.org> shill: LinkMonitor: Schedule periodic ARP requests

The LinkMonitor performs periodic unicast and broadcast ARP requests
for a connection's gateway IP address. It creates a weighted
average of response time, and can call a failure callback function
whenever the sum of consecutive unicast and broadcast response
failures exceed a threshold.

BUG=chromium-os:32600
TEST=Unit tests

Change-Id: Id5a66ad9ca80c51f227ef4811eb8c3885a70c1b8
Reviewed-on: https://gerrit.chromium.org/gerrit/28610
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
05a42c23f1d37daa8689fc4240034e62ed89f8fc 03-Aug-2012 Paul Stewart <pstew@chromium.org> shill: Connection: If IP Address changes, flush everything

If a new IP configuration arrives which changes the address
assigned to the family of this IPConfig, flush addresses
and routes before applying the new configuration. Otherwise,
we end up adding the new address inclusively as a secondary
IP address and userspace programs continue to use the old
address.

BUG=chromium-os:33066
TEST=New unit tests. Manual: Change DHCP server configuration,
unplug and replug to the same network. The old DHCP configuration
is loaded (since the lease is still valid and the gateway is
reachable) but when the new DHCP information arrives, ensure that
the new IP address (and only that address) is configured, and the
routes are sane (i.e., both LAN interface route and default route
exist).

Change-Id: Ic746368d97c503271995ff30b6818d770f4340c5
Reviewed-on: https://gerrit.chromium.org/gerrit/29170
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
4a6748d492214afcb7c484668fa8cfd3ad963f10 17-Jul-2012 Paul Stewart <pstew@chromium.org> shill: Connection: Create a link route if we are bound

Due to the behavior of some VPN servers, we may lose our route
to the default gateway of a physical interface due to the routes
assigned by a virtual interfaces. To avert this, set a host route
for the default gateway as we bind a lower connection.

BUG=chromium-os:32643
TEST=New unit tests; tried on a known-misbehaving net (actually
working from there right now); VPN autotests

Change-Id: I68db1da339f61c415f9ba8c2c26d8cdb0276b209
Reviewed-on: https://gerrit.chromium.org/gerrit/27705
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
4925829bd8be852a625086e3628a2fb89286ddd8 26-May-2012 Paul Stewart <pstew@chromium.org> shill: Connection: If gateway is unreachable, assume point-to-point

If the gateway address is still unreachable from the local address
after trying route expansion, assume that the network is point-to-point,
and specify the gateway as a peer.

BUG=chromium-os:31313
TEST=Modified unit tests (needs manual real-life testing)

Change-Id: Id396f721d897d031e59b2f820ec2156b054b81b9
Reviewed-on: https://gerrit.chromium.org/gerrit/23802
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
5eb0542cb67358d9030367498a4ad741fc42af4f 11-May-2012 Darin Petkov <petkov@chromium.org> shill: vpn: Disconnect VPN service when underlying connection disconnects.

BUG=chromium-os:30737,chromium-os:30774
TEST=unit tests, tested on device with 000OpenVPNGenesis

Change-Id: Ib350cb23edd3e68b3bd5390378789a6b60857b80
Reviewed-on: https://gerrit.chromium.org/gerrit/22461
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Darin Petkov <petkov@chromium.org>
/system/connectivity/shill/connection.h
ef1f9fec08b3a251a84ae3e4ef7ef15fdc2a1544 11-May-2012 Darin Petkov <petkov@chromium.org> shill: Use WeakPtr in Connection::Bind to avoid use of bare pointers.

BUG=chromium-os:27467
TEST=unit tests

Change-Id: Id27bb26b9a9c1ae1e44ac029b7fa4998faff62bb
Reviewed-on: https://gerrit.chromium.org/gerrit/22463
Commit-Ready: Darin Petkov <petkov@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Darin Petkov <petkov@chromium.org>
/system/connectivity/shill/connection.h
13e6d55b9dd86148ae68588f367c48e81ad33b74 09-May-2012 Darin Petkov <petkov@chromium.org> shill: Add a facility for objects to bind to connections.

The Connection::Binder class allows objects (e.g., connections,
devices, services) to bind to connections and get notified when the
bound connection is destroyed or disconnects. Use the Binder to bind
upper to lower connections. When the lower connection is destroyed or
disconnects, the upper connection notifies any objects that are bound
to it that it's also disconnected.

BUG=chromium-os:27467,chromium-os:30774
TEST=unit tests

Change-Id: I6773182314d429b4574c695cd6ef048080ed43ae
Reviewed-on: https://gerrit.chromium.org/gerrit/22235
Commit-Ready: Darin Petkov <petkov@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Darin Petkov <petkov@chromium.org>
/system/connectivity/shill/connection.h
53a303873f9a89ff0121777476d33afc9b77b987 26-Apr-2012 Paul Stewart <pstew@chromium.org> shill: connection: Fix FixGatewayReachability to handle P-t-P

...and add more thorough unit tests for it.

BUG=chromium-os:30052
TEST=New unit tests

Change-Id: Ic06ab2f84893e63f3b7d3f04c17f71ee4fa2d4b4
Reviewed-on: https://gerrit.chromium.org/gerrit/21202
Reviewed-by: Darin Petkov <petkov@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
10241e32c136ba99e7533ca1370e2e8eca241b7c 24-Apr-2012 Paul Stewart <pstew@chromium.org> shill: Add "IPConfig" property for Services

Add an IPConfig property to services so it can be directly referenced
here instead of indirectly through the device. A side effect of this
is that one can query the IPConfig RPCIdentifier for a VPN service
even though the device is not registered. While we are at it, fix
all the PropertyStore values to be read-only since we never want to
allow these fields to be modified on the IPConfig itself. Later we
will provide a method for individual IPConfig fields to be overridden
but these will be Service properties.

BUG=chromium-os:29540
TEST=Manual: Over DBus, ensure that IPConfig property points at a
readable IPConfig instance, both for OpenVPN, Ethernet and WiFi.
Ensure that in the Chrome UI, the "Network Info" is still available
(basically checking to make sure IPConfigs are still displayable
using the old method) even thought the parameters are now set to
be "Const".

Change-Id: Ib01297ef8dc9bec828ed57361873e9eebc0354bd
Reviewed-on: https://gerrit.chromium.org/gerrit/20983
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
e93b038972d43fd703b3c68603fb4d02bec6504e 24-Apr-2012 Paul Stewart <pstew@chromium.org> shill: Connection: UnPin routes on destruction

Tag pinned routes with the interface index associated with the request,
so they can be removed when the connection is destroyed. Also move
PinHostRoute() out of the VPN code and into the Connection.

BUG=chromium-os:29911
TEST=New unit tests

Change-Id: I46019255276469929642db4a6395e64f53e3b7d5
Reviewed-on: https://gerrit.chromium.org/gerrit/20982
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
5b7ba8c2e9e5ab5e67c68d0cde963141beb501d8 18-Apr-2012 Paul Stewart <pstew@chromium.org> shill: connection: Work around broken netmasks

It has been observed in the field that some network infrastructures
send a gateway/netmask pair that is inconsistent and prevents the
client from contacting the gateway. Work around this by expanding
the netmask, assuming that this parameter is incorrect. However,
use sane defaults for maximum expansion of the netmask, so that
we do not completely break things.

BUG=chromium-os:29416
TEST=New unit tests.

Change-Id: Id4730a8c1555fb09033175bdf2bfba1abe93a125
Reviewed-on: https://gerrit.chromium.org/gerrit/20465
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
e00600e1ec769b3acf0709e843c1f0ae73bd2fdb 16-Mar-2012 Paul Stewart <pstew@chromium.org> shill: connection: Allow missing broadcast

Teunnel interfaces do not have a broadcast address since they
are p-t-p. Hand the Connection object a technology identifier
so it can make such decisions. We may need to explore polymorphism
in the future if decisions of this sort become more prevalent.

BUG=chromium-os:27929
TEST=Unit tests

Change-Id: I1a81d010c60319015bf0ac690baf3edb62a39cdf
Reviewed-on: https://gerrit.chromium.org/gerrit/18361
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
f748a36f2cde2b1ac7fc543cc710c81cb431cc2f 07-Mar-2012 Paul Stewart <pstew@chromium.org> shill: Connection: Add facility to add host routes

This requires a facility for tracking outstanding RTNL route requests,
and adding routes when they the response arrives. A few small fixes
to RTNL handling needed to be added.

BUG=chromium-os:27483
TEST=New Unit Tests, manual: Assocated my new Neptune proto to test
network.

Change-Id: I701fa244041ad9e0d0a502a263d83792ab3c9114
Reviewed-on: https://gerrit.chromium.org/gerrit/17889
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
c681fa0742cabc686ccabaf0fdf6ce12dd7046b2 03-Mar-2012 Paul Stewart <pstew@chromium.org> shill: portal: Recheck portal state

Introduce a retry interval for automatically retrying portal
checks. Also provide a Manager API method for immediately
re-checking portal status.

BUG=chromium-os:27335
TEST=New unit tests, tested on real machine, including setting
PortaCheckInterval over DBus, and using Jason's addition to
test-flimflam for 'recheck-portal'.
Change-Id: Idc7def18c6f863859e94f4d4e9f266ab2670679c
Reviewed-on: https://gerrit.chromium.org/gerrit/17367
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
c8f4bef3c2a277d052f96ae06e67d3e7ab44a592 13-Dec-2011 Paul Stewart <pstew@chromium.org> shill: Enable and disable reverse-path filtering

When an http proxy request is active (as well as portal check, when
that gets written), we need to initiate connections over a non-default
network interface. For this we temporarily disable reverse-path
filtering on the interface during the duration of the request.

BUG=chromium-os:24141
TEST=New unit tests for HTTPProxy and Connection

Change-Id: Ife2ad775fd8a3d2fb48f860e804eeb442dc5c58a
Reviewed-on: https://gerrit.chromium.org/gerrit/12889
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
c1dec4d5cad7c6ee2cd8dbc4f47e4d30403dcca1 09-Dec-2011 Paul Stewart <pstew@chromium.org> shill: Assign "Default" status to the best connection

Set the highest-ranked connection to be the "Default".
As a result, the highest priority default route will
move with the highest-ranked connection in the service
list.

Bonus changes:
* Service now formally holds a reference to the Connection
object, so call a "SetConnection" method instead of a
Create/Destroy of the HTTPProxy.
* Actually start the routing table service, and do a couple
minor fixes due to how the kernel actually accepts metric
changes.

BUG=chromium-os:7607,chromium-os:23993
TEST=New Unit Test + Manual (watch routes while inserting
USB-Ethernet on a machine connected to WiFi)

Change-Id: Iddf1ed766238d9e8adc97bb54fc12b527f86239f
Reviewed-on: https://gerrit.chromium.org/gerrit/12685
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
be5f5b341ba4b85d45ffb6c0430ef5ab84c7b961 08-Dec-2011 Paul Stewart <pstew@chromium.org> shill: Create HTTPProxy for connected services

When an a Connection is created on a Device, ask the
Service to create an HTTPProxy. The Service will
then expose the port number for the proxy as an RPC
property. Whenever the Service is unselected by
the Device, or the connection terminates, ask the
Service to destroy the proxy.

The Service owns the HTTPProxy so that it can report
the proxy port in its properties.

BUG=chromium-os:21664
TEST=Add expectations for DestroyProxy in unit tests.
Manual: Ensure that "list-services" shows the proxy
port on a successful connection, and "curl -x" to
this proxy succeeds.

Change-Id: I24a1f7a23c0fc4577b48aed7bec370fba6edc342
Reviewed-on: https://gerrit.chromium.org/gerrit/12625
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
7cfca0467e47aa91b485c485b92befb33a1fd61f 08-Dec-2011 Paul Stewart <pstew@chromium.org> shill: Assign unique metrics to non-default interfaces

Assign a metric based on the interface index to routes
for interfaces that are not default. As a result even
if the gateway address is the same (e.g, if you're connected
to a home AP via both wireless and wired) that the routes
do not conflict with each other.

BUG=chromium-os:23917
TEST=Manual: As above, connect to a home AP over Ethernet
and WiFi, and ensure that both gateway routes appear.

Change-Id: I85ffad74ec53dda535578367242114b30846b7ac
Reviewed-on: https://gerrit.chromium.org/gerrit/12651
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
9a908080fc2a72dbf06f995b878fc8a3693b725a 31-Aug-2011 Paul Stewart <pstew@chromium.org> shill: Add IP Address tracking to DeviceInfo

Subscribe to IP Address messages in DeviceInfo, and create a
per-device list of assigned IP Addresses. Provide a method
to flush all globally scoped addresses from a device.

As a result, we can now flush assigned IP addresses when a
Connection is terminated. There is also some incidental cleanup
in RTNLHandler to remove some vestiges of hand-baked RTNL
message encoding.

BUG=chromium-os:19744
TEST=Run new unit tests. Test using ethernet on a netbook to make sure
addresses are added and removed correctly.

Change-Id: I63fd09088e71c43cb1f11a89a8ef15e11074976c
Reviewed-on: http://gerrit.chromium.org/gerrit/7180
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h
dd60e4549cc8898f7f517283eacc58f67570bd1f 08-Aug-2011 Paul Stewart <pstew@chromium.org> shill: Add connection class

The connection class represents the snapshot of connectivity
state, including routing, address information and addressing.
It is able to apply itself as the "default" connection, by
setting routing table metrics and DNS resolver files.

BUG=chromium-os:19095
TEST=New unittest

Change-Id: I7021867ed8a8559db0e84f58a72692abaf105cad
Reviewed-on: http://gerrit.chromium.org/gerrit/5938
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection.h