]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/Pipe: only randomize start seq #'s if MSG_AUTH feature is present
authorSage Weil <sage@inktank.com>
Tue, 30 Oct 2012 17:00:42 +0000 (10:00 -0700)
committerSage Weil <sage@inktank.com>
Tue, 30 Oct 2012 17:00:42 +0000 (10:00 -0700)
The kernel client expects seq #'s to start at 1 or else it is unhappy.
So, only randomize these values if the MSG_AUTH feature is present--that is
the only time it matters anyway.

Signed-off-by: Sage Weil <sage@inktank.com>
src/msg/Pipe.cc

index 8192e04d2a627d132886af16595d118d389d9d72..9edafaec14a885ab98852a9287bf99c03d30eecc 100644 (file)
@@ -1103,15 +1103,17 @@ void Pipe::fault(bool onread)
 
 int Pipe::randomize_out_seq()
 {
-  // Set out_seq to a random value, so CRC won't be predictable.   Don't bother checking seq_error 
-  // here.  We'll check it on the call.  PLR
-
-  int seq_error = get_random_bytes((char *)&out_seq, sizeof(out_seq));
-
-
-  out_seq &= SEQ_MASK;
-  lsubdout(msgr->cct, ms, 10) << "randomize_out_seq " << out_seq << dendl;
-  return seq_error;
+  if (connection_state->get_features() & CEPH_FEATURE_MSG_AUTH) {
+    // Set out_seq to a random value, so CRC won't be predictable.   Don't bother checking seq_error
+    // here.  We'll check it on the call.  PLR
+    int seq_error = get_random_bytes((char *)&out_seq, sizeof(out_seq));
+    out_seq &= SEQ_MASK;
+    lsubdout(msgr->cct, ms, 10) << "randomize_out_seq " << out_seq << dendl;
+    return seq_error;
+  } else {
+    // previous, seq #'s always started at 1.
+    return 1;
+  }
 }
 
 void Pipe::was_session_reset()