Skip to content

Commit

Permalink
common/pick_address.cc: Copy public_netw to cluset_netw if cluster empty
Browse files Browse the repository at this point in the history
 - When public network is set, but cluster network is not, then
   the cluster-bindings would be on 0.0.0.0 which could be unexpeted.

 In this commit we copy the public network into the cluster network
 to make sure that the cluster backend is not bound on 0.0.0.0
 Which could be consideren an insecure, or unexpected, action.

Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
  • Loading branch information
wjwithagen committed Jan 15, 2017
1 parent abbcbbd commit c6bdb85
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/common/pick_address.cc
Expand Up @@ -112,16 +112,24 @@ void pick_addresses(CephContext *cct, int needs)
exit(1);
}


if ((needs & CEPH_PICK_ADDRESS_PUBLIC)
&& cct->_conf->public_addr.is_blank_ip()
&& !cct->_conf->public_network.empty()) {
fill_in_one_address(cct, ifa, cct->_conf->public_network, "public_addr");
}

if ((needs & CEPH_PICK_ADDRESS_CLUSTER)
&& cct->_conf->cluster_addr.is_blank_ip()
&& !cct->_conf->cluster_network.empty()) {
fill_in_one_address(cct, ifa, cct->_conf->cluster_network, "cluster_addr");
&& cct->_conf->cluster_addr.is_blank_ip()) {
if (cct->_conf->cluster_network.empty()) {
fill_in_one_address(cct, ifa, cct->_conf->cluster_network, "cluster_addr");
} else {
if (!cct->_conf->public_network.empty()) {
lderr(cct) << "Public network was set, but cluster network was not set " << dendl;
lderr(cct) << " Using public network also for cluster network" << dendl;
}
fill_in_one_address(cct, ifa, cct->_conf->public_network, "cluster_addr");
}
}

freeifaddrs(ifa);
Expand Down

0 comments on commit c6bdb85

Please sign in to comment.