]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async/AsyncMessenger: fix set_addr_unknowns
authorSage Weil <sage@redhat.com>
Fri, 26 Oct 2018 20:28:56 +0000 (15:28 -0500)
committerSage Weil <sage@redhat.com>
Fri, 21 Dec 2018 21:30:18 +0000 (15:30 -0600)
Fill in IP address from a v1 or v2 address into any v1 or v2 addresses.

Signed-off-by: Sage Weil <sage@redhat.com>
src/msg/async/AsyncMessenger.cc

index d2737608c70840f16677fd2cf6e9c88213a64e22..062fbdb34ff8762268449561f33986d992f0cb4c 100644 (file)
@@ -693,19 +693,23 @@ void AsyncMessenger::submit_message(Message *m, AsyncConnectionRef con,
  */
 bool AsyncMessenger::set_addr_unknowns(const entity_addrvec_t &addrs)
 {
+  ldout(cct,1) << __func__ << " " << addrs << dendl;
   bool ret = false;
   Mutex::Locker l(lock);
 
   entity_addrvec_t newaddrs = *my_addrs;
   for (auto& a : newaddrs.v) {
     if (a.is_blank_ip()) {
+      int type = a.get_type();
       int port = a.get_port();
+      uint32_t nonce = a.get_nonce();
       for (auto& b : addrs.v) {
-       if (a.get_type() == b.get_type() &&
-           a.get_family() == b.get_family()) {
+       if (a.get_family() == b.get_family()) {
          ldout(cct,1) << __func__ << " assuming my addr " << a
                       << " matches provided addr " << b << dendl;
          a = b;
+         a.set_nonce(nonce);
+         a.set_type(type);
          a.set_port(port);
          ret = true;
          break;
@@ -717,6 +721,7 @@ bool AsyncMessenger::set_addr_unknowns(const entity_addrvec_t &addrs)
   if (ret) {
     _init_local_connection();
   }
+  ldout(cct,1) << __func__ << " now " << *my_addrs << dendl;
   return ret;
 }