]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/pick_address.cc: Copy public_netw to cluset_netw if cluster empty
authorWillem Jan Withagen <wjw@digiware.nl>
Fri, 13 Jan 2017 23:29:43 +0000 (00:29 +0100)
committerWillem Jan Withagen <wjw@digiware.nl>
Fri, 20 Jan 2017 20:51:43 +0000 (21:51 +0100)
 - 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>
src/common/pick_address.cc

index a47a1d946a4cc276b5ee78389d2ef4d831dc344b..ebce2d553d718d5ebd9e18dccffdc185db75b9b4 100644 (file)
@@ -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);