shill: connection: Choose reasonable default Broadcast Address
Calculate the correct default broadcast address since the kernel
will not do so for us.
BUG=chromium-os:23930
TEST=New unit tests -- manual testing by setting a manual IP address
and prefix length only and attaching to a network without a DHCP server.
Change-Id: Ibfb7f942a100cdc2c33a7da915f7bfa5f27ef24e
Reviewed-on: https://gerrit.chromium.org/gerrit/21507
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/connection.cc b/connection.cc
index 9867ae1..655b06f 100644
--- a/connection.cc
+++ b/connection.cc
@@ -67,8 +67,9 @@
IPAddress broadcast(properties.address_family);
if (properties.broadcast_address.empty()) {
- if (technology_ != Technology::kVPN) {
+ if (properties.peer_address.empty()) {
LOG(WARNING) << "Broadcast address is not set. Using default.";
+ broadcast = local.GetDefaultBroadcast();
}
} else if (!broadcast.SetAddressFromString(properties.broadcast_address)) {
LOG(ERROR) << "Broadcast address " << properties.broadcast_address