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>
diff --git a/connection.h b/connection.h
index d3d7310..a5305d7 100644
--- a/connection.h
+++ b/connection.h
@@ -15,6 +15,7 @@
namespace shill {
+class DeviceInfo;
class Resolver;
class RoutingTable;
class RTNLHandler;
@@ -23,7 +24,9 @@
// the IP address, routing table and DNS table entries.
class Connection : public base::RefCounted<Connection> {
public:
- Connection(int interface_index, const std::string& interface_name);
+ Connection(int interface_index,
+ const std::string &interface_name,
+ const DeviceInfo *device_info);
virtual ~Connection();
// Add the contents of an IPConfig reference to the list of managed state.
@@ -52,6 +55,7 @@
std::vector<std::string> dns_domain_search_;
// Store cached copies of singletons for speed/ease of testing
+ const DeviceInfo *device_info_;
Resolver *resolver_;
RoutingTable *routing_table_;
RTNLHandler *rtnl_handler_;