From: Sage Weil Date: Thu, 24 Jan 2019 13:33:29 +0000 (-0600) Subject: msg/async/ProtocolV2: fault if we connect to the wrong peer X-Git-Tag: v14.1.0~271^2~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=71f1e1604b088a68a0d7ed0d1992d92bc2a12db8;p=ceph.git msg/async/ProtocolV2: fault if we connect to the wrong peer Someone else may have bound to the same port. If they identify as someone else, fault and back off. Signed-off-by: Sage Weil --- diff --git a/src/msg/async/ProtocolV2.cc b/src/msg/async/ProtocolV2.cc index 7084ca8ea84..892be9e9401 100644 --- a/src/msg/async/ProtocolV2.cc +++ b/src/msg/async/ProtocolV2.cc @@ -2322,6 +2322,13 @@ CtPtr ProtocolV2::handle_server_ident(char *payload, uint32_t length) { << " flags=" << server_ident.flags() << " cookie=" << std::dec << server_ident.cookie() << dendl; + // is this who we intended to talk to? + if (*connection->peer_addrs != server_ident.addrs()) { + ldout(cct,1) << __func__ << " peer identifies as " << server_ident.addrs() + << " not " << *connection->peer_addrs << dendl; + return _fault(); + } + connection->lock.unlock(); messenger->learned_addr(server_ident.peer_addr()); if (cct->_conf->ms_inject_internal_delays &&