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>
diff --git a/connection.cc b/connection.cc
index cab4bd2..d34f547 100644
--- a/connection.cc
+++ b/connection.cc
@@ -23,11 +23,13 @@
Connection::Connection(int interface_index,
const std::string& interface_name,
+ Technology::Identifier technology,
const DeviceInfo *device_info)
: is_default_(false),
routing_request_count_(0),
interface_index_(interface_index),
interface_name_(interface_name),
+ technology_(technology),
device_info_(device_info),
resolver_(Resolver::GetInstance()),
routing_table_(RoutingTable::GetInstance()),
@@ -55,7 +57,8 @@
local.set_prefix(properties.subnet_cidr);
IPAddress broadcast(properties.address_family);
- if (!broadcast.SetAddressFromString(properties.broadcast_address)) {
+ if (!broadcast.SetAddressFromString(properties.broadcast_address) &&
+ technology_ != Technology::kTunnel) {
LOG(ERROR) << "Broadcast address " << properties.broadcast_address
<< " is invalid";
return;