From 1e6a0a9a423371efd4d201d279e1e4165e9a6077 Mon Sep 17 00:00:00 2001 From: Yingxin Date: Fri, 21 Dec 2018 03:30:02 +0800 Subject: [PATCH] crimson/net: let conn directly verify the authorizer with dispatcher Signed-off-by: Yingxin --- src/crimson/net/Messenger.h | 9 --------- src/crimson/net/SocketConnection.cc | 10 +++++----- src/crimson/net/SocketMessenger.cc | 14 -------------- src/crimson/net/SocketMessenger.h | 9 --------- 4 files changed, 5 insertions(+), 37 deletions(-) diff --git a/src/crimson/net/Messenger.h b/src/crimson/net/Messenger.h index fcdd5ad32a6e..0d8484fd2c21 100644 --- a/src/crimson/net/Messenger.h +++ b/src/crimson/net/Messenger.h @@ -62,15 +62,6 @@ class Messenger { return ++global_seq; } - // @returns a tuple of - virtual seastar::future /// auth_reply - verify_authorizer(peer_type_t peer_type, - auth_proto_t protocol, - bufferlist& auth) = 0; - virtual seastar::future> - get_authorizer(peer_type_t peer_type, - bool force_new) = 0; uint32_t get_crc_flags() const { return crc_flags; } diff --git a/src/crimson/net/SocketConnection.cc b/src/crimson/net/SocketConnection.cc index 6afd6b2d6b15..ef8281d5a79a 100644 --- a/src/crimson/net/SocketConnection.cc +++ b/src/crimson/net/SocketConnection.cc @@ -460,9 +460,9 @@ SocketConnection::repeat_handle_connect() return seastar::make_ready_future( CEPH_MSGR_TAG_FEATURES, bufferlist{}); } - return messenger.verify_authorizer(peer_type, - h.connect.authorizer_protocol, - authorizer); + return dispatcher.ms_verify_authorizer(peer_type, + h.connect.authorizer_protocol, + authorizer); }).then([this] (ceph::net::msgr_tag_t tag, bufferlist&& authorizer_reply) { memset(&h.reply, 0, sizeof(h.reply)); if (tag) { @@ -642,7 +642,7 @@ SocketConnection::handle_connect_reply(msgr_tag_t tag) } h.got_bad_auth = true; // try harder - return messenger.get_authorizer(peer_type, true) + return dispatcher.ms_get_authorizer(peer_type, true) .then([this](auto&& auth) { h.authorizer = std::move(auth); return stop_t::no; @@ -734,7 +734,7 @@ SocketConnection::repeat_connect() // this is fyi, actually, server decides! h.connect.flags = policy.lossy ? CEPH_MSG_CONNECT_LOSSY : 0; - return messenger.get_authorizer(peer_type, false) + return dispatcher.ms_get_authorizer(peer_type, false) .then([this](auto&& auth) { h.authorizer = std::move(auth); bufferlist bl; diff --git a/src/crimson/net/SocketMessenger.cc b/src/crimson/net/SocketMessenger.cc index 3791463455d2..75c2870f3f8c 100644 --- a/src/crimson/net/SocketMessenger.cc +++ b/src/crimson/net/SocketMessenger.cc @@ -151,17 +151,3 @@ void SocketMessenger::unregister_conn(SocketConnectionRef conn) ceph_assert(found->second == conn); connections.erase(found); } - -seastar::future -SocketMessenger::verify_authorizer(peer_type_t peer_type, - auth_proto_t protocol, - bufferlist& auth) -{ - return dispatcher->ms_verify_authorizer(peer_type, protocol, auth); -} - -seastar::future> -SocketMessenger::get_authorizer(peer_type_t peer_type, bool force_new) -{ - return dispatcher->ms_get_authorizer(peer_type, force_new); -} diff --git a/src/crimson/net/SocketMessenger.h b/src/crimson/net/SocketMessenger.h index 5977ba3a892f..c348f5920b32 100644 --- a/src/crimson/net/SocketMessenger.h +++ b/src/crimson/net/SocketMessenger.h @@ -52,15 +52,6 @@ class SocketMessenger final : public Messenger { seastar::future<> shutdown() override; - seastar::future - verify_authorizer(peer_type_t peer_type, - auth_proto_t protocol, - bufferlist& auth) override; - - seastar::future> - get_authorizer(peer_type_t peer_type, - bool force_new) override; - public: void set_default_policy(const SocketPolicy& p); void set_policy(entity_type_t peer_type, const SocketPolicy& p); -- 2.47.3