From owner-svn-src-all@FreeBSD.ORG Tue Dec 10 20:09:49 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CC1F89B5; Tue, 10 Dec 2013 20:09:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B861C1B7B; Tue, 10 Dec 2013 20:09:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBAK9nsC098209; Tue, 10 Dec 2013 20:09:49 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBAK9n0b098208; Tue, 10 Dec 2013 20:09:49 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201312102009.rBAK9n0b098208@svn.freebsd.org> From: Mikolaj Golub Date: Tue, 10 Dec 2013 20:09:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r259196 - head/sbin/hastd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Dec 2013 20:09:49 -0000 Author: trociny Date: Tue Dec 10 20:09:49 2013 New Revision: 259196 URL: http://svnweb.freebsd.org/changeset/base/259196 Log: 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 Modified: head/sbin/hastd/hastd.c Modified: head/sbin/hastd/hastd.c ============================================================================== --- head/sbin/hastd/hastd.c Tue Dec 10 20:06:41 2013 (r259195) +++ head/sbin/hastd/hastd.c Tue Dec 10 20:09:49 2013 (r259196) @@ -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();