__le32 num_addrs
entity_addrvec_t*num_addrs entity addrs
+ entity_addr_t target entity addr
__le64 gid (numeric part of osd.0, client.123456, ...)
__le64 global_seq
__le64 features supported (CEPH_FEATURE_* bitmask)
- 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.
+ - the target addr is who the client is trying to connect *to*, so
+ that the server side can close the connection if the client is
+ talking to the wrong daemon.
- 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
};
struct ClientIdentFrame
- : public SignedEncryptedFrame<ClientIdentFrame, entity_addrvec_t, int64_t,
+ : public SignedEncryptedFrame<ClientIdentFrame, entity_addrvec_t,
+ entity_addr_t,
+ int64_t,
uint64_t, uint64_t, uint64_t, uint64_t> {
const ProtocolV2::Tag tag = ProtocolV2::Tag::CLIENT_IDENT;
using SignedEncryptedFrame::SignedEncryptedFrame;
inline entity_addrvec_t &addrs() { return get_val<0>(); }
- inline int64_t &gid() { return get_val<1>(); }
- inline uint64_t &global_seq() { return get_val<2>(); }
- inline uint64_t &supported_features() { return get_val<3>(); }
- inline uint64_t &required_features() { return get_val<4>(); }
- inline uint64_t &flags() { return get_val<5>(); }
+ inline entity_addr_t &target_addr() { return get_val<1>(); }
+ inline int64_t &gid() { return get_val<2>(); }
+ inline uint64_t &global_seq() { return get_val<3>(); }
+ inline uint64_t &supported_features() { return get_val<4>(); }
+ inline uint64_t &required_features() { return get_val<5>(); }
+ inline uint64_t &flags() { return get_val<6>(); }
};
struct ServerIdentFrame
}
ClientIdentFrame client_ident(this, messenger->get_myaddrs(),
+ connection->target_addr,
messenger->get_myname().num(), global_seq,
connection->policy.features_supported,
connection->policy.features_required | msgr2_required,
ldout(cct, 5) << __func__ << " received client identification: "
<< "addrs=" << client_ident.addrs()
+ << " target=" << client_ident.target_addr()
<< " gid=" << client_ident.gid()
<< " global_seq=" << client_ident.global_seq()
<< " features_supported=" << std::hex
client_ident.addrs().front() == entity_addr_t()) {
return _fault(); // a v2 peer should never do this
}
+ if (!messenger->get_myaddrs().contains(client_ident.target_addr())) {
+ ldout(cct,5) << __func__ << " peer is trying to reach "
+ << client_ident.target_addr()
+ << " which is not us (" << messenger->get_myaddrs() << ")"
+ << dendl;
+ return _fault();
+ }
connection->set_peer_addrs(client_ident.addrs());
connection->target_addr = connection->_infer_target_addr(client_ident.addrs());