aboutsummaryrefslogtreecommitdiff
path: root/sbin/hastd
diff options
context:
space:
mode:
authorMikolaj Golub <trociny@FreeBSD.org>2013-12-10 20:09:49 +0000
committerMikolaj Golub <trociny@FreeBSD.org>2013-12-10 20:09:49 +0000
commitf8665529d49d09a72aa47e62b0ed6f1ba2d8a6d7 (patch)
treefea45f10019f58245a133a6cccc69ad15ddee937 /sbin/hastd
parent9c539971148b466f8331594294ba8b4a44e7c7db (diff)
downloadsrc-f8665529d49d09a72aa47e62b0ed6f1ba2d8a6d7.tar.gz
src-f8665529d49d09a72aa47e62b0ed6f1ba2d8a6d7.zip
Check remote protocol version only for the first connection (when it
is actually sent by the remote node). Otherwise it generated confusing "Negotiated protocol version 1" debug messages when processing the second connection. MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=259196
Diffstat (limited to 'sbin/hastd')
-rw-r--r--sbin/hastd/hastd.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sbin/hastd/hastd.c b/sbin/hastd/hastd.c
index 06b38e91331f..bac390ae7abd 100644
--- a/sbin/hastd/hastd.c
+++ b/sbin/hastd/hastd.c
@@ -806,12 +806,6 @@ listen_accept(struct hastd_listen *lst)
*/
version = 1;
}
- if (version > HAST_PROTO_VERSION) {
- pjdlog_info("Remote protocol version %hhu is not supported, falling back to version %hhu.",
- version, (unsigned char)HAST_PROTO_VERSION);
- version = HAST_PROTO_VERSION;
- }
- pjdlog_debug(1, "Negotiated protocol version %hhu.", version);
token = nv_get_uint8_array(nvin, &size, "token");
/*
* NULL token means that this is first connection.
@@ -925,6 +919,12 @@ listen_accept(struct hastd_listen *lst)
*/
if (token == NULL) {
+ if (version > HAST_PROTO_VERSION) {
+ pjdlog_info("Remote protocol version %hhu is not supported, falling back to version %hhu.",
+ version, (unsigned char)HAST_PROTO_VERSION);
+ version = HAST_PROTO_VERSION;
+ }
+ pjdlog_debug(1, "Negotiated protocol version %hhu.", version);
res->hr_version = version;
arc4random_buf(res->hr_token, sizeof(res->hr_token));
nvout = nv_alloc();