From 6c11ccf606b234fe728da63af7a0f1a617143f13 Mon Sep 17 00:00:00 2001 From: LiuPeng Date: Wed, 20 Feb 2019 10:39:00 +0800 Subject: [PATCH] msg/async/rdma: parse IBSYNMsg.lid as hex when receiving message function send_msg encode struct IBSYNMsg to a string, and recv_msg parse the string. In the function send_msg, im.lid (unsigned short int) is formatted into a string with format string %04x, so, recv_msg should read im.lid from the string with format string %hx instead of %hu (unsigned short). Fixes: https://tracker.ceph.com/issues/38391 Signed-off-by: Peng Liu --- src/msg/async/rdma/Infiniband.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/msg/async/rdma/Infiniband.cc b/src/msg/async/rdma/Infiniband.cc index e64f50a4862ea..858cdd1aa4df3 100644 --- a/src/msg/async/rdma/Infiniband.cc +++ b/src/msg/async/rdma/Infiniband.cc @@ -1105,7 +1105,7 @@ int Infiniband::recv_msg(CephContext *cct, int sd, IBSYNMsg& im) ldout(cct, 1) << __func__ << " got bad length (" << r << ") " << dendl; r = -EINVAL; } else { // valid message - sscanf(msg, "%hu:%x:%x:%x:%s", &(im.lid), &(im.qpn), &(im.psn), &(im.peer_qpn),gid); + sscanf(msg, "%hx:%x:%x:%x:%s", &(im.lid), &(im.qpn), &(im.psn), &(im.peer_qpn),gid); wire_gid_to_gid(gid, &(im.gid)); ldout(cct, 5) << __func__ << " recevd: " << im.lid << ", " << im.qpn << ", " << im.psn << ", " << im.peer_qpn << ", " << gid << dendl; } -- 2.39.5