From 7ae4affef599fd0ba9452d2f1082711368c092b4 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 26 Oct 2018 15:28:56 -0500 Subject: [PATCH] msg/async/AsyncMessenger: fix set_addr_unknowns Fill in IP address from a v1 or v2 address into any v1 or v2 addresses. Signed-off-by: Sage Weil --- src/msg/async/AsyncMessenger.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/msg/async/AsyncMessenger.cc b/src/msg/async/AsyncMessenger.cc index d2737608c7084..062fbdb34ff87 100644 --- a/src/msg/async/AsyncMessenger.cc +++ b/src/msg/async/AsyncMessenger.cc @@ -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; } -- 2.39.5