]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/mon/MonMap.cc
import ceph 14.2.5
[ceph.git] / ceph / src / mon / MonMap.cc
index 90330a1dab387f7c93a459332a191ddc27f223f8..f03193e044dd000f3ad70cd55da08cb7d9480fbd 100644 (file)
@@ -36,7 +36,16 @@ void mon_info_t::encode(bufferlist& bl, uint64_t features) const
   ENCODE_START(v, 1, bl);
   encode(name, bl);
   if (v < 3) {
-    encode(public_addrs.legacy_addr(), bl, features);
+    auto a = public_addrs.legacy_addr();
+    if (a != entity_addr_t()) {
+      encode(a, bl, features);
+    } else {
+      // note: we don't have a legacy addr here, so lie so that it looks
+      // like one, just so that old clients get a valid-looking map.
+      // they won't be able to talk to the v2 mons, but that's better
+      // than nothing.
+      encode(public_addrs.as_legacy_addr(), bl, features);
+    }
   } else {
     encode(public_addrs, bl, features);
   }