X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fagent-thread.c;h=1caf748432a4ec1918cab71a87b4788e02da1e47;hb=79865500b89925b61767294821e0706a57d493d5;hp=6790a63c642bd78bb37484a6c6af0b1af39081c7;hpb=fefd409b002735b415c5f653cdb2587be454f145;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/agent-thread.c b/src/bin/lttng-sessiond/agent-thread.c index 6790a63c6..1caf74843 100644 --- a/src/bin/lttng-sessiond/agent-thread.c +++ b/src/bin/lttng-sessiond/agent-thread.c @@ -198,6 +198,7 @@ static int handle_registration(struct lttcomm_sock *reg_sock, { int ret; pid_t pid; + uint32_t major_version, minor_version; ssize_t size; enum lttng_domain_type domain; struct agent_app *app; @@ -214,11 +215,23 @@ static int handle_registration(struct lttcomm_sock *reg_sock, size = new_sock->ops->recvmsg(new_sock, &msg, sizeof(msg), 0); if (size < sizeof(msg)) { - ret = -errno; + ret = -EINVAL; goto error_socket; } domain = be32toh(msg.domain); pid = be32toh(msg.pid); + major_version = be32toh(msg.major_version); + minor_version = be32toh(msg.minor_version); + + /* Test communication protocol version of the registring agent. */ + if (major_version != AGENT_MAJOR_VERSION) { + ret = -EINVAL; + goto error_socket; + } + if (minor_version != AGENT_MINOR_VERSION) { + ret = -EINVAL; + goto error_socket; + } DBG2("[agent-thread] New registration for pid %d domain %d on socket %d", pid, domain, new_sock->fd);