]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async/ProtocolV2: separate IDENT into {CLIENT,SERVER}_IDENT
authorSage Weil <sage@redhat.com>
Thu, 7 Feb 2019 23:03:41 +0000 (17:03 -0600)
committerSage Weil <sage@redhat.com>
Thu, 7 Feb 2019 23:05:10 +0000 (17:05 -0600)
This is less ambiguous and easier to document since the frame payloads
are different.

Signed-off-by: Sage Weil <sage@redhat.com>
doc/dev/msgr2.rst
src/msg/async/ProtocolV2.cc
src/msg/async/ProtocolV2.h

index 7cbfe8acefa23f44d0c87438691ad400817c35bd..72979a2b732c8a1b43bfc1f9fdb916a3785c5ff8 100644 (file)
@@ -235,19 +235,20 @@ Message flow handshake
 In this phase the peers identify each other and (if desired) reconnect to
 an established session.
 
-* TAG_IDENT: identify ourselves::
+* TAG_CLIENT_IDENT (client->server): identify ourselves::
 
-    entity_addrvec_t addr(s)
-    __u8   my type (CEPH_ENTITY_TYPE_*)
+    __le32 num_addrs
+    entity_addrvec_t*num_addrs entity addrs
     __le64 gid (numeric part of osd.0, client.123456, ...)
+    __le64 global_seq
     __le64 features supported (CEPH_FEATURE_* bitmask)
     __le64 features required (CEPH_FEATURE_* bitmask)
     __le64 flags (CEPH_MSG_CONNECT_* bitmask)
-    __le64 cookie (a client identifier, assigned by the sender. unique on the sender.)
 
   - client will send first, server will reply with same.  if this is a
     new session, the client and server can proceed to the message exchange.
-  - type.gid (entity_name_t) is set here.  this means we don't need it
+  - type.gid (entity_name_t) is set here, by combinging the type shared in the hello
+    frame with the gid here.  this means we don't need it
     in the header of every message.  it also means that we can't send
     messages "from" other entity_name_t's.  the current
     implementations set this at the top of _send_message etc so this
@@ -255,17 +256,26 @@ an established session.
     likely want to mask this against what the authenticated credential
     allows.
   - we've dropped the 'protocol_version' field from msgr1
-  - for lossy sessions, cookie is meaningless.  for lossless sessions,
-    we assign a local value that identifies the local Connection
-    state.  when we receive this from a peer, we make a note of their
-    cookie, so that on reconnect we can reattach (see below).
 
-* TAG_IDENT_MISSING_FEATURES (server only): complain about a TAG_IDENT
+* TAG_IDENT_MISSING_FEATURES (server->client): complain about a TAG_IDENT
   with too few features::
 
     __le64 features we require that the peer didn't advertise
 
-* TAG_RECONNECT (client only): reconnect to an established session::
+* TAG_SERVER_IDENT (server->client): accept client ident and identify server::
+
+    __le32 num_addrs
+    entity_addrvec_t*num_addrs entity addrs
+    __le64 gid (numeric part of osd.0, client.123456, ...)
+    __le64 global_seq
+    __le64 features supported (CEPH_FEATURE_* bitmask)
+    __le64 features required (CEPH_FEATURE_* bitmask)
+    __le64 flags (CEPH_MSG_CONNECT_* bitmask)
+    __le64 cookie
+
+  - The cookie can be used by the client if it is later disconnected and wants to
+    reconnect and resume the session.
+
 
     __le64 cookie
     __le64 global_seq
index 8f2c5c787b8cdcf679b99bd70f12e81cbd31a5c1..1b8522c2270a7c663437f72dfb85204224fdcb20 100644 (file)
@@ -311,7 +311,7 @@ struct SignedEncryptedFrame : public PayloadFrame<T, Args..., signature_t> {
 struct ClientIdentFrame
     : public SignedEncryptedFrame<ClientIdentFrame, entity_addrvec_t, int64_t,
                                   uint64_t, uint64_t, uint64_t, uint64_t> {
-  const ProtocolV2::Tag tag = ProtocolV2::Tag::IDENT;
+  const ProtocolV2::Tag tag = ProtocolV2::Tag::CLIENT_IDENT;
   using SignedEncryptedFrame::SignedEncryptedFrame;
 
   inline entity_addrvec_t &addrs() { return get_val<0>(); }
@@ -326,7 +326,7 @@ struct ServerIdentFrame
     : public SignedEncryptedFrame<ServerIdentFrame, entity_addrvec_t,
                                   int64_t, uint64_t, uint64_t,
                                   uint64_t, uint64_t, uint64_t> {
-  const ProtocolV2::Tag tag = ProtocolV2::Tag::IDENT;
+  const ProtocolV2::Tag tag = ProtocolV2::Tag::SERVER_IDENT;
   using SignedEncryptedFrame::SignedEncryptedFrame;
 
   inline entity_addrvec_t &addrs() { return get_val<0>(); }
@@ -1417,7 +1417,8 @@ CtPtr ProtocolV2::handle_read_frame_length_and_tag(char *buffer, int r) {
     case Tag::AUTH_REPLY_MORE:
     case Tag::AUTH_REQUEST_MORE:
     case Tag::AUTH_DONE:
-    case Tag::IDENT:
+    case Tag::CLIENT_IDENT:
+    case Tag::SERVER_IDENT:
     case Tag::IDENT_MISSING_FEATURES:
     case Tag::SESSION_RECONNECT:
     case Tag::SESSION_RETRY:
@@ -1472,8 +1473,10 @@ CtPtr ProtocolV2::handle_frame_payload(char *buffer, int r) {
       return handle_auth_request_more(buffer, next_payload_len);
     case Tag::AUTH_DONE:
       return handle_auth_done(buffer, next_payload_len);
-    case Tag::IDENT:
-      return handle_ident(buffer, next_payload_len);
+    case Tag::CLIENT_IDENT:
+      return handle_client_ident(buffer, next_payload_len);
+    case Tag::SERVER_IDENT:
+      return handle_server_ident(buffer, next_payload_len);
     case Tag::IDENT_MISSING_FEATURES:
       return handle_ident_missing_features(buffer, next_payload_len);
     case Tag::SESSION_RECONNECT:
@@ -1496,16 +1499,6 @@ CtPtr ProtocolV2::handle_frame_payload(char *buffer, int r) {
   return nullptr;
 }
 
-CtPtr ProtocolV2::handle_ident(char *payload, uint32_t length) {
-  if (state == CONNECTING) {
-    return handle_server_ident(payload, length);
-  }
-  if (state == ACCEPTING) {
-    return handle_client_ident(payload, length);
-  }
-  ceph_abort("wrong state at handle_ident");
-}
-
 CtPtr ProtocolV2::ready() {
   ldout(cct, 25) << __func__ << dendl;
 
index 8185c576363467ef2c527518db92fb48fd1492eb..64bc10f4c1a547c87fee5a788dabe77e9d6d4f92 100644 (file)
@@ -53,7 +53,8 @@ public:
     AUTH_REPLY_MORE,
     AUTH_REQUEST_MORE,
     AUTH_DONE,
-    IDENT,
+    CLIENT_IDENT,
+    SERVER_IDENT,
     IDENT_MISSING_FEATURES,
     SESSION_RECONNECT,
     SESSION_RESET,
@@ -155,7 +156,6 @@ private:
   Ct<ProtocolV2> *read_frame();
   Ct<ProtocolV2> *handle_read_frame_length_and_tag(char *buffer, int r);
   Ct<ProtocolV2> *handle_frame_payload(char *buffer, int r);
-  Ct<ProtocolV2> *handle_ident(char *payload, uint32_t length);
 
   Ct<ProtocolV2> *ready();