From: Sage Weil Date: Wed, 16 Jan 2019 20:57:13 +0000 (-0600) Subject: msg/async,auth: add AuthConnectionMeta to Protocol X-Git-Tag: v14.1.0~183^2~53 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7dd93be90a8a0e0f15d2809c59c1e74f01021238;p=ceph.git msg/async,auth: add AuthConnectionMeta to Protocol This will hold all of the authentication-related state in an easy-to-find section that can be accessed via a Connection* or by the protocol stack (as needed). Signed-off-by: Sage Weil --- diff --git a/src/auth/Auth.h b/src/auth/Auth.h index 69c488af776f..307afdd9cfbe 100644 --- a/src/auth/Auth.h +++ b/src/auth/Auth.h @@ -148,6 +148,13 @@ struct AuthAuthorizerChallenge { virtual ~AuthAuthorizerChallenge() {} }; +struct AuthConnectionMeta { + uint32_t auth_method = CEPH_AUTH_UNKNOWN; + CryptoKey session_key; + CryptoKey connection_secret; + std::unique_ptr authorizer; + std::unique_ptr authorizer_challenge; +}; /* * Key management diff --git a/src/msg/Connection.h b/src/msg/Connection.h index 90d3459c1dac..b9bddc2c6606 100644 --- a/src/msg/Connection.h +++ b/src/msg/Connection.h @@ -103,6 +103,10 @@ public: return msgr; } + virtual AuthConnectionMeta *get_auth_meta() { + return nullptr; + } + /** * Queue the given Message to send out on the given Connection. * Success in this function does not guarantee Message delivery, only diff --git a/src/msg/async/AsyncConnection.cc b/src/msg/async/AsyncConnection.cc index 92b0df9cfb76..7e81dfd37bdb 100644 --- a/src/msg/async/AsyncConnection.cc +++ b/src/msg/async/AsyncConnection.cc @@ -445,6 +445,11 @@ bool AsyncConnection::is_connected() { return protocol->is_connected(); } +AuthConnectionMeta *AsyncConnection::get_auth_meta() +{ + return &protocol->auth_meta; +} + void AsyncConnection::connect(const entity_addrvec_t &addrs, int type, entity_addr_t &target) { diff --git a/src/msg/async/AsyncConnection.h b/src/msg/async/AsyncConnection.h index 3edd30cf96fc..d96b8da20af7 100644 --- a/src/msg/async/AsyncConnection.h +++ b/src/msg/async/AsyncConnection.h @@ -132,9 +132,11 @@ class AsyncConnection : public Connection { policy.lossy = true; } - entity_addr_t get_peer_socket_addr() const override { - return target_addr; - } + entity_addr_t get_peer_socket_addr() const override { + return target_addr; + } + + AuthConnectionMeta *get_auth_meta() override; private: enum { diff --git a/src/msg/async/Protocol.h b/src/msg/async/Protocol.h index 8eecb7c2e5fc..cf9005b1b668 100644 --- a/src/msg/async/Protocol.h +++ b/src/msg/async/Protocol.h @@ -79,6 +79,8 @@ protected: AsyncConnection *connection; AsyncMessenger *messenger; CephContext *cct; +public: + AuthConnectionMeta auth_meta; public: Protocol(int type, AsyncConnection *connection); @@ -102,6 +104,10 @@ public: virtual void read_event() = 0; virtual void write_event() = 0; virtual bool is_queued() = 0; + + virtual AuthConnectionMeta *get_auth_meta() { + return nullptr; + } }; #endif /* _MSG_ASYNC_PROTOCOL_ */