]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async/rdma: parse IBSYNMsg.lid as hex when receiving message 26525/head
authorLiuPeng <liupeng37@baidu.com>
Wed, 20 Feb 2019 02:39:00 +0000 (10:39 +0800)
committerPeng Liu <liupeng37@baidu.com>
Thu, 21 Feb 2019 01:52:32 +0000 (09:52 +0800)
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 <liupeng37@baidu.com>
src/msg/async/rdma/Infiniband.cc

index e64f50a4862eab4d27c9ffe95c46f0853166be91..858cdd1aa4df3842351e8fb95b95850665cfca62 100644 (file)
@@ -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;
   }