From: Willem Jan Withagen Date: Fri, 13 Jan 2017 23:29:43 +0000 (+0100) Subject: common/pick_address.cc: Copy public_netw to cluset_netw if cluster empty X-Git-Tag: v12.0.0~111^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7cf7be726eba9dca93ee9e128e097a849db8034a;p=ceph.git common/pick_address.cc: Copy public_netw to cluset_netw if cluster empty - 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 --- diff --git a/src/common/pick_address.cc b/src/common/pick_address.cc index a47a1d946a4c..ebce2d553d71 100644 --- a/src/common/pick_address.cc +++ b/src/common/pick_address.cc @@ -112,6 +112,7 @@ 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()) { @@ -119,9 +120,16 @@ void pick_addresses(CephContext *cct, int needs) } 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);