From patchwork Tue Aug 14 07:53:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 957382 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="Wc1d2/LZ"; dkim-atps=neutral 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 41qPxw2msqz9s7Q for ; Tue, 14 Aug 2018 17:54:28 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 02F15C34; Tue, 14 Aug 2018 07:53:13 +0000 (UTC) X-Original-To: ovs-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 ADFD1BE1 for ; Tue, 14 Aug 2018 07:53:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id BB3A21A0 for ; Tue, 14 Aug 2018 07:53:10 +0000 (UTC) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20180814075309euoutp02e95b4acd31ea82fc542cde0350b8a9ee~KsPTrDJO70230702307euoutp02n; Tue, 14 Aug 2018 07:53:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180814075309euoutp02e95b4acd31ea82fc542cde0350b8a9ee~KsPTrDJO70230702307euoutp02n DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1534233189; bh=zjuKhLtL9XYc2hu6DtUlQbMiiQ8kQqgq6vRJYGdGc0g=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=Wc1d2/LZvQ8owEv4il3C4pP+SEbs+Ki/3vyfEC8tvKBS5TlHFOrlZ2CKcMXEo8HbZ p2AJZCuqvsU9sSaVJ/VAkBdPQJ/URyAl42R8rh04ifd+iWmI4eLGa6oJW4iS1uIiv4 MLg78uxotPRtXAmXBtzSioHhgeXe6Ory+0at31iY= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180814075308eucas1p2500fdd2ab08db3b4864e201de0394537~KsPTCzUc50561305613eucas1p2u; Tue, 14 Aug 2018 07:53:08 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id F1.0A.04806.95A827B5; Tue, 14 Aug 2018 08:52:57 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180814075247eucas1p2c3934d9580976705ef343f981b1ee051~KsO-ZsP3A2105021050eucas1p2D; Tue, 14 Aug 2018 07:52:47 +0000 (GMT) X-AuditID: cbfec7f5-79db79c0000012c6-67-5b728a59c787 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id F3.F6.04128.F4A827B5; Tue, 14 Aug 2018 08:52:47 +0100 (BST) Received: from imaximets.rnd.samsung.ru ([106.109.129.180]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PDF00D97XVP2100@eusync1.samsung.com>; Tue, 14 Aug 2018 08:52:47 +0100 (BST) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Tue, 14 Aug 2018 10:53:15 +0300 Message-id: <1534233197-11148-2-git-send-email-i.maximets@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1534233197-11148-1-git-send-email-i.maximets@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprDIsWRmVeSWpSXmKPExsWy7djPc7qRXUXRBhcPGVn8evOA3WLJmits Fq8mNzBaXGn/yW4x99NzRgdWj2c3/zN6PL/Ww+Lxft9VNo++LasYA1iiuGxSUnMyy1KL9O0S uDL+3J7HXrDYp+LVw9mMDYz9pl2MHBwSAiYSK9ptuxi5OIQEVjBKrDm9gw3C+cwosXvbDJYu Rk6wop+3PjJDJJYxSnzv/scI4TQzSfTPb2cFqWIT0JE4tfoII4gtIiAt8br3DStIEbPAREaJ U00HmUESwgIeEjM3vGYHsVkEVCWev1sA1sAr4CZx4t1sRoh1chI3z3WC1XMKuEtsnLsEbLWE wFtWiaMvzzNBFLlILLr1F+o+YYlXx7ewQ9gyEpcnd0PF6yXut7xkhGjuYJSYfugfVLO9xJbX 58AamAX4JCZtm84MCQ1eiY42IYgSD4mpZ08xQbw5i1Fi/+YljBMYJRcwMqxiFE8tLc5NTy02 zkst1ytOzC0uzUvXS87P3cQIjLPT/45/3cG470/SIUYBDkYlHl6OTYXRQqyJZcWVuYcYJTiY lUR4LbcChXhTEiurUovy44tKc1KLDzFKc7AoifPyaaVFCwmkJ5akZqemFqQWwWSZODilGhjn sR91FN1/pFLjwm93o/r8t3Okz3Mt9OT6Ixfx/dRf2WltTw6ERS5w6O3j+igb+e3C6pe34w48 nLR3N/uhpB22PMmLnPdfvPbH0FagaM2MF4lPLhr3aG0M/lK56K/JXR87xVcz5kTciEsWsunW vrfh9J1NL88fY00LXhZ4ZovhVpvTHOExJ1lvK7EUZyQaajEXFScCAA03NfKvAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrFJMWRmVeSWpSXmKPExsVy+t/xy7r+XUXRBscv8ln8evOA3WLJmits Fq8mNzBaXGn/yW4x99NzRgdWj2c3/zN6PL/Ww+Lxft9VNo++LasYA1iiuGxSUnMyy1KL9O0S uDL+3J7HXrDYp+LVw9mMDYz9pl2MnBwSAiYSP299ZO5i5OIQEljCKPHg1Qo2CKeVSeL79J2s IFVsAjoSp1YfYQSxRQSkJV73vmEFKWIWmMgocfo7REJYwENi5obX7CA2i4CqxPN3C8DivAJu EifezWaEWCcncfNcJzOIzSngLrFx7hIwWwio5vbm0+wTGHkWMDKsYhRJLS3OTc8tNtIrTswt Ls1L10vOz93ECAyRbcd+btnB2PUu+BCjAAejEg8vx6bCaCHWxLLiytxDjBIczEoivJZbgUK8 KYmVValF+fFFpTmpxYcYpTlYlMR5zxtURgkJpCeWpGanphakFsFkmTg4pRoYvcV54jW/33mz OuvSxpOdLFccpiZLLCrczuOw0HadQkLT7k/HH25obTeTDFg8J0PzwVrvL9Wv5/kEK35TEamR ucRorD2vRsTEZPnpc37TNf/pHN3nr3GIq+FzZa+iSUvlqvmdO1K+bl0pFeG+qcxw4caGP/HZ +4613PiSw7dMZ93bbVen1E7SVmIpzkg01GIuKk4EAOBequcNAgAA X-CMS-MailID: 20180814075247eucas1p2c3934d9580976705ef343f981b1ee051 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180814075247eucas1p2c3934d9580976705ef343f981b1ee051 References: <1534233197-11148-1-git-send-email-i.maximets@samsung.com> X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ilya Maximets , Alin Gabriel Serdean Subject: [ovs-dev] [PATCH 1/3] utilities: Fix and unify parsing of timeout option. 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 Parsing of the '--timeout' option implemented differently for every single control utility and, which is more important, highly inaccurate. In most cases unsigned result of 'strtoul' stored in signed variable. Parsing failures are not tracked. 'ovs-appctl' even uses just 'atoi' without any checking of the argument or result. This patch unifies the parsing by using 'str_to_uint'. Signed-off-by: Ilya Maximets --- ovn/utilities/ovn-nbctl.c | 8 +++----- ovn/utilities/ovn-sbctl.c | 5 ++--- ovsdb/ovsdb-client.c | 8 +++----- tests/test-ovsdb.c | 8 +++----- utilities/ovs-appctl.c | 7 ++++++- utilities/ovs-dpctl.c | 8 +++----- utilities/ovs-ofctl.c | 8 +++----- utilities/ovs-vsctl.c | 8 +++----- vtep/vtep-ctl.c | 8 +++----- 9 files changed, 29 insertions(+), 39 deletions(-) diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c index 35a3af3..972ba12 100644 --- a/ovn/utilities/ovn-nbctl.c +++ b/ovn/utilities/ovn-nbctl.c @@ -68,7 +68,7 @@ static enum nbctl_wait_type wait_type = NBCTL_WAIT_NONE; static bool force_wait = false; /* --timeout: Time to wait for a connection to 'db'. */ -static int timeout; +static unsigned int timeout; /* Format for table output. */ static struct table_style table_style = TABLE_STYLE_DEFAULT; @@ -345,8 +345,7 @@ handle_main_loop_option(int opt, const char *arg, bool *handled) break; case 't': - timeout = strtoul(arg, NULL, 10); - if (timeout < 0) { + if (!str_to_uint(arg, 10, &timeout) || !timeout) { return xasprintf("value %s on -t or --timeout is invalid", arg); } break; @@ -5358,8 +5357,7 @@ nbctl_client(const char *socket_name, exit(EXIT_SUCCESS); case 't': - timeout = strtoul(po->arg, NULL, 10); - if (timeout < 0) { + if (!str_to_uint(po->arg, 10, &timeout) || !timeout) { ctl_fatal("value %s on -t or --timeout is invalid", po->arg); } break; diff --git a/ovn/utilities/ovn-sbctl.c b/ovn/utilities/ovn-sbctl.c index 7022347..6ec4c80 100644 --- a/ovn/utilities/ovn-sbctl.c +++ b/ovn/utilities/ovn-sbctl.c @@ -69,7 +69,7 @@ static bool oneline; static bool dry_run; /* --timeout: Time to wait for a connection to 'db'. */ -static int timeout; +static unsigned int timeout; /* Format for table output. */ static struct table_style table_style = TABLE_STYLE_DEFAULT; @@ -268,8 +268,7 @@ parse_options(int argc, char *argv[], struct shash *local_options) exit(EXIT_SUCCESS); case 't': - timeout = strtoul(optarg, NULL, 10); - if (timeout < 0) { + if (!str_to_uint(optarg, 10, &timeout) || !timeout) { ctl_fatal("value %s on -t or --timeout is invalid", optarg); } break; diff --git a/ovsdb/ovsdb-client.c b/ovsdb/ovsdb-client.c index cdb021f..7f02188 100644 --- a/ovsdb/ovsdb-client.c +++ b/ovsdb/ovsdb-client.c @@ -332,7 +332,7 @@ parse_options(int argc, char *argv[]) table_style.format = TF_TABLE; for (;;) { - unsigned long int timeout; + unsigned int timeout = 0; int c; c = getopt_long(argc, argv, short_options, long_options, NULL); @@ -366,10 +366,8 @@ parse_options(int argc, char *argv[]) break; case 't': - timeout = strtoul(optarg, NULL, 10); - if (timeout <= 0) { - ovs_fatal(0, "value %s on -t or --timeout is not at least 1", - optarg); + if (!str_to_uint(optarg, 10, &timeout) || !timeout) { + ovs_fatal(0, "value %s on -t or --timeout is invalid", optarg); } else { time_alarm(timeout); } diff --git a/tests/test-ovsdb.c b/tests/test-ovsdb.c index 7932204..4b216fe 100644 --- a/tests/test-ovsdb.c +++ b/tests/test-ovsdb.c @@ -96,7 +96,7 @@ parse_options(int argc, char *argv[], struct test_ovsdb_pvt_context *pvt) char *short_options = ovs_cmdl_long_options_to_short_options(long_options); for (;;) { - unsigned long int timeout; + unsigned int timeout = 0; int c; c = getopt_long(argc, argv, short_options, long_options, NULL); @@ -106,10 +106,8 @@ parse_options(int argc, char *argv[], struct test_ovsdb_pvt_context *pvt) switch (c) { case 't': - timeout = strtoul(optarg, NULL, 10); - if (timeout <= 0) { - ovs_fatal(0, "value %s on -t or --timeout is not at least 1", - optarg); + if (!str_to_uint(optarg, 10, &timeout) || !timeout) { + ovs_fatal(0, "value %s on -t or --timeout is invalid", optarg); } else { time_alarm(timeout); } diff --git a/utilities/ovs-appctl.c b/utilities/ovs-appctl.c index 8f87cc4..d6408ea 100644 --- a/utilities/ovs-appctl.c +++ b/utilities/ovs-appctl.c @@ -133,6 +133,7 @@ parse_command_line(int argc, char *argv[]) e_options = 0; for (;;) { int option; + unsigned int timeout = 0; option = getopt_long(argc, argv, short_options, long_options, NULL); if (option == -1) { @@ -165,7 +166,11 @@ parse_command_line(int argc, char *argv[]) exit(EXIT_SUCCESS); case 'T': - time_alarm(atoi(optarg)); + if (!str_to_uint(optarg, 10, &timeout) || !timeout) { + ovs_fatal(0, "value %s on -T or --timeout is invalid", optarg); + } else { + time_alarm(timeout); + } break; case 'V': diff --git a/utilities/ovs-dpctl.c b/utilities/ovs-dpctl.c index c4db97b..441f804 100644 --- a/utilities/ovs-dpctl.c +++ b/utilities/ovs-dpctl.c @@ -101,7 +101,7 @@ parse_options(int argc, char *argv[]) bool set_names = false; for (;;) { - unsigned long int timeout; + unsigned int timeout = 0; int c; c = getopt_long(argc, argv, short_options, long_options, NULL); @@ -141,10 +141,8 @@ parse_options(int argc, char *argv[]) break; case 't': - timeout = strtoul(optarg, NULL, 10); - if (timeout <= 0) { - ovs_fatal(0, "value %s on -t or --timeout is not at least 1", - optarg); + if (!str_to_uint(optarg, 10, &timeout) || !timeout) { + ovs_fatal(0, "value %s on -t or --timeout is invalid", optarg); } else { time_alarm(timeout); } diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index c3b49db..708e6b2 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -272,7 +272,7 @@ parse_options(int argc, char *argv[]) set_allowed_ofp_versions("OpenFlow10"); for (;;) { - unsigned long int timeout; + unsigned int timeout = 0; int c; c = getopt_long(argc, argv, short_options, long_options, NULL); @@ -282,10 +282,8 @@ parse_options(int argc, char *argv[]) switch (c) { case 't': - timeout = strtoul(optarg, NULL, 10); - if (timeout <= 0) { - ovs_fatal(0, "value %s on -t or --timeout is not at least 1", - optarg); + if (!str_to_uint(optarg, 10, &timeout) || !timeout) { + ovs_fatal(0, "value %s on -t or --timeout is invalid", optarg); } else { time_alarm(timeout); } diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c index d14aa6c..523775c 100644 --- a/utilities/ovs-vsctl.c +++ b/utilities/ovs-vsctl.c @@ -69,7 +69,7 @@ static bool dry_run; static bool wait_for_reload = true; /* --timeout: Time to wait for a connection to 'db'. */ -static int timeout; +static unsigned int timeout; /* --retry: If true, ovs-vsctl will retry connecting to the database forever. * If false and --db says to use an active connection method (e.g. "unix:", @@ -311,10 +311,8 @@ parse_options(int argc, char *argv[], struct shash *local_options) exit(EXIT_SUCCESS); case 't': - timeout = strtoul(optarg, NULL, 10); - if (timeout < 0) { - ctl_fatal("value %s on -t or --timeout is invalid", - optarg); + if (!str_to_uint(optarg, 10, &timeout) || !timeout) { + ctl_fatal("value %s on -t or --timeout is invalid", optarg); } break; diff --git a/vtep/vtep-ctl.c b/vtep/vtep-ctl.c index 35ab435..fb3c81e 100644 --- a/vtep/vtep-ctl.c +++ b/vtep/vtep-ctl.c @@ -65,7 +65,7 @@ static bool oneline; static bool dry_run; /* --timeout: Time to wait for a connection to 'db'. */ -static int timeout; +static unsigned int timeout; /* Format for table output. */ static struct table_style table_style = TABLE_STYLE_DEFAULT; @@ -252,10 +252,8 @@ parse_options(int argc, char *argv[], struct shash *local_options) exit(EXIT_SUCCESS); case 't': - timeout = strtoul(optarg, NULL, 10); - if (timeout < 0) { - ctl_fatal("value %s on -t or --timeout is invalid", - optarg); + if (!str_to_uint(optarg, 10, &timeout) || !timeout) { + ctl_fatal("value %s on -t or --timeout is invalid", optarg); } break; From patchwork Tue Aug 14 07:53:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 957380 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="QxZEi4n/"; dkim-atps=neutral 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 41qPwd4hW1z9rvt for ; Tue, 14 Aug 2018 17:53:21 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 2FD99BBE; Tue, 14 Aug 2018 07:52:56 +0000 (UTC) X-Original-To: ovs-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 BBCEABA2 for ; Tue, 14 Aug 2018 07:52:54 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 998D41A0 for ; Tue, 14 Aug 2018 07:52:53 +0000 (UTC) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180814075252euoutp010bb2a1db97b03f8e48cdfb30dbe4a554~KsPEEvEOM2368123681euoutp01I; Tue, 14 Aug 2018 07:52:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180814075252euoutp010bb2a1db97b03f8e48cdfb30dbe4a554~KsPEEvEOM2368123681euoutp01I DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1534233172; bh=GBMabHdkFv1k1CRHDDy1rbqtiir4uWmGvtvWESfuRa0=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=QxZEi4n/vR+7KKc+8z33oWFo0gedZokZ6l7TdQrogoM+li63Upq2tTd6Wl+ufUVjW cIn5u9kowN8H/sW2aIuTpOaYj+/YS2snlYFtT5q6mq+cy0PsgrdALPwcoXE951ayzs b8i6tc2U+nVkeOfrgW62gXvHz0NSliSJW/0kFqyM= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180814075251eucas1p1d5b4603963453e72f7abd62578e69999~KsPDqznFZ0075300753eucas1p1N; Tue, 14 Aug 2018 07:52:51 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 96.EB.04441.25A827B5; Tue, 14 Aug 2018 08:52:50 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180814075250eucas1p2c27097b854f291aacede252d64fc94ec~KsPCMeOmi2105021050eucas1p2K; Tue, 14 Aug 2018 07:52:50 +0000 (GMT) X-AuditID: cbfec7f2-a1ae89c000001159-6a-5b728a52a88f Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 47.F6.04128.25A827B5; Tue, 14 Aug 2018 08:52:50 +0100 (BST) Received: from imaximets.rnd.samsung.ru ([106.109.129.180]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PDF00D97XVP2100@eusync1.samsung.com>; Tue, 14 Aug 2018 08:52:50 +0100 (BST) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Tue, 14 Aug 2018 10:53:16 +0300 Message-id: <1534233197-11148-3-git-send-email-i.maximets@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1534233197-11148-1-git-send-email-i.maximets@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprNIsWRmVeSWpSXmKPExsWy7djPc7pBXUXRBgfW61r8evOA3WLJmits Fq8mNzBaXGn/yW4x99NzRgdWj2c3/zN6PL/Ww+Lxft9VNo++LasYA1iiuGxSUnMyy1KL9O0S uDIm77zEWLA1teL0lZNMDYzHPbsYOTgkBEwkli/U6GLk5BASWMEo0bsqvIuRC8j+zCjx6/wb RpAESM2J5gZGiMQyRokvZ1ezQjjNTBKTni5nBqliE9CROLX6CFiHiIC0xOveN2BFzAITGSVO NR0EKxIW8JTYdqYBzGYRUJVYMvc0WAOvgJvE/pPrmSHWyUncPNcJZnMKuEtsnLuEGWSQhMBb VolF7duhilwkprWugbpPWOLV8S3sELaMxOXJ3SwQdr3E/ZaXjBDNHYwS0w/9Y4JI2EtseX0O rIFZgE9i0rbpzJDA4JXoaBOCKPGQWPZ7JzvEm7MYJeas+cc8gVFyASPDKkbx1NLi3PTUYsO8 1HK94sTc4tK8dL3k/NxNjMAoO/3v+KcdjF8vJR1iFOBgVOLh3bC+MFqINbGsuDL3EKMEB7OS CK/lVqAQb0piZVVqUX58UWlOavEhRmkOFiVxXj6ttGghgfTEktTs1NSC1CKYLBMHp1QDo/Zr E8FkkZmeMU1ttXc/lYomBrjYKkcHFb5ZsyjOjr/a0kj2LMcL4RaXPL4ti58c3/kk/eOfc581 IpqOz3sQ/nj2qdSZh+pvpW+/I8IYXmMno/yDXX3FDXklTvZ1gcyvJq1U/+mTy/PZctljE1bZ 5z4HFY72sDV+vPn9iRZ/xi7pL5wfdrBVKLEUZyQaajEXFScCAMfrMeKuAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrFJMWRmVeSWpSXmKPExsVy+t/xy7pBXUXRBjvv8lj8evOA3WLJmits Fq8mNzBaXGn/yW4x99NzRgdWj2c3/zN6PL/Ww+Lxft9VNo++LasYA1iiuGxSUnMyy1KL9O0S uDIm77zEWLA1teL0lZNMDYzHPbsYOTkkBEwkTjQ3MHYxcnEICSxhlPi5sIMJwmllkji94RMT SBWbgI7EqdVHGEFsEQFpide9b1hBipgFJjJKnP4OkRAW8JTYdqaBGcRmEVCVWDL3NFicV8BN Yv/J9cwQ6+Qkbp7rBLM5BdwlNs5dAmYLAdXc3nyafQIjzwJGhlWMIqmlxbnpucVGesWJucWl eel6yfm5mxiBIbLt2M8tOxi73gUfYhTgYFTi4eXYVBgtxJpYVlyZe4hRgoNZSYTXcitQiDcl sbIqtSg/vqg0J7X4EKM0B4uSOO95g8ooIYH0xJLU7NTUgtQimCwTB6dUAyP30YfLQ8+/vn2x kOtwwXGWWwrHOvT5i/kv/bXj0Nf45tNmFbf9h+cEqVOv36+PUPVd5nWselGh7u4/xSdreQ4K 9b8T69ILOBqqra1cM+/GVeGgL/9yFs+aFsy0KvWVvN/G+R9WLH276ea2rbz+T6bkbDoZfLN2 u0Txnfy932feOF8waYbShc0aSizFGYmGWsxFxYkATl2m0w0CAAA= X-CMS-MailID: 20180814075250eucas1p2c27097b854f291aacede252d64fc94ec X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180814075250eucas1p2c27097b854f291aacede252d64fc94ec References: <1534233197-11148-1-git-send-email-i.maximets@samsung.com> X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ilya Maximets , Alin Gabriel Serdean Subject: [ovs-dev] [PATCH 2/3] tests: Use environment variable for default timeout. 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 Introduce new 'OVS_CTL_TIMEOUT' environment variable that, if set, will be used as a default timeout for OVS control utilities. Setting it in 'atlocal.in' will cover all the hangs inside the testsuite, even when utils called in a subshell. Signed-off-by: Ilya Maximets --- NEWS | 2 ++ lib/util.c | 18 ++++++++++++++++++ lib/util.h | 2 ++ ovn/utilities/ovn-nbctl.c | 8 ++------ ovn/utilities/ovn-sbctl.c | 4 +--- ovsdb/ovsdb-client.c | 6 +++--- python/ovs/fatal_signal.py | 8 +++++++- tests/appctl.py | 3 +-- tests/atlocal.in | 4 ++++ tests/test-ovsdb.c | 6 +++--- tests/test-ovsdb.py | 4 +++- utilities/ovs-appctl.c | 6 +++--- utilities/ovs-dpctl.c | 7 ++++--- utilities/ovs-ofctl.c | 6 +++--- utilities/ovs-vsctl.c | 4 +--- vtep/vtep-ctl.c | 4 +--- 16 files changed, 58 insertions(+), 34 deletions(-) diff --git a/NEWS b/NEWS index ae21340..5a65964 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,8 @@ Post-v2.10.0 --------------------- - The environment variable OVS_SYSLOG_METHOD, if set, is now used as the default syslog method. + - The environment variable OVS_CTL_TIMEOUT, if set, is now used + as the default timeout for control utilities. v2.10.0 - xx xxx xxxx diff --git a/lib/util.c b/lib/util.c index 082bc7b..66544bf 100644 --- a/lib/util.c +++ b/lib/util.c @@ -629,6 +629,24 @@ get_boot_time(void) return boot_time; } +/* This is a wrapper for setting timeout in control utils. + * The value of OVS_CTL_TIMEOUT environment variable will be used by + * default if 'secs' is not specified. */ +void +ctl_timeout_setup(unsigned int secs) +{ + if (!secs) { + char *env = getenv("OVS_CTL_TIMEOUT"); + + if (env && env[0]) { + str_to_uint(env, 10, &secs); + } + } + if (secs) { + time_alarm(secs); + } +} + /* Returns a pointer to a string describing the program version. The * caller must not modify or free the returned string. */ diff --git a/lib/util.h b/lib/util.h index fd41448..6e29751 100644 --- a/lib/util.h +++ b/lib/util.h @@ -136,6 +136,8 @@ const char *get_subprogram_name(void); unsigned int get_page_size(void); long long int get_boot_time(void); +void ctl_timeout_setup(unsigned int secs); + void ovs_print_version(uint8_t min_ofp, uint8_t max_ofp); OVS_NO_RETURN void out_of_memory(void); diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c index 972ba12..4f7e724 100644 --- a/ovn/utilities/ovn-nbctl.c +++ b/ovn/utilities/ovn-nbctl.c @@ -199,9 +199,7 @@ main(int argc, char *argv[]) VLOG(ctl_might_write_to_db(commands, n_commands) ? VLL_INFO : VLL_DBG, "Called as %s", args); - if (timeout) { - time_alarm(timeout); - } + ctl_timeout_setup(timeout); error = run_prerequisites(commands, n_commands, idl); if (error) { @@ -5381,9 +5379,7 @@ nbctl_client(const char *socket_name, svec_add(&args, argv[i]); } - if (timeout) { - time_alarm(timeout); - } + ctl_timeout_setup(timeout); struct jsonrpc *client; int error = unixctl_client_create(socket_name, &client); diff --git a/ovn/utilities/ovn-sbctl.c b/ovn/utilities/ovn-sbctl.c index 6ec4c80..d0af83f 100644 --- a/ovn/utilities/ovn-sbctl.c +++ b/ovn/utilities/ovn-sbctl.c @@ -120,9 +120,7 @@ main(int argc, char *argv[]) VLOG(ctl_might_write_to_db(commands, n_commands) ? VLL_INFO : VLL_DBG, "Called as %s", args); - if (timeout) { - time_alarm(timeout); - } + ctl_timeout_setup(timeout); /* Initialize IDL. */ idl = the_idl = ovsdb_idl_create(db, &sbrec_idl_class, false, true); diff --git a/ovsdb/ovsdb-client.c b/ovsdb/ovsdb-client.c index 7f02188..18cc135 100644 --- a/ovsdb/ovsdb-client.c +++ b/ovsdb/ovsdb-client.c @@ -328,11 +328,11 @@ parse_options(int argc, char *argv[]) {NULL, 0, NULL, 0}, }; char *short_options = ovs_cmdl_long_options_to_short_options(long_options); + unsigned int timeout = 0; table_style.format = TF_TABLE; for (;;) { - unsigned int timeout = 0; int c; c = getopt_long(argc, argv, short_options, long_options, NULL); @@ -368,8 +368,6 @@ parse_options(int argc, char *argv[]) case 't': if (!str_to_uint(optarg, 10, &timeout) || !timeout) { ovs_fatal(0, "value %s on -t or --timeout is invalid", optarg); - } else { - time_alarm(timeout); } break; @@ -393,6 +391,8 @@ parse_options(int argc, char *argv[]) } } free(short_options); + + ctl_timeout_setup(timeout); } static void diff --git a/python/ovs/fatal_signal.py b/python/ovs/fatal_signal.py index eb4b663..cb2e99e 100644 --- a/python/ovs/fatal_signal.py +++ b/python/ovs/fatal_signal.py @@ -156,8 +156,14 @@ def _init(): def signal_alarm(timeout): + if not timeout: + env_timeout = os.environ.get('OVS_CTL_TIMEOUT') + if env_timeout: + timeout = int(env_timeout) + if not timeout: + return + if sys.platform == "win32": - import os import time import threading diff --git a/tests/appctl.py b/tests/appctl.py index e4f0696..b85b364 100644 --- a/tests/appctl.py +++ b/tests/appctl.py @@ -51,8 +51,7 @@ def main(): help="wait at most SECS seconds for a response") args = parser.parse_args() - if args.timeout: - signal_alarm(int(args.timeout)) + signal_alarm(int(args.timeout) if args.timeout else None) ovs.vlog.Vlog.init() target = args.target diff --git a/tests/atlocal.in b/tests/atlocal.in index a86de8b..abfc1ac 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -216,3 +216,7 @@ unset OVN_SB_DB # Prevent logging to syslog during tests. OVS_SYSLOG_METHOD=null export OVS_SYSLOG_METHOD + +# Set default timeout for control utils +OVS_CTL_TIMEOUT=30 +export OVS_CTL_TIMEOUT diff --git a/tests/test-ovsdb.c b/tests/test-ovsdb.c index 4b216fe..f3f0e49 100644 --- a/tests/test-ovsdb.c +++ b/tests/test-ovsdb.c @@ -94,9 +94,9 @@ parse_options(int argc, char *argv[], struct test_ovsdb_pvt_context *pvt) {NULL, 0, NULL, 0}, }; char *short_options = ovs_cmdl_long_options_to_short_options(long_options); + unsigned int timeout = 0; for (;;) { - unsigned int timeout = 0; int c; c = getopt_long(argc, argv, short_options, long_options, NULL); @@ -108,8 +108,6 @@ parse_options(int argc, char *argv[], struct test_ovsdb_pvt_context *pvt) case 't': if (!str_to_uint(optarg, 10, &timeout) || !timeout) { ovs_fatal(0, "value %s on -t or --timeout is invalid", optarg); - } else { - time_alarm(timeout); } break; @@ -140,6 +138,8 @@ parse_options(int argc, char *argv[], struct test_ovsdb_pvt_context *pvt) } } free(short_options); + + ctl_timeout_setup(timeout); } static void diff --git a/tests/test-ovsdb.py b/tests/test-ovsdb.py index ec60354..c09b237 100644 --- a/tests/test-ovsdb.py +++ b/tests/test-ovsdb.py @@ -815,6 +815,7 @@ def main(argv): sys.stderr.write("%s: %s\n" % (ovs.util.PROGRAM_NAME, geo.msg)) sys.exit(1) + timeout = None for key, value in options: if key in ['-h', '--help']: usage() @@ -826,10 +827,11 @@ def main(argv): except TypeError: raise error.Error("value %s on -t or --timeout is not at " "least 1" % value) - signal_alarm(timeout) else: sys.exit(0) + signal_alarm(timeout) + if not args: sys.stderr.write("%s: missing command argument " "(use --help for help)\n" % ovs.util.PROGRAM_NAME) diff --git a/utilities/ovs-appctl.c b/utilities/ovs-appctl.c index d6408ea..ba0c172 100644 --- a/utilities/ovs-appctl.c +++ b/utilities/ovs-appctl.c @@ -128,12 +128,12 @@ parse_command_line(int argc, char *argv[]) char *short_options = xasprintf("+%s", short_options_); const char *target; int e_options; + unsigned int timeout = 0; target = NULL; e_options = 0; for (;;) { int option; - unsigned int timeout = 0; option = getopt_long(argc, argv, short_options, long_options, NULL); if (option == -1) { @@ -168,8 +168,6 @@ parse_command_line(int argc, char *argv[]) case 'T': if (!str_to_uint(optarg, 10, &timeout) || !timeout) { ovs_fatal(0, "value %s on -T or --timeout is invalid", optarg); - } else { - time_alarm(timeout); } break; @@ -189,6 +187,8 @@ parse_command_line(int argc, char *argv[]) free(short_options_); free(short_options); + ctl_timeout_setup(timeout); + if (optind >= argc) { ovs_fatal(0, "at least one non-option argument is required " "(use --help for help)"); diff --git a/utilities/ovs-dpctl.c b/utilities/ovs-dpctl.c index 441f804..7d99607 100644 --- a/utilities/ovs-dpctl.c +++ b/utilities/ovs-dpctl.c @@ -100,8 +100,9 @@ parse_options(int argc, char *argv[]) char *short_options = ovs_cmdl_long_options_to_short_options(long_options); bool set_names = false; + unsigned int timeout = 0; + for (;;) { - unsigned int timeout = 0; int c; c = getopt_long(argc, argv, short_options, long_options, NULL); @@ -143,8 +144,6 @@ parse_options(int argc, char *argv[]) case 't': if (!str_to_uint(optarg, 10, &timeout) || !timeout) { ovs_fatal(0, "value %s on -t or --timeout is invalid", optarg); - } else { - time_alarm(timeout); } break; @@ -170,6 +169,8 @@ parse_options(int argc, char *argv[]) } free(short_options); + ctl_timeout_setup(timeout); + if (!set_names) { dpctl_p.names = dpctl_p.verbosity > 0; } diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index 708e6b2..c018bd4 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -253,6 +253,7 @@ parse_options(int argc, char *argv[]) char *short_options = ovs_cmdl_long_options_to_short_options(long_options); uint32_t versions; enum ofputil_protocol version_protocols; + unsigned int timeout = 0; /* For now, ovs-ofctl only enables OpenFlow 1.0 by default. This is * because ovs-ofctl implements command such as "add-flow" as raw OpenFlow @@ -272,7 +273,6 @@ parse_options(int argc, char *argv[]) set_allowed_ofp_versions("OpenFlow10"); for (;;) { - unsigned int timeout = 0; int c; c = getopt_long(argc, argv, short_options, long_options, NULL); @@ -284,8 +284,6 @@ parse_options(int argc, char *argv[]) case 't': if (!str_to_uint(optarg, 10, &timeout) || !timeout) { ovs_fatal(0, "value %s on -t or --timeout is invalid", optarg); - } else { - time_alarm(timeout); } break; @@ -391,6 +389,8 @@ parse_options(int argc, char *argv[]) } } + ctl_timeout_setup(timeout); + if (n_criteria) { /* Always do a final sort pass based on priority. */ add_sort_criterion(SORT_DESC, "priority"); diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c index 523775c..a369051 100644 --- a/utilities/ovs-vsctl.c +++ b/utilities/ovs-vsctl.c @@ -156,9 +156,7 @@ main(int argc, char *argv[]) VLOG(ctl_might_write_to_db(commands, n_commands) ? VLL_INFO : VLL_DBG, "Called as %s", args); - if (timeout) { - time_alarm(timeout); - } + ctl_timeout_setup(timeout); /* Initialize IDL. */ idl = the_idl = ovsdb_idl_create(db, &ovsrec_idl_class, false, retry); diff --git a/vtep/vtep-ctl.c b/vtep/vtep-ctl.c index fb3c81e..ab55245 100644 --- a/vtep/vtep-ctl.c +++ b/vtep/vtep-ctl.c @@ -119,9 +119,7 @@ main(int argc, char *argv[]) VLOG(ctl_might_write_to_db(commands, n_commands) ? VLL_INFO : VLL_DBG, "Called as %s", args); - if (timeout) { - time_alarm(timeout); - } + ctl_timeout_setup(timeout); /* Initialize IDL. */ idl = the_idl = ovsdb_idl_create(db, &vteprec_idl_class, false, false); From patchwork Tue Aug 14 07:53:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 957381 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="D4mDlT3f"; dkim-atps=neutral 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 41qPxD0C8Yz9s7Q for ; Tue, 14 Aug 2018 17:53:52 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id EBD1DBC8; Tue, 14 Aug 2018 07:52:57 +0000 (UTC) X-Original-To: ovs-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 244D1BBD for ; Tue, 14 Aug 2018 07:52:57 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id B05862D4 for ; Tue, 14 Aug 2018 07:52:56 +0000 (UTC) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180814075255euoutp011314fc2cc62588aa4d209618017b10af~KsPG8o_SH2325123251euoutp01k; Tue, 14 Aug 2018 07:52:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180814075255euoutp011314fc2cc62588aa4d209618017b10af~KsPG8o_SH2325123251euoutp01k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1534233175; bh=0W03G+Um1/MvnleR5674HiFY3eX3UyQL/1hQtcXGy5M=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=D4mDlT3fELMkKn8VbnmJFbCMxR1PRt0BafuM9PzFWR8kuly/1ehbeHIG6mxhDHuLM mgLY/wRpDm+bixY1nosK3esIfqS5wwVc3sXpl2wYtsT3dkUQPNzIuRRnNgNSBsanxb gaeSK8lv2QI3wSRpXVcR77w1lJ+Y9l/4khBsG3OA= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180814075254eucas1p1afdf987466c07ef117311fb098d7493d~KsPGdpLpZ1083010830eucas1p16; Tue, 14 Aug 2018 07:52:54 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 68.EB.04441.55A827B5; Tue, 14 Aug 2018 08:52:53 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180814075253eucas1p1cb3977de8042395e4a6242be6751b7e9~KsPFRBLMj1083010830eucas1p15; Tue, 14 Aug 2018 07:52:53 +0000 (GMT) X-AuditID: cbfec7f2-a1ae89c000001159-74-5b728a550839 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id C4.97.04284.55A827B5; Tue, 14 Aug 2018 08:52:53 +0100 (BST) Received: from imaximets.rnd.samsung.ru ([106.109.129.180]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PDF00D97XVP2100@eusync1.samsung.com>; Tue, 14 Aug 2018 08:52:53 +0100 (BST) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Tue, 14 Aug 2018 10:53:17 +0300 Message-id: <1534233197-11148-4-git-send-email-i.maximets@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1534233197-11148-1-git-send-email-i.maximets@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprFIsWRmVeSWpSXmKPExsWy7djPc7qhXUXRBq+v2Fj8evOA3WLJmits Fq8mNzBaXGn/yW4x99NzRgdWj2c3/zN6PL/Ww+Lxft9VNo++LasYA1iiuGxSUnMyy1KL9O0S uDLm3HjCXDCbr2LB/cPsDYwfuboYOTkkBEwkls48yNLFyMUhJLCCUWLb52+sIAkhgc+MEp8v O8MUnVp9nBGiaBmjxIT+JqiOZiaJN23nGEGq2AR0gKqOgNkiAtISr3vfsIIUMQtMZJQ41XSQ GSQhLOAs8fHxVSYQm0VAVeLbwfXsXYwcHLwCbhL7TqtDbJOTuHmuE6ycU8BdYuPcJcwQ8bes Eo+6dCFsF4nFpzezQtjCEq+Ob2GHsGUkOjsOMkHY9RL3W16CXS0h0MEoMf3QP6iEvcSW1+fA GpgF+CQmbZvODHKDhACvREebEESJh8TeC6ehPp7FKHFiykemCYySCxgZVjGKp5YW56anFhvm pZbrFSfmFpfmpesl5+duYgTG2Ol/xz/tYPx6KekQowAHoxIP74b1hdFCrIllxZW5hxglOJiV RHgttwKFeFMSK6tSi/Lji0pzUosPMUpzsCiJ8/JppUULCaQnlqRmp6YWpBbBZJk4OKUaGPcJ RtzeJXVIpTd94SFlBe5V2VYXnz0O3sR4/dyEtHm2C4Nc/myQjHT884z1TuRzrdNiOn8k9PWN 1krnveC5vPfHyZxX2rt/ieU8OqJy85Gm1SMh7oirx4qX2HZ42+3L0PawUZxVFXm2+eQju6d/ zlxeJBakqLL0LaeTer9ondhn42LVE5v8xJRYijMSDbWYi4oTAQz/PXmtAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrJJMWRmVeSWpSXmKPExsVy+t/xy7qhXUXRBl2NMha/3jxgt1iy5gqb xavJDYwWV9p/slvM/fSc0YHV49nN/4wez6/1sHi833eVzaNvyyrGAJYoLpuU1JzMstQifbsE row5N54wF8zmq1hw/zB7A+NHri5GTg4JAROJU6uPM3YxcnEICSxhlNi8/iAbhNPKJLG6bQMz SBWbgA5Q1RFGEFtEQFride8bVpAiZoGJjBKnv0MkhAWcJT4+vsoEYrMIqEp8O7ievYuRg4NX wE1i32l1iG1yEjfPdYLN5BRwl9g4dwmYLQRUcnvzafYJjDwLGBlWMYqklhbnpucWG+oVJ+YW l+al6yXn525iBAbItmM/N+9gvLQx+BCjAAejEg8vx6bCaCHWxLLiytxDjBIczEoivJZbgUK8 KYmVValF+fFFpTmpxYcYpTlYlMR5zxtURgkJpCeWpGanphakFsFkmTg4pRoYXQuWhGu4BodM PHFWeF3CjIM6YV/qnoszZL08NKXjb2Hw9KTCS7n2pUfCVM/ILa6097DpvCsnIl1V6vzU5+Px 9OZJf56/7tB6J3Cq6bOJ/Z25Jx9Z7Zi7LPigSJXR1SMsNzb5vsji0u/tM9VvqqzikGOYGq6z 7+TEI8sXf9kXf+L+SlefY8vWKLEUZyQaajEXFScCAL86I4AMAgAA X-CMS-MailID: 20180814075253eucas1p1cb3977de8042395e4a6242be6751b7e9 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180814075253eucas1p1cb3977de8042395e4a6242be6751b7e9 References: <1534233197-11148-1-git-send-email-i.maximets@samsung.com> X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ilya Maximets , Alin Gabriel Serdean Subject: [ovs-dev] [PATCH 3/3] tests: Drop setting aliases for control utils. 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 Not needed anymore. 'OVS_CTL_TIMEOUT' env used instead. Signed-off-by: Ilya Maximets --- tests/ovs-macros.at | 41 ----------------------------------------- 1 file changed, 41 deletions(-) diff --git a/tests/ovs-macros.at b/tests/ovs-macros.at index 677eea7..066c25c 100644 --- a/tests/ovs-macros.at +++ b/tests/ovs-macros.at @@ -114,47 +114,6 @@ if test "$IS_WIN32" = "yes"; then } fi -# Try to add a default timeout for the following control utilities: -# - ovs-vsctl -# - ovs-ofctl -# - ovs-appctl -# - ovn-sbctl -# - ovn-nbctl -# - vtep-ctl -# Set default timeout for 30 seconds. -# This should be sufficient on all platforms. -OVS_TIMEOUT=30 -alias ovs-vsctl='OVS_VSCTL_TIMEOUT' >/dev/null 2>&1 -if [ $? -eq 0 ]; then - OVS_VSCTL_TIMEOUT () { - command ovs-vsctl --timeout=$OVS_TIMEOUT "$@" - } - alias ovs-ofctl='OVS_OFCTL_TIMEOUT' - alias ovs-appctl='OVS_APPCTL_TIMEOUT' - alias ovn-sbctl='OVS_SBCTL_TIMEOUT' - alias ovn-nbctl='OVN_NBCTL_TIMEOUT' - alias vtep-ctl='VTEP_CTL_TIMEOUT' - alias ovsdb-client='OVSDB_CLIENT_TIMEOUT' - OVS_OFCTL_TIMEOUT () { - command ovs-ofctl --timeout=$OVS_TIMEOUT "$@" - } - OVS_APPCTL_TIMEOUT () { - command ovs-appctl --timeout=$OVS_TIMEOUT "$@" - } - OVS_SBCTL_TIMEOUT () { - command ovn-sbctl --timeout=$OVS_TIMEOUT "$@" - } - OVN_NBCTL_TIMEOUT () { - command ovn-nbctl --timeout=$OVS_TIMEOUT "$@" - } - VTEP_CTL_TIMEOUT () { - command vtep-ctl --timeout=$OVS_TIMEOUT "$@" - } - OVSDB_CLIENT_TIMEOUT () { - command ovsdb-client --timeout=$OVS_TIMEOUT "$@" - } -fi - # parent_pid PID # # Prints the PID of the parent of process PID.