From: Julien Desfossez Date: Wed, 14 Feb 2018 21:32:45 +0000 (-0500) Subject: Fix: reply to version check even on protocol mismatch X-Git-Tag: v2.9.8~5 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=40096142f5428ba357fc69e6a9a1330c72ac7e5e;p=lttng-tools.git Fix: reply to version check even on protocol mismatch In the relay, we currently put() the connection when we detect that the major version from the session daemon is not compatible. We don't reply to the version check message. The relay still holds a reference on the connection so it is not closed and the session daemon is left blocking in recvmsg. The relay now replies to the version check so the session daemon knows it is not compatible, and the relay completely closes the connection on its side and removes the FD from the poll set. Signed-off-by: Julien Desfossez Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c index b70026242..4f368ddac 100644 --- a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c @@ -1593,6 +1593,7 @@ static int relay_send_version(struct lttcomm_relayd_hdr *recv_hdr, { int ret; struct lttcomm_relayd_version reply, msg; + bool compatible = true; conn->version_check_done = 1; @@ -1617,9 +1618,7 @@ static int relay_send_version(struct lttcomm_relayd_hdr *recv_hdr, if (reply.major != be32toh(msg.major)) { DBG("Incompatible major versions (%u vs %u), deleting session", reply.major, be32toh(msg.major)); - connection_put(conn); - ret = 0; - goto end; + compatible = false; } conn->major = reply.major; @@ -1638,6 +1637,11 @@ static int relay_send_version(struct lttcomm_relayd_hdr *recv_hdr, ERR("Relay sending version"); } + if (!compatible) { + ret = -1; + goto end; + } + DBG("Version check done using protocol %u.%u", conn->major, conn->minor);