From patchwork Thu May 14 19:27:21 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4945 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:a719:b0:84a:48f:a1fd with SMTP id hl25csp4066362mab; Thu, 14 May 2026 12:27:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AFNElJ+ENCUO6gOk1bJKreQjlIaQqP1Z+LmObWnxvWKfQSZcfD2+wV3iQHKCv6KHllMnftD55iWFqYLGy+s=@openvpn.net X-Received: by 2002:a05:6870:9a27:b0:439:f098:860b with SMTP id 586e51a60fabf-43a2de94df0mr636917fac.34.1778786861991; Thu, 14 May 2026 12:27:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1778786861; cv=none; d=google.com; s=arc-20240605; b=bN6pJPjhfabVJu6W09BhohY6AZCiP6q3Ft1xRvlegbRJymoJnw6ANrQGFN+b0P2ruX CfuZq+1S4BuGolFvYY//ofJGSk/uz2kwtg4tTPVCaiiGi4/IOTajD5UyqvlKAgu8kBuz it3YFy2v5b0thEN78/jqaG2Sdoy3aEUBnDXmj06WUA5k2LodfQeunvFzw5VA7/VbElSt pLBWe18IMevxJusqiHPWAFmWVrVXwrbAhlBRKcyPbHErDnUt0/8cfAxIlTOblxy0T64A Zf5+UQV9KD++FhJXaSd8bkXr/hFS/QHqBTRzaDw9nUUAZDK+S5j5/zW5YINzm72efB3X yKQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature; bh=8LlFEyKMvzE4AqAOYV3pyQmRBxPGa2j1WR5ZgK9Z9IA=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=imJmHwTA81NUEqMAvEi4cusM15FIGCaKgdlpWd04z1Q2D1I+daDOb/tSwjcN3q0FqG UZlMqlLv7BTUG+3Y8Nl5GNBic1az3YgTqzP4GCOP/t7WSnVWySK3H81/YtFBbiLMe26i dCGTeIdXFyvFjM384w+CoyQ6OFhboIlbv2UZUIMXqQ2mhUYqCjrHWRz4scQEyvkbto2+ jn/ebJqvPh0M/Hf4Dtbc0s1CrFa3wYDWdjMLq4bxABUp0q5nWvX0PUUrEgE3Ffvv87fc 6xPb9l1W9rL1RzwBu+kz8M4wKN+WWLBzORjqVI2+9AxOaRQu+v3UB8laWxlGew+w/2d/ 0Q6w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=HoqWwNa1; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=YyjAYvZi; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=jDHFxqax; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 586e51a60fabf-439fc6def96si2511723fac.214.2026.05.14.12.27.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 May 2026 12:27:41 -0700 (PDT) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=HoqWwNa1; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=YyjAYvZi; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=jDHFxqax; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8LlFEyKMvzE4AqAOYV3pyQmRBxPGa2j1WR5ZgK9Z9IA=; b=HoqWwNa1LmMn3zBDmef2MnDvoa GOd4e+Chu2pRa5p+VBm7mJ269lxz6s+Z4aCncehDlAx/pZ0xJ8Dg07LZEJev+A1t7OXntn0mkkC+a Z6OriGEB0EOSZxSLGBwmh6KKbCy08zXkDHdS3Q+aTbtzJGRSBWjgdmjg9xysvMAC14Q4=; Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1wNbie-0005xU-Te; Thu, 14 May 2026 19:27:38 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1wNbic-0005xL-V8 for openvpn-devel@lists.sourceforge.net; Thu, 14 May 2026 19:27:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=gHSl4ExTWcAo/O0B1+5mwc45i9K42nMjvHtIsync6A4=; b=YyjAYvZi9EJgtrx/qG3hzwF5OM WTeLU9jFy2X8j63shXZ35eE1dMy/GnQBEYjs9B/HfVxxdzWkjbcZV9WJpSOjWAgoF7dOTE44HITS5 DvqXDhsUwbFYnQAJ5LijG5pdTA1ttREc6z/PJIIZoW+i1X9rV9J90pzu81E95+nc+Nws=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=gHSl4ExTWcAo/O0B1+5mwc45i9K42nMjvHtIsync6A4=; b=jDHFxqaxZbxj/bv9qtCKPGLLUb TEHWZ/IahCTwTMHr4X5zQDyZH0PTc7kgIId/AcEtDXCnPmuXkX1+GkzZfOrMpoDMMgHyBTk+IxTn3 MZMy2ebGKuCoeENeAss6LjaHt67r+k1DgLppSKxS+ZT7EUju7nePNaV/BPlTf9eieCYg=; Received: from [193.149.48.129] (helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1wNbiY-0006CA-2L for openvpn-devel@lists.sourceforge.net; Thu, 14 May 2026 19:27:36 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.18.1/8.18.1) with ESMTP id 64EJRRHQ032188 for ; Thu, 14 May 2026 21:27:27 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 64EJRRPB032187 for openvpn-devel@lists.sourceforge.net; Thu, 14 May 2026 21:27:27 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Thu, 14 May 2026 21:27:21 +0200 Message-ID: <20260514192727.31903-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-1.hosts.colo.sdot.me", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Frank Lichtenheld Use the atoi_constrained function. Change-Id: Ic9ac18f730e6035126ccf1cf19799548e5fd9316 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/open [...] Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1wNbiY-0006CA-2L Subject: [Openvpn-devel] [PATCH v8] options: Move <= 0 check for keepalive settings earlier X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1865193212580041439?= X-GMAIL-MSGID: =?utf-8?q?1865193212580041439?= From: Frank Lichtenheld Use the atoi_constrained function. Change-Id: Ic9ac18f730e6035126ccf1cf19799548e5fd9316 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1155 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1155 This mail reflects revision 8 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpn/helper.c b/src/openvpn/helper.c index 9e7ad93..4c540a6 100644 --- a/src/openvpn/helper.c +++ b/src/openvpn/helper.c @@ -552,14 +552,10 @@ /* * Sanity checks. */ - if (o->keepalive_ping <= 0 || o->keepalive_timeout <= 0) - { - msg(M_USAGE, "--keepalive parameters must be > 0"); - } if (o->keepalive_ping * 2 > o->keepalive_timeout) { msg(M_USAGE, - "the second parameter to --keepalive (restart timeout=%d) must be at least twice the value of the first parameter (ping interval=%d). A ratio of 1:5 or 1:6 would be even better. Recommended setting is --keepalive 10 60.", + "The second parameter to --keepalive (restart timeout=%d) must be at least twice the value of the first parameter (ping interval=%d). A ratio of 1:5 or 1:6 would be even better. Recommended setting is --keepalive 10 60.", o->keepalive_timeout, o->keepalive_ping); } if (o->ping_send_timeout || o->ping_rec_timeout) diff --git a/src/openvpn/options.c b/src/openvpn/options.c index e75b452..51d0418 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -6755,8 +6755,8 @@ else if (streq(p[0], "keepalive") && p[1] && p[2] && !p[3]) { VERIFY_PERMISSION(OPT_P_GENERAL); - options->keepalive_ping = atoi_warn(p[1], msglevel); - options->keepalive_timeout = atoi_warn(p[2], msglevel); + atoi_constrained(p[1], &options->keepalive_ping, "keepalive ping", 1, INT_MAX, msglevel); + atoi_constrained(p[2], &options->keepalive_timeout, "keepalive timeout", 1, INT_MAX, msglevel); } else if (streq(p[0], "ping") && p[1] && !p[2]) {