Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msg/async: connect authorizer fix + recv_buf size #9784

Merged
merged 2 commits into from Jul 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/msg/async/AsyncConnection.cc
Expand Up @@ -125,7 +125,7 @@ AsyncConnection::AsyncConnection(CephContext *cct, AsyncMessenger *m, DispatchQu
out_seq(0), ack_left(0), in_seq(0), state(STATE_NONE), state_after_send(STATE_NONE), sd(-1), port(-1),
dispatch_queue(q), write_lock("AsyncConnection::write_lock"), can_write(WriteStatus::NOWRITE),
open_write(false), keepalive(false), lock("AsyncConnection::lock"), recv_buf(NULL),
recv_max_prefetch(MIN(msgr->cct->_conf->ms_tcp_prefetch_max_size, TCP_PREFETCH_MIN_SIZE)),
recv_max_prefetch(MAX(msgr->cct->_conf->ms_tcp_prefetch_max_size, TCP_PREFETCH_MIN_SIZE)),
recv_start(0), recv_end(0),
last_active(ceph::coarse_mono_clock::now()),
inactive_timeout_us(cct->_conf->ms_tcp_read_timeout*1000*1000),
Expand Down Expand Up @@ -994,6 +994,7 @@ ssize_t AsyncConnection::_process_connection()
got_bad_auth = false;
delete authorizer;
authorizer = NULL;
authorizer_buf.clear();
memset(&connect_msg, 0, sizeof(connect_msg));
memset(&connect_reply, 0, sizeof(connect_reply));

Expand Down Expand Up @@ -1425,17 +1426,19 @@ ssize_t AsyncConnection::_process_connection()

case STATE_ACCEPTING_WAIT_CONNECT_MSG_AUTH:
{
bufferlist authorizer_bl, authorizer_reply;
bufferlist authorizer_reply;

if (connect_msg.authorizer_len) {
r = read_until(connect_msg.authorizer_len, state_buffer);
if (!authorizer_buf.length())
authorizer_buf.push_back(buffer::create(connect_msg.authorizer_len));

r = read_until(connect_msg.authorizer_len, authorizer_buf.c_str());
if (r < 0) {
ldout(async_msgr->cct, 1) << __func__ << " read connect msg failed" << dendl;
ldout(async_msgr->cct, 1) << __func__ << " read connect authorizer failed" << dendl;
goto fail;
} else if (r > 0) {
break;
}
authorizer_bl.append(state_buffer, connect_msg.authorizer_len);
}

ldout(async_msgr->cct, 20) << __func__ << " accept got peer connect_seq "
Expand All @@ -1448,7 +1451,7 @@ ssize_t AsyncConnection::_process_connection()
<< policy.server << " policy.standby=" << policy.standby
<< " policy.resetcheck=" << policy.resetcheck << dendl;

r = handle_connect_msg(connect_msg, authorizer_bl, authorizer_reply);
r = handle_connect_msg(connect_msg, authorizer_buf, authorizer_reply);
if (r < 0)
goto fail;

Expand Down
1 change: 1 addition & 0 deletions src/msg/async/AsyncConnection.h
Expand Up @@ -345,6 +345,7 @@ class AsyncConnection : public Connection {
// Connecting state
bool got_bad_auth;
AuthAuthorizer *authorizer;
bufferlist authorizer_buf;
ceph_msg_connect_reply connect_reply;
// Accepting state
entity_addr_t socket_addr;
Expand Down