From 3f2c5fcc29e125fd43d1c63e422a389e82a3379f Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 2 Feb 2012 11:41:58 -0500 Subject: [PATCH] Verify UST comm proto version Signed-off-by: Mathieu Desnoyers --- src/bin/lttng-sessiond/ust-app.c | 7 +++++++ src/bin/lttng-sessiond/ust-app.h | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index 778880487..2b66b92c0 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -1275,6 +1275,13 @@ int ust_app_register(struct ust_register_msg *msg, int sock) close(sock); return -EINVAL; } + if (msg->major != LTTNG_UST_COMM_MAJOR) { + ERR("Registration failed: application \"%s\" (pid: %d) has " + "communication protocol version %u.%u, but sessiond supports 2.x.\n", + msg->name, msg->pid, msg->major, msg->minor); + close(sock); + return -EINVAL; + } lta = zmalloc(sizeof(struct ust_app)); if (lta == NULL) { PERROR("malloc"); diff --git a/src/bin/lttng-sessiond/ust-app.h b/src/bin/lttng-sessiond/ust-app.h index 0fb854fbe..5bfecdb47 100644 --- a/src/bin/lttng-sessiond/ust-app.h +++ b/src/bin/lttng-sessiond/ust-app.h @@ -24,7 +24,8 @@ #include "trace-ust.h" /* lttng-ust supported version. */ -#define UST_APP_MAJOR_VERSION 1 +#define LTTNG_UST_COMM_MAJOR 2 /* comm protocol major version */ +#define UST_APP_MAJOR_VERSION 2 /* UST version supported */ #define UST_APP_EVENT_LIST_SIZE 32 -- 2.34.1