From patchwork Tue May 2 20:22:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Han Zhou X-Patchwork-Id: 757808 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wHXly1bycz9s7f for ; Wed, 3 May 2017 06:22:54 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="EBVkMonz"; dkim-atps=neutral Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 0536EBD7; Tue, 2 May 2017 20:22:40 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 4371ABD6 for ; Tue, 2 May 2017 20:22:39 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg0-f66.google.com (mail-pg0-f66.google.com [74.125.83.66]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 4FD3018A for ; Tue, 2 May 2017 20:22:38 +0000 (UTC) Received: by mail-pg0-f66.google.com with SMTP id i63so4863885pgd.2 for ; Tue, 02 May 2017 13:22:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=geq2nl1tdKPZSbgTQC86jL/OuO4Qp6BojO5fFQuV/Yo=; b=EBVkMonzm5q604cBpAGLgoYyHt00iwJ7pN+IvcskHt3vEaSZGcTa28cMrVfuT+SHuh nGRc0o/8eyW9swQ5VGO2Byb1Qq8DcLb8Vd5Otx8HRA+ALhpwGa2/ay0YKXhDiJi5wPRt OCXdLNpHKiPrD9dxqVeia/LVEpPxQTwacTDKkMFR+aeeBi8wFpW4+MqHfnYZEMUUrUh/ bfwXh762akzuN//GlZrbGziJqPFovyxnl1QFIeugbIwrqRQxtVb0cnhcGa8A1wIMSusO szAQwBIabV6UjTl8UShqTma1WQ6MXm0uNUOXfnaI/GqvreeVIlGSnkwnHUromf2PU6yu fQzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=geq2nl1tdKPZSbgTQC86jL/OuO4Qp6BojO5fFQuV/Yo=; b=KIaZTe1O/dEcv/Rgs5k2IV/XxKM8NYHznpHRrSJmGm+JpYqOKhUPqed+oisrjWmPv+ JBpij/tAjf+Vbw4F2CAy8C4HcANgIssU1CPtV7cSnnNLgLVc9CO+bZPg1lxx0++4QHs0 yHwBtt7CVSSBYQrkB48tjmGt0aMaO5USAF52TuU6PiTk1/PjJDkgOVCo9w7NYQkTEDIT Tp258WZ+kulSotPJ+JW0hD33cETLmr2B1rp9hrboFkDXGwGXFAOzK1R4BZvIkYDjuEUR yYkjddoEydQzHef2NxPTIW2kWRylScYLwGYLXPUHE7kjvvKxwI3bN+ImpoxmCE1AXljq e8kA== X-Gm-Message-State: AN3rC/5rc1PF2eIyAl+JfxjzVQdaCO0+PBUz2Lhn7DJZKND9prAxlL4z 7fK38ceFMN4Hz+/1 X-Received: by 10.98.25.78 with SMTP id 75mr941589pfz.84.1493756557731; Tue, 02 May 2017 13:22:37 -0700 (PDT) Received: from localhost.localdomain.localdomain ([216.113.160.71]) by smtp.gmail.com with ESMTPSA id u78sm514941pfa.47.2017.05.02.13.22.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 May 2017 13:22:37 -0700 (PDT) From: Han Zhou To: dev@openvswitch.org Date: Tue, 2 May 2017 13:22:35 -0700 Message-Id: <1493756555-24633-1-git-send-email-zhouhan@gmail.com> X-Mailer: git-send-email 2.1.0 X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH] ovn-controller: Disable probes by default for unix sockets. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Normally the OVS JSON-RPC library does not probe idle connections across Unix domain sockets, since the kernel can tell OVS whether the connections are truly connected without probes, but ovn-controller carelessly overrode that. (This should not be an issue in typical OVN deployments, because the OVN SB database is normally accessed via TCP or SSL.) CC: Nirapada Ghosh Fixes: 715038b6b222 ("ovn-controller: reload configured SB probe timer") Signed-off-by: Han Zhou Co-authored-by: Ben Pfaff --- ovn/controller/ovn-controller.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/ovn/controller/ovn-controller.c b/ovn/controller/ovn-controller.c index 5fa900d..c18582a 100644 --- a/ovn/controller/ovn-controller.c +++ b/ovn/controller/ovn-controller.c @@ -64,7 +64,8 @@ static unixctl_cb_func inject_pkt; #define DEFAULT_BRIDGE_NAME "br-int" #define DEFAULT_PROBE_INTERVAL_MSEC 5000 -static void update_probe_interval(struct controller_ctx *); +static void update_probe_interval(struct controller_ctx *, + const char *ovnsb_remote); static void parse_options(int argc, char *argv[]); OVS_NO_RETURN static void usage(void); @@ -594,7 +595,7 @@ main(int argc, char *argv[]) .ovnsb_idl_txn = ovsdb_idl_loop_run(&ovnsb_idl_loop), }; - update_probe_interval(&ctx); + update_probe_interval(&ctx, ovnsb_remote); update_ssl_config(ctx.ovs_idl); @@ -925,14 +926,21 @@ inject_pkt(struct unixctl_conn *conn, int argc OVS_UNUSED, /* Get the desired SB probe timer from the OVS database and configure it into * the SB database. */ static void -update_probe_interval(struct controller_ctx *ctx) +update_probe_interval(struct controller_ctx *ctx, const char *ovnsb_remote) { const struct ovsrec_open_vswitch *cfg = ovsrec_open_vswitch_first(ctx->ovs_idl); - int interval = (cfg - ? smap_get_int(&cfg->external_ids, - "ovn-remote-probe-interval", - DEFAULT_PROBE_INTERVAL_MSEC) - : DEFAULT_PROBE_INTERVAL_MSEC); + int interval = -1; + if (cfg) { + interval = smap_get_int(&cfg->external_ids, + "ovn-remote-probe-interval", + -1); + } + if (interval == -1) { + interval = stream_or_pstream_needs_probes(ovnsb_remote) + ? DEFAULT_PROBE_INTERVAL_MSEC + : 0; + } + ovsdb_idl_set_probe_interval(ctx->ovnsb_idl, interval); }