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>
diff --git a/ip_address.cc b/ip_address.cc
index 8dda572..5281d85 100644
--- a/ip_address.cc
+++ b/ip_address.cc
@@ -24,6 +24,13 @@
// static
const IPAddress::Family IPAddress::kFamilyIPv6 = AF_INET6;
+// static
+const char IPAddress::kFamilyNameUnknown[] = "Unknown";
+// static
+const char IPAddress::kFamilyNameIPv4[] = "IPv4";
+// static
+const char IPAddress::kFamilyNameIPv6[] = "IPv6";
+
IPAddress::IPAddress(Family family, const ByteString &address)
: family_(family) ,
address_(address),
@@ -42,6 +49,7 @@
IPAddress::~IPAddress() {}
+// static
size_t IPAddress::GetAddressLength(Family family) {
switch (family) {
case kFamilyIPv4:
@@ -75,6 +83,18 @@
return 0;
}
+// static
+string IPAddress::GetAddressFamilyName(Family family) {
+ switch (family) {
+ case kFamilyIPv4:
+ return kFamilyNameIPv4;
+ case kFamilyIPv6:
+ return kFamilyNameIPv6;
+ default:
+ return kFamilyNameUnknown;
+ }
+}
+
bool IPAddress::SetAddressFromString(const string &address_string) {
size_t address_length = GetAddressLength(family_);