Add version to agent registration message
authorDavid Goulet <dgoulet@efficios.com>
Fri, 19 Sep 2014 17:58:31 +0000 (13:58 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Fri, 19 Sep 2014 19:01:22 +0000 (15:01 -0400)
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng-sessiond/agent-thread.c
src/bin/lttng-sessiond/agent.h

index 6790a63c642bd78bb37484a6c6af0b1af39081c7..0e827a4456d4c0ea9c37b54818bbcb6ba4c5e7a7 100644 (file)
@@ -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;
@@ -219,6 +220,18 @@ static int handle_registration(struct lttcomm_sock *reg_sock,
        }
        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);
index f8d9ca6ea5b35eabac13c6182e0a3c6a5bca2966..6564b88c84f6e260d1f875074d6bb313fa4b73aa 100644 (file)
 #include <common/hashtable/hashtable.h>
 #include <lttng/lttng.h>
 
+/* Agent protocol version that is verified during the agent registration. */
+#define AGENT_MAJOR_VERSION            1
+#define AGENT_MINOR_VERSION            0
+
 /*
  * Hash table that contains the agent app created upon registration indexed by
  * socket.
@@ -43,6 +47,8 @@ struct agent_register_msg {
        /* This maps to a lttng_domain_type. */
        uint32_t domain;
        uint32_t pid;
+       uint32_t major_version;
+       uint32_t minor_version;
 };
 
 /*
This page took 0.026665 seconds and 4 git commands to generate.