summaryrefslogtreecommitdiffstats
path: root/src/msg
diff options
context:
space:
mode:
authorRadoslaw Zarzynski <rzarzyns@redhat.com>2019-02-27 22:03:27 +0100
committerRadoslaw Zarzynski <rzarzyns@redhat.com>2019-03-01 02:50:49 +0100
commit7b7ce58f4e5565e1cbb9a0891bf5957292e17ff3 (patch)
tree957c3a2b50940a35ca80cb5885bf3e80d3d1646f /src/msg
parentmsg/async, v2: use frame epilogue for crc32 integrity checking. (diff)
downloadceph-7b7ce58f4e5565e1cbb9a0891bf5957292e17ff3.tar.xz
ceph-7b7ce58f4e5565e1cbb9a0891bf5957292e17ff3.zip
msg, msg/async, v2: drop crc fields from ceph_msg_header2.
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
Diffstat (limited to 'src/msg')
-rw-r--r--src/msg/async/ProtocolV2.cc30
-rw-r--r--src/msg/async/frames_v2.h7
2 files changed, 8 insertions, 29 deletions
diff --git a/src/msg/async/ProtocolV2.cc b/src/msg/async/ProtocolV2.cc
index 71ed6065e7a..361aa06f9a1 100644
--- a/src/msg/async/ProtocolV2.cc
+++ b/src/msg/async/ProtocolV2.cc
@@ -399,7 +399,7 @@ void ProtocolV2::prepare_send_message(uint64_t features,
}
// encode and copy out of *m
- m->encode(features, messenger->crcflags);
+ m->encode(features, 0);
}
void ProtocolV2::send_message(Message *m) {
@@ -509,16 +509,9 @@ ssize_t ProtocolV2::write_message(Message *m, bool more) {
header.type, header.priority,
header.version,
0, header.data_off,
- ack_seq, footer.front_crc,
- footer.middle_crc, footer.data_crc,
+ ack_seq,
footer.flags, header.compat_version,
- header.reserved, 0};
-
- if (messenger->crcflags & MSG_CRC_HEADER) {
- header2.header_crc =
- ceph_crc32c(0, (unsigned char *)&header2,
- sizeof(header2) - sizeof(header2.header_crc));
- }
+ header.reserved};
auto message = MessageHeaderFrame::Encode(session_stream_handlers,
header2,
@@ -1316,18 +1309,6 @@ CtPtr ProtocolV2::handle_message() {
<< " off " << header.data_off
<< dendl;
- if (messenger->crcflags & MSG_CRC_HEADER) {
- __u32 header_crc = 0;
- header_crc = ceph_crc32c(0, (unsigned char *)&header,
- sizeof(header) - sizeof(header.header_crc));
- // verify header crc
- if (header_crc != header.header_crc) {
- ldout(cct, 0) << __func__ << " got bad header crc " << header_crc
- << " != " << header.header_crc << dendl;
- return _fault();
- }
- }
-
INTERCEPT(16);
// Reset state
@@ -1497,10 +1478,9 @@ CtPtr ProtocolV2::handle_message_complete() {
current_header.compat_version,
current_header.reserved,
0};
- ceph_msg_footer footer{current_header.front_crc, current_header.middle_crc,
- current_header.data_crc, 0, current_header.flags};
+ ceph_msg_footer footer{0, 0, 0, 0, current_header.flags};
- Message *message = decode_message(cct, messenger->crcflags, header, footer,
+ Message *message = decode_message(cct, 0, header, footer,
rx_segments_data[SegmentIndex::Msg::FRONT],
rx_segments_data[SegmentIndex::Msg::MIDDLE],
rx_segments_data[SegmentIndex::Msg::DATA],
diff --git a/src/msg/async/frames_v2.h b/src/msg/async/frames_v2.h
index f1c60db9a4f..dbbb29e6c92 100644
--- a/src/msg/async/frames_v2.h
+++ b/src/msg/async/frames_v2.h
@@ -647,10 +647,6 @@ struct MessageHeaderFrame
// auth tag will be appended at the end
f.payload = session_stream_handlers.tx->authenticated_encrypt_final();
} else {
- f.payload.append(front);
- f.payload.append(middle);
- f.payload.append(data);
-
epilogue_block_t epilogue;
ceph::bufferlist::const_iterator hdriter(&f.payload, FRAME_PREAMBLE_SIZE);
epilogue.crc_values[SegmentIndex::Msg::HEADER] =
@@ -659,6 +655,9 @@ struct MessageHeaderFrame
epilogue.crc_values[SegmentIndex::Msg::MIDDLE] = middle.crc32c(-1),
epilogue.crc_values[SegmentIndex::Msg::DATA] = data.crc32c(-1),
+ f.payload.append(front);
+ f.payload.append(middle);
+ f.payload.append(data);
f.payload.append(reinterpret_cast<const char*>(&epilogue), sizeof(epilogue));
}