History log of /system/connectivity/shill/connection_unittest.cc
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_unittest.cc
8f203b86927727501227d640f592d1e41ce8fcbc 01-Oct-2015 Peter Qiu <zqiu@google.com> Fix connection_unittest for Android

Android doesn't use |resolver_| anymore, so compile it out in the
unittest.

TODO: update connection_unittest to use DNSServerProxyFactory and
MockDNSServerProxy for Android.

Bug: 24543278
TEST=Clean build of shill for Android

Change-Id: Icc044766a2a00fbbb64bc66073a8375a17e3fa1c
/system/connectivity/shill/connection_unittest.cc
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_unittest.cc
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_unittest.cc
9a0f121f98ebc46704773555334b43af14842abe 10-Aug-2015 Paul Stewart <pstew@chromium.org> shill: Connection: Don't create bind loops

It's been observed on some platforms that there are transient
states where the only active service becomes the VPN if the
underlying service becomes disconnected. The connection bind
code should avoid creating a bind loop with itself under these
circumstances.

BUG=chromium:513006
TEST=Unit tests

Change-Id: Ida71646bb3b842d2e02f225249e433d992f4cd8b
Reviewed-on: https://chromium-review.googlesource.com/292430
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection_unittest.cc
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_unittest.cc
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_unittest.cc
3b30ca58d13cf66b75ba0729b222ddc42ae68b33 16-Jun-2015 Paul Stewart <pstew@chromium.org> shill: Top-level unit tests: Switch pointer/ref spacing

Switch to Chrome style spacing.

BUG=chromium:501026
TEST=Unit tests

Change-Id: I86c072b89281e0de18928b47860b99d779af061a
Reviewed-on: https://chromium-review.googlesource.com/278037
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_unittest.cc
55d9550e72197a203efbe06087edc2424676d886 02-May-2015 Paul Stewart <pstew@chromium.org> shill: connection: Fix IP address comparison in FixGatewayReachability

CL:247030 inadvertently broke IP address comparison for
Connection::FixGatewayReachability, since now the |trusted_ip|
contains a prefix while the |peer| and |gateway| still do not.
To solve this, add a new comparison method for IPAddress objects
that does not consider the prefix, and use this for address
comparisons in Connection::FixGatewayReachability.

BUG=chromium:478267
TEST=Unit test + create an ipvanish account and connect

Change-Id: Id30e0cd15bb0171c7f438cf1e7f0087c75d55611
Reviewed-on: https://chromium-review.googlesource.com/268970
Reviewed-by: Prabhu Kaliamoorthi <kaliamoorthi@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection_unittest.cc
1f58903c02e9a8e29816f7a7659afa331b005d9c 23-Feb-2015 Prabhu Kaliamoorthi <kaliamoorthi@chromium.org> shill: Cleanup and fix problem with default address in vpn

When default address is set as the first value in excluded list
passed to SetParameters DBus API of ThirdPartyVpn driver, the
routing entries are not correctly setup since the route for default
address is found to be local. This CL ensures that this problem
does not happen by swapping the address when the first entry is
default. The CL further cleans up IPConfig.

BUG=chromium:459609
TEST=Unit tests and manual testing of the feature.

Change-Id: I0fa167aa6cb09e467a33f876dd98ef5a9000fbb4
Reviewed-on: https://chromium-review.googlesource.com/251990
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_unittest.cc
e0e205bf5e625398d02be89bda076ea9fd761896 20-Feb-2015 Prabhu Kaliamoorthi <kaliamoorthi@chromium.org> shill: Cleanup third party vpn driver in shill

This CL performs the following changes.
1) Depricated parameters such as bypass_ip_from_tunnel
are removed.
2) Inclusion lists and exclusion lists are used instead
and are made mandatory settings.
3) Hard coded strings in parameters are replaced with
constants.
4) Default route setting is removed for third party vpn.
The extension is now explicitly required to set the
tunnel interface as default.
5) Iptables setting made using permisison broker are
explicitly torn down instead of relying on the lifeline.

BUG=chromium:459609
TEST=Manual testing of the feature.

Change-Id: Ibfca4a7485bfbe8e20d68f7159b18f8a38b0c608
Reviewed-on: https://chromium-review.googlesource.com/251550
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_unittest.cc
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_unittest.cc
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_unittest.cc
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_unittest.cc
3c3c36a37a885d0a2e180998587af8390744f757 17-Dec-2014 Samuel Tan <samueltan@chromium.org> shill: do not report suspend readiness on gateway ARP

Pass a boolean from DHCPConfig::ProcessEventSignal to
IPConfig::UpdateProperties and Device::OnIPConfigUpdated that
indicates if a gateway ARP was received, and use this boolean
to determine whether or not to report suspend readiness when
WiFi::OnIPConfigUpdated is called in dark resume. This allows
us to accept both a Gateway ARP and BOUND event during dark
resume, and only report suspend readiness when the latter event
is received.

BUG=chromium:442610
TEST=Compile shill and run unit tests using:

P2_TEST_FILTER="shill::*" FEATURES="test" USE="clang asan" \
emerge-samus shill

Manual testing as follows:

1) Boot into a samus test image.
2) Run 'ff_debug +wifi; ff_debug --level -3'
3) Run 'echo 0 > /var/lib/power_manager/disable_dark_resume; restart \
powerd'
4) Enable all wake on WiFi features with the following command:
dbus-send --system --print-reply --dest=org.chromium.flimflam \
/device/wlan0 org.chromium.flimflam.Device.SetProperty \
string:WakeOnWiFiFeaturesEnabled \
variant:string:"packet_and_ssid"
5) Set the wake-to-scan frequency to 30 seconds with the
following command:
dbus-send --system --print-reply --dest=org.chromium.flimflam \
/device/wlan0 org.chromium.flimflam.Device.SetProperty \
string:WakeToScanFrequency variant:uint32:30
6) Connect samus to an AP.
7) Disable the AP. Verify that the samus is fully disconnected by the WiFi
icon state (a cross over empty WiFi bars).
8) Run 'powerd_dbus_suspend' to suspend the system.
9) Wait ~10 seconds for the system to fully suspend, then immediately re-enable
the AP.
10) Wait for another ~20 seconds for the system to enter dark resume (light bar
will turn on in dark resume).
11) After the dark resume concludes (~10 more seconds; light bar should turn
off), wait another 30 seconds and verify that the system does not enter
dark resume again (i.e. light bar does not light up again). This signifies
that the system has established a connection in the last dark resume. If
the system enters dark resume, repeat this step until the system no longer
enters dark resume again.
12) Wake the samus by pressing any way, and verify that the WiFi icon is in the
fully connected state.
13) Open /var/log/net.log
14) Search for the log messages containing "Gateway ARP received" and
"IPv4 DHCP lease obtained". Verify that the former is logged before the
latter, and that the two events are logged within the same second.
15) Verify that the log message containing the substring "OnDHCPLeaseObtained"
appears immediately after the "IPv4 DHCP lease obtained message".

Change-Id: I8185c8683ed1a5e65779d67cca100faafbad6654
Reviewed-on: https://chromium-review.googlesource.com/236099
Tested-by: Samuel Tan <samueltan@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Samuel Tan <samueltan@chromium.org>
/system/connectivity/shill/connection_unittest.cc
182888eab7478f28001b1235f8d2b75063445db8 13-Nov-2014 Paul Stewart <pstew@chromium.org> shill: Connnection: Ignore invalid IP addresses for GetSubnet

If the local address for a connection is invalid, we should
return an empty string (instead of possibly crashing). The
manager should in turn not bucket two such subnets into the
same subnet bucket.

BUG=chromium:430041
TEST=Unit tests

Change-Id: If2c82d28ddadac7af9841a5a672bc61c91da4796
Reviewed-on: https://chromium-review.googlesource.com/231672
Reviewed-by: Peter Qiu <zqiu@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection_unittest.cc
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_unittest.cc
cddd2d09878704128d35ddfeec862109b7d7fdc9 11-Nov-2014 Alex Deymo <deymo@chromium.org> Include the implemented header first in all projects.

The Google C++ style guide dictates that foo.cc and foo_unittest.cc
should include foo.h in the first place, so missing headers in foo.h
are detected with a compile error of the module implementing them and
not when another module uses them.

This CL sweeps across all the .cc file in platform2 enforcing this.

BUG=None
TEST=cbuildbot amd64-generic

Change-Id: I41835835caba13f54c3c844ecf552eb0e47efa9d
Reviewed-on: https://chromium-review.googlesource.com/228894
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
/system/connectivity/shill/connection_unittest.cc
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_unittest.cc
22f1fbc11b69ee41af8370ec38f1b90577db6c3c 17-Oct-2014 Ben Chan <benchan@chromium.org> shill: connection: Replace scoped_ptr with std::unique_ptr.

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

Change-Id: I41a34f47ce3998d380912c565a72e54e240d4436
Reviewed-on: https://chromium-review.googlesource.com/224159
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
/system/connectivity/shill/connection_unittest.cc
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_unittest.cc
e2ee5e009081a392fb31596c1d0cfb30bc7bad6e 20-Sep-2014 Ben Chan <benchan@chromium.org> shill: Clean up angle brackets in template types.

C++11 no longer has the angle bracket pitfall in template types.

BUG=None
TEST=`USE='cellular wimax' FEATURES=test emerge-$BOARD platform2`

Change-Id: Ia26ef2a4b4a9a0a8d74d5234eaf99dd3b772b6e1
Reviewed-on: https://chromium-review.googlesource.com/219200
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
/system/connectivity/shill/connection_unittest.cc
b25083f4ec00167ceed71a7f961e3f1435dbe070 25-Aug-2014 Peter Qiu <zqiu@chromium.org> shill: Support for using IPv6 connection.

Added support for IPv6 connectivity to the device. The device will prefer
IPv4 configuration over IPv6, and will only use IPv6 configuration if
IPv4 configuration doesn't exist.

BUG=chromium:394010
TEST=unit tests, manual
Manual Test:
1. IPv4 regression test
a. Conenct the DUT to "GoogleGuest", verify the DUT have internet
connectivity by browsing to different websites.
2. IPv4-IPv6 coexistence test
a. Manually update the code to use Google's IPv6 DNS servers as
DNS servers for IPv6 configuration.
b. Connect the DUT to "GoogleGuest", verify the device have both
IPv4 and IPv6 configuration by running
"./usr/local/lib/flimflam/test/list-ipconfigs <interface>"
c. Verity the DUT have internet connectivity by browsing to different
websites.
3. IPv6 only test
a. Manually update the code to use Google's IPv6 DNS servers as
DNS servers for IPv6 configuration, and reject all IPv4 configuration.
b. Connect the DUT to "GoogleGuest", and verify device only have
IPv6 address by running "ifconfig".
c. Verify the device have internet connectivity by browsing to "google.com".
Only few websites support pure IPv6 currently, and "google.com" is one
of them. To visit other websites, website gateway/proxy such as
https://www.sixxs.net/tools/gateway/ can be used.

Change-Id: I5a754e461529d4016ee094a7f7e0b3eab03eca0f
Reviewed-on: https://chromium-review.googlesource.com/214062
Reviewed-by: Peter Qiu <zqiu@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
/system/connectivity/shill/connection_unittest.cc
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_unittest.cc
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_unittest.cc
c5099532b82fe201fe2510c43b529944a0930d2e 12-Dec-2013 Paul Stewart <pstew@chromium.org> shill: IPConfig: Don't reset StaticIP on failure

If the IP address associated with an IPConfig is provided by
StaticIP, the entire configuration should be retained even if
the automatic configuration method fails. Otherwise,
configuration parameters provided outside of the automatic
configuration mechanism will be lost.

To accomplish this cleanly, we need to change the contract
between IPConfig and Device objects. The failure and success
events are now split into separate callbacks. Intead of
passing a bool parameter to OnIPConfigUpdated, failure cases
are handled by a separate method. Further, there is no
expectation in the failure case that the IPConfig resets
itself, so the IPConfig provides a public method for the
Device to call if it chooses.

BUG=chromium:318290
TEST=Unittest, new autotest network_DhcpFailureWithStaticIP (CL:179783)
All other network_Dhcp* unit tests run.

Change-Id: I55ed5a7adfc5d97e45ce832e25caab97ff39cea6
Reviewed-on: https://chromium-review.googlesource.com/179786
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_unittest.cc
e435d34d8bc77ab7b821833e9029eac990f677ad 28-Sep-2013 Paul Stewart <pstew@chromium.org> shill: Connection: Allow VPNs with no default route

Some VPNs may provide access to a single subnet with no default
routes. Allow this configuration to proceed by relaxing a test
in PinHostRoute so it does not abort the setup of the connection.

BUG=chromium:300151
TEST=Unit tests

Change-Id: If22eaabdc3357912292a4314b8adda76bdf71d00
Reviewed-on: https://chromium-review.googlesource.com/171010
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection_unittest.cc
f407d5934100e6f2106aeeede46bafb0074cee35 31-Jul-2013 mukesh agrawal <quiche@chromium.org> shill: add some unit tests for ppp dongle support

This is the first in a series of CLs that will provide unit test coverage
for code introduced or modified by CL:51356, which added support for PPP
dongles.

The primary purpose of this CL is to add unit test coverage for the changes
made to cellular.cc. (Other files will be covered in other CLs.)

While there:
- add a PPPDeviceFactory, and a MockPPPDeviceFactory, so that we
can force the creation of a Mock in Cellular::StartPPP
- add an mm1::MockModemSimpleProxy to CellularTest, so that the PPP
tests can use something similar to what we use at runtime
- mock out SelectService and UpdateIPConfigFromPPP in MockPPPDevice,
so that PPP tests can EXPECT on them
- update L2TPIPSecDriverTest.Notify to reflect that SelectService
and UpdateIPConfigFromPPP are now mock methods
- add some comments in various proxy class headers, to help distinguish
between stuff related to old modemmanager and stuff related to new
modemmanager
- fix a random typo or two

BUG=chromium:246826
TEST=new unit tests

Change-Id: I5b2d0af0f9beb760d05e802531c0c9bc1ac5a040
Reviewed-on: https://gerrit.chromium.org/gerrit/63937
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Thieu Le <thieule@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/connection_unittest.cc
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_unittest.cc
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_unittest.cc
8596f9f1341d3698543e1010ac1710cbe91e35d5 14-Mar-2013 Paul Stewart <pstew@chromium.org> shill: Connection: Sort services when connections bind

When an upper / lower binding is created, this may cause
services priorities to change. We should request that
services be resorted at this time. This relieves issues
with service priorities preventing VPNs from achieving
the default route. While here, log in the Manager
whenever the default service changes.

BUG=chromium:178351
TEST=Unit test

Change-Id: Iaf38d443e3d06b60571f4f67f23afb0a11f4abe9
Reviewed-on: https://gerrit.chromium.org/gerrit/45425
Reviewed-by: Darin Petkov <petkov@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection_unittest.cc
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_unittest.cc
a6bfe87a2c0bcb68d789473ca10988243229667b 26-Sep-2012 Ben Chan <benchan@chromium.org> shill: Clean up "Create a IPv6 blackhole route for IPv4 L2TP/IPsec VPN".

BUG=chromium-os:34383
TEST=Build and run unit tests.

Change-Id: I3f587b2dd8fae6cec6fd9c534438af76def638cf
Reviewed-on: https://gerrit.chromium.org/gerrit/34113
Commit-Ready: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
/system/connectivity/shill/connection_unittest.cc
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_unittest.cc
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_unittest.cc
4d1868b5085dd0c5c38e9d8d5c52516c901bd2a0 10-Sep-2012 Paul Stewart <pstew@chromium.org> shill: Connection: Use DNS domain if search list not provided

If the DHCP server replies with a domain name but not with an
explicit DHCP search list, use the domain name as the search
list. This mirrors flimflam's previous behavior.

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

Change-Id: Ife7c83d24dbd7955d20b1636f466df2fe587a926
Reviewed-on: https://gerrit.chromium.org/gerrit/32776
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_unittest.cc
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_unittest.cc
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_unittest.cc
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_unittest.cc
2aa5d7db68824e198dfd930242e1fc6e48dcfb65 22-Jun-2012 Paul Stewart <pstew@chromium.org> shill: connection: Use peer-to-peer if netmask is all-ones

Special case IP configurations where the netmask is set to
the "all-ones" address. Since this netmask indicates that
no other addresses should be reachable via broadcast domain,
this should imply that there is only a point-to-point link
with the gateway.

BUG=chrome-os-partner:10676
TEST=New unit test

Change-Id: I51f6cb8a1e71376f75be5122426172a6929e09d1
Reviewed-on: https://gerrit.chromium.org/gerrit/25910
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection_unittest.cc
e78ec548060d969fecdb488d6fed711d843bba91 09-Jun-2012 Paul Stewart <pstew@chromium.org> shill: connection: Flush routes when default connection changes

Also be more verbose with address configuration.

BUG=None
TEST=Unit tests

Change-Id: I7a419f416e6ed6b583d57a06b7be42ed37933593
Reviewed-on: https://gerrit.chromium.org/gerrit/24936
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_unittest.cc
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_unittest.cc
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_unittest.cc
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_unittest.cc
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_unittest.cc
abf6d289b2d29487f0a51b6138a127707a38507a 08-May-2012 Darin Petkov <petkov@chromium.org> shill: Add a query-route callback to RoutingTable::RequestRoutToHost.

The callback will be used by VPN connections to handle underlying
connection disconnects gracefully.

BUG=chromium-os:28080
TEST=unit tests

Change-Id: I1217ae58f7626c41680a81d0f6261b883e17df85
Reviewed-on: https://gerrit.chromium.org/gerrit/22103
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Darin Petkov <petkov@chromium.org>
/system/connectivity/shill/connection_unittest.cc
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_unittest.cc
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_unittest.cc
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_unittest.cc
536820ddd33f63e1d95e6e04e1757bd0248bbe38 20-Mar-2012 Paul Stewart <pstew@chromium.org> shill: vpn: Last systems bits for OpenVPN test

This performs the following tasks in completing the first pass
of OpenVPN support:

- Uses any interface for requesting a route to the VPN server.
- Only offers the VPN device to VPNProvider the first time
DeviceInfo sees a message for it.
- Use RTNLHandler::SetInterfaceFlags() to bring the interface
link state up on VPN::Start().
- Allow RTNLHandler::SetInterfaceFlags() to be called from unit
tests.

BUG=chromium-os:22063
TEST=Autotest for network_VPN/network_VPN.000VPNGenesis runs
successfully

Change-Id: I1dd79a43f9de276f337ed1ebcde5893da66f55a9
Reviewed-on: https://gerrit.chromium.org/gerrit/18500
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection_unittest.cc
48100b0f484fb59d5f34eb4565375759202295e1 19-Mar-2012 Paul Stewart <pstew@chromium.org> shill: rtnl: Handle setting of peer address

Bonus changes: Rename "subnet_cidr" to "subnet_prefix". Set a default
subnet prefix for OpenVPNDriver IPConfigs.

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

Change-Id: I953748b3ecb1a45237cedc18482c647eebe27efa
Reviewed-on: https://gerrit.chromium.org/gerrit/18461
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_unittest.cc
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_unittest.cc
3f68bb1e3768969a1db686325ae9a84c8fd06005 15-Mar-2012 Paul Stewart <pstew@chromium.org> shill: routing table: Apply routes from IPConfig

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

Change-Id: Iad53d1847e0badd767c523cdc689861e1cdf243b
Reviewed-on: https://gerrit.chromium.org/gerrit/18269
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_unittest.cc
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_unittest.cc
fb46caf4f23a41e73dfd87547121b5fb0230295a 08-Mar-2012 Thieu Le <thieule@chromium.org> shill: Delete existing routes when the device is started.

BUG=chromium-os:27358
TEST=Unit tests, network_WiFiManager, manually add foreign routes and
ensure they are deleted, also test to make sure default route remains
after DHCP renewal

Change-Id: Ic26b70d685491f31699ff4684ed289e76af8a9ca
Reviewed-on: https://gerrit.chromium.org/gerrit/17640
Commit-Ready: Thieu Le <thieule@chromium.org>
Reviewed-by: Thieu Le <thieule@chromium.org>
Tested-by: Thieu Le <thieule@chromium.org>
/system/connectivity/shill/connection_unittest.cc
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_unittest.cc
caef8936381e9ae1fd765866e4759d42bbb19ad9 29-Feb-2012 Thieu Le <thieule@chromium.org> shill: Delete foreign route entries when adding new default route.

BUG=chromium-os:26587
TEST=Unit test, network_WiFiManager, manually add foreign route and
verify that shill deletes it

Change-Id: I9fa11c227dbdf21baab3a2c7af95b2b4f6f6511e
Reviewed-on: https://gerrit.chromium.org/gerrit/17024
Commit-Ready: Thieu Le <thieule@chromium.org>
Tested-by: Thieu Le <thieule@chromium.org>
Reviewed-by: Thieu Le <thieule@chromium.org>
/system/connectivity/shill/connection_unittest.cc
3426c8fc7a3943f2d8fcb2ec78f0593088b42bed 12-Jan-2012 Thieu Le <thieule@chromium.org> shill: Move Metrics from singleton to Shill daemon

While implementing chromium-os:24810, it was discovered that Metrics is
cleaner if it is passed around like ControlInterface, Dispatcher,
Manager, etc. This approach also makes Metrics more testable.

BUG=chromium-os:24810
TEST=Unit tests, network_WiFiManager suite

Change-Id: I556a1bd11f21f0b93ecfeaae8855dfb99ed5e5f9
Reviewed-on: https://gerrit.chromium.org/gerrit/14099
Commit-Ready: Thieu Le <thieule@chromium.org>
Reviewed-by: Thieu Le <thieule@chromium.org>
Tested-by: Thieu Le <thieule@chromium.org>
/system/connectivity/shill/connection_unittest.cc
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_unittest.cc
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_unittest.cc
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_unittest.cc
7355ce1937c504d836a303ac809bd436272212b3 02-Sep-2011 Paul Stewart <pstew@chromium.org> shill: Naming and lint cleanup pass

Reduce some double-speak in IPAddress constants. Do a cursory
glint pass and clean up a few no-brainer issues.

BUG=None
TEST=Re-run unit tests

Change-Id: I063cd72111bd1f6321f81c6c6591b9f51d87434d
Reviewed-on: http://gerrit.chromium.org/gerrit/7181
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/connection_unittest.cc
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_unittest.cc
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_unittest.cc