Commit Graph

94175 Commits

Author SHA1 Message Date
Sage Weil
d9f3022a51 msg/async/ProtocolV2: fix handling for v2 client connection with v1 addr
Switch it to be v2.  Reject the case where the client sends and addrvec, though;
that should only happen for clients that did_bind, and they should only connect to
v2 if they have a v2 bound addr.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-01-26 11:44:55 -06:00
Sage Weil
4c2e28f5b7 ceph_test_msgr: do not connect_to on the client side
Signed-off-by: Sage Weil <sage@redhat.com>
2019-01-26 11:44:55 -06:00
Sage Weil
985ec03cf9 msg/async: do not connect from server
We could have a fault on a server-side of a non-lossy connectoin where
there is a fault and we have outgoing data queued.  Since we are a server,
we cannot connect; we should just go into standby and wait for the other
end to reconnect, or for someone to mark us down.

This fixes a failure reproduced by Messenger/MessengerTest.SyntheticInjectTest/0
where it would assert(!policy.server) in the connect code.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-01-26 11:44:55 -06:00
Sage Weil
98a9a5e538 msg/async: do not use peer to addr detection; use getsockname()
If of relying on the peer to tell us what address we are connecting from,
look at how our local socket is bound, and use that address.

This removes the possibility for error because we will infer our address
locally and that will be the one place it is decide; the server will just
use our value.  As things were previously, we had to make the local and
remote inference match, which was fragile.

This does take away the client's ability to discover if it is traversing
NAT to reach the server and learning its public/external address.  I
don't think anybody has ever tested this, so it probably didn't even work,
and I've never heard it come up as a requirement.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-01-26 11:44:55 -06:00
Sage Weil
2ca61bb460 msg/async/ProtocolV2: always send non-empty addrvec for self
If we don't know our address yet, send the peer a 0.0.0.0 or :: address with an empty
port and a populated nonce.  That way the peer can infer our final addr the same way
we do from learned_addr.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-01-25 14:17:34 -06:00
Sage Weil
5acf7ec1ff msg/async: never fill out port in myaddr if we didn't bind
If we are a client and didn't bind, then we should not fill in the port for our
address.  The one the peer sent us is just the random port our outgoing connection
happened to land on!

Signed-off-by: Sage Weil <sage@redhat.com>
2019-01-25 14:12:59 -06:00
Sage Weil
ea517edd2d ceph_test_msgr: use v2 addrs for simplemessenger
Signed-off-by: Sage Weil <sage@redhat.com>
2019-01-25 13:48:11 -06:00
Ricardo Dias
1b097e8164
msg/async: msgr2: don't force write event on every message received
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-25 19:42:37 +00:00
Sage Weil
5145120c2e
msg/async/ProtocolV2: be forgiving in server identity check
If we parse something out of mon_host or are given an addr by a user,
we should succeed as long as our target_addr is one of the destination's
addrs.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-01-25 09:15:19 +00:00
Sage Weil
71f1e1604b
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 <sage@redhat.com>
2019-01-24 16:50:28 +00:00
Ricardo Dias
23c0883d4f
msg/async: msgr2: clean cookie if connection failed in ACCEPT_SESSION
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-24 09:48:44 +00:00
Sage Weil
b2b123435f
msg/async/ProtocolV2: do not bump connect_seq for fault during ACCEPTING_SESSION
If we have a connection race, and we lose, we may end up with outgoing
messages *and* be in ACCEPTING_SESSION.  If we then fault, we want to
leave connect_seq at 0 to avoid triggering a reset.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-01-24 07:17:41 +00:00
Ricardo Dias
10220d0eb4
msg/async: msgr2: don't send SESSION_RETRY_GLOBAL in handle_existing_connection
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:29 +00:00
Ricardo Dias
db131b3130
msg/async: msgr2: organizing log messages
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:29 +00:00
Ricardo Dias
97f30e9913
msg/async: msgr2: fix connection fault when replacing
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:29 +00:00
Ricardo Dias
126431053a
msg/async: msgr2: fix replacing race handling
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:28 +00:00
Ricardo Dias
1c6491840a
msg/async: msgr2: fix connection race when existing connection is newer
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:28 +00:00
Ricardo Dias
0a6a6a1272
msg/async: msgr2: assign recv_stamp in handle_message
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:28 +00:00
Ricardo Dias
a9c879089e
msg/async: msgr2: fix peer_addrs discovery
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:28 +00:00
Ricardo Dias
9da6ef7925
msg/async: msgr2: keep authorizer bufferlist across reconnects
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:28 +00:00
Ricardo Dias
9a2864d38d
msg/async: msgr2: fix connection secret problems for WITH_SEASTAR builds
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:28 +00:00
Ricardo Dias
fc6ceeb8bf
msg/async: msgr2: send keepalive on connection race winner
Msgr2 version of PR #25754

Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:28 +00:00
Ricardo Dias
c5fe37277b
msg/async: msgr2: fix client address learning
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:28 +00:00
Ricardo Dias
467571972b
msg/async: msgr2: fix keepalive_ack message
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:27 +00:00
Ricardo Dias
e1b431bc08
msg/async: msgr2: do not force updating rotating keys inline
Msgr2 version of PR #25859

Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:27 +00:00
Ricardo Dias
f4beb0e7c4
msg/async: msgr2: fix mark_down vs accept race
Msgr2 version of PR #25823

Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:27 +00:00
Ricardo Dias
3093667b19
msg/async: msgr2: unregister con from accept vs mark_down race
Msgr2 version of PR #25755

Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:27 +00:00
Sage Weil
1a95c5ba18
auth/cephx/CephxSessionHandler: use connection_secret for encryption
Signed-off-by: Sage Weil <sage@redhat.com>
2019-01-23 13:59:27 +00:00
Sage Weil
67218f12e3
msg,cephx: establish a unique connection_secret for every connection
The session_key is unique for each time we newly authenticate with the
mon--e.g., for each client instantiation.  This is not ideal for
encryption, since we don't want to encrypt all connections with the same
key.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-01-23 13:59:27 +00:00
Ricardo Dias
4af9e4c9ac
msg/async: msgr2: use sha256_digest_t to print signature hex strings
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:27 +00:00
Ricardo Dias
3a382e473f
types.h,rgw: merge sha*_digest_t definitions
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:26 +00:00
Ricardo Dias
290131b676
msg/async: msgr2: close connection when no authorizer is given
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:26 +00:00
Ricardo Dias
514213de6d
msg/async: msgr2: formatting fixes
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:26 +00:00
Ricardo Dias
4341c1d6ee
msg/async: msgr2: send client v2 address when only v1 address is defined
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:26 +00:00
Ricardo Dias
101d75c1f2
msg/async: msgr2: add payload length to banner
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:26 +00:00
Ricardo Dias
da141adcad
msg/async: msgr2: check protocol state after fast dispatch
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:26 +00:00
Ricardo Dias
f43cc51cdb
msg/async: msgr2: reduce log level for sending messages event
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:26 +00:00
Ricardo Dias
5312d97efe
msg/async: msgr2: call verify authorizer when CEPH_AUTH_NONE is used
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:25 +00:00
Ricardo Dias
27cd977a74
msg/async: msgr2: store peer entity name in the protocol
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:25 +00:00
Ricardo Dias
83eb0b3bc0
msg/async: msgr2: apply sign/encrypt to messages data payload
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:25 +00:00
Ricardo Dias
ff752f2e08
msg/async: msgr2: encryption/decryption of frames
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:25 +00:00
Ricardo Dias
6ec5c9c117
cephx: added encrypt/decrypt bufferlist method to session handler
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:25 +00:00
Ricardo Dias
68fe3ff734
msg/async: msgr2: refactored the frame structures
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:25 +00:00
Ricardo Dias
caf65b063e
cephx: add sign bufferlist method
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:25 +00:00
Ricardo Dias
289d88bd31
options: msgr2 enable/disable signing and encrytion options
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:24 +00:00
Ricardo Dias
01b247b110
msg/async: msgr2: cephx authentication
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:24 +00:00
Ricardo Dias
2063fa9ecf
msg/async: msgr2: implement reconnect
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:24 +00:00
Ricardo Dias
98741f3a07
msg/async: msgr2: fault handling
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:24 +00:00
Ricardo Dias
38eafa721e
msg/async: msgr2: messange exchange phase
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:24 +00:00
Ricardo Dias
6032ae85f2
msg/async: msgr2: message flow handshake
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-01-23 13:59:24 +00:00