From patchwork Wed Oct 30 13:50:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 2004222 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XdpST6ywHz1xxd for ; Thu, 31 Oct 2024 00:51:21 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 43A114055D; Wed, 30 Oct 2024 13:51:20 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id i57QSA9k8Z-e; Wed, 30 Oct 2024 13:51:19 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 1673B4002A Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id 1673B4002A; Wed, 30 Oct 2024 13:51:19 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C5F71C08A6; Wed, 30 Oct 2024 13:51:18 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 195E2C08A6 for ; Wed, 30 Oct 2024 13:51:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id E030340BB8 for ; Wed, 30 Oct 2024 13:51:04 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id YZ5Ty2eH7xAh for ; Wed, 30 Oct 2024 13:51:04 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.208.65; helo=mail-ed1-f65.google.com; envelope-from=i.maximets.ovn@gmail.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org 7C71940BB2 Authentication-Results: smtp2.osuosl.org; dmarc=none (p=none dis=none) header.from=ovn.org DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 7C71940BB2 Received: from mail-ed1-f65.google.com (mail-ed1-f65.google.com [209.85.208.65]) by smtp2.osuosl.org (Postfix) with ESMTPS id 7C71940BB2 for ; Wed, 30 Oct 2024 13:51:03 +0000 (UTC) Received: by mail-ed1-f65.google.com with SMTP id 4fb4d7f45d1cf-5c97c7852e8so9347971a12.1 for ; Wed, 30 Oct 2024 06:51:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730296261; x=1730901061; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=A7eKS93wpE4btmPbivOpuTVJdPbLil/DPvUJ5TKvuPY=; b=hJ8e7C6O6CaaiYDlT3b0IK09aFD6NXw/biK6oJ490FrqmSeOxbqvX9s3Um9j5IH7ur rGiZFRIFdNs7Kjj9j+9DJNHun2aRJ4ksqdKvhPG3Uda2JdA36CLK2kFnh1rR+BucCjUJ KJnNVG6uETaxf/gFaO/j3ROfQmWlzbJgbiUspaBWwk55NVdL/XXjkGwbyHsQPhSblwFB JxpQjBrV+oM10ntcIJIN3A1YGm77lpxDw09L5mJvY3Vv2JUgJvV/11JdSTT8sp8zoJAN 3IGhqZ8SxhdQam04z8T3AYCgU3wvUq/LcH7kfX5KYT2vqLCgSsuCT5OuTbevKnzBJIYa +bTw== X-Gm-Message-State: AOJu0Yyw0EOHJJm0UPzvg1i4RRR38X6q38Za/xkhXZGvvQIQkjO1mbDK JcRcxftq5VUBLnTNxkLAj/LGN808G2ifAt4VaCxhFJ6MQ92mq1Dw+tRjt7kc X-Google-Smtp-Source: AGHT+IFGLLN6Umjjwoi5jKBYVA/fRMoRpuPrIRqcpq/+pKCbD9hR9RmIsNJ5tr6VyC7J1xV7TEEoYA== X-Received: by 2002:a05:6402:3581:b0:5c9:45f2:b26a with SMTP id 4fb4d7f45d1cf-5cbbf73bbfdmr10921149a12.0.1730296261174; Wed, 30 Oct 2024 06:51:01 -0700 (PDT) Received: from im-t490s.redhat.com (ip-86-49-44-151.bb.vodafone.cz. [86.49.44.151]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5cbb6255be3sm4763479a12.3.2024.10.30.06.50.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2024 06:51:00 -0700 (PDT) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Wed, 30 Oct 2024 14:50:35 +0100 Message-ID: <20241030135043.3139987-7-i.maximets@ovn.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241030135043.3139987-1-i.maximets@ovn.org> References: <20241030135043.3139987-1-i.maximets@ovn.org> MIME-Version: 1.0 Subject: [ovs-dev] [PATCH v2 6/9] ipsec: Make command timeout configurable. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ilya Maximets Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Add a new command line option --command-timeout that controls the command timeout. It is important to have this configurable, because the retransmit-timeout is configurable in Libreswan. Also, users may prefer the monitor to be more responsive. ovs-monitor-ipsec options are not documented anywhere, so not trying to address that here. Signed-off-by: Ilya Maximets --- ipsec/ovs-monitor-ipsec.in | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ipsec/ovs-monitor-ipsec.in b/ipsec/ovs-monitor-ipsec.in index dba855af5..bf7b9c6ad 100755 --- a/ipsec/ovs-monitor-ipsec.in +++ b/ipsec/ovs-monitor-ipsec.in @@ -83,6 +83,7 @@ vlog = ovs.vlog.Vlog("ovs-monitor-ipsec") exiting = False monitor = None xfrm = None +command_timeout = None RECONCILIATION_INTERVAL = 15 # seconds TIEMOUT_EXPIRED = 37 @@ -98,7 +99,7 @@ def run_command(args, description=None): proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) try: - pout, perr = proc.communicate(timeout=120) + pout, perr = proc.communicate(timeout=command_timeout) ret = proc.returncode except subprocess.TimeoutExpired: vlog.warn("Command timed out trying to %s." % description) @@ -1387,6 +1388,10 @@ def main(): parser.add_argument("--ipsec-ctl", metavar="IPSEC-CTL", help="Use DIR/IPSEC-CTL as location for " " pluto ctl socket (libreswan only).") + parser.add_argument("--command-timeout", metavar="TIMEOUT", + type=int, default=120, + help="Timeout for external commands called by the " + "ovs-monitor-ipsec daemon, e.g. ipsec --start.") ovs.vlog.add_args(parser) ovs.daemon.add_args(parser) @@ -1396,11 +1401,13 @@ def main(): global monitor global xfrm + global command_timeout root_prefix = args.root_prefix if args.root_prefix else "" xfrm = XFRM(root_prefix) monitor = IPsecMonitor(root_prefix, args.ike_daemon, not args.no_restart_ike_daemon, args) + command_timeout = args.command_timeout remote = args.database schema_helper = ovs.db.idl.SchemaHelper()