From patchwork Tue Feb 17 13:56:05 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Lichtenheld X-Patchwork-Id: 4771 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7001:ab03:b0:838:aef6:1aff with SMTP id xi3csp554005mab; Tue, 17 Feb 2026 05:56:27 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUh589jgX7mayo/eV5zC2c8p+Fd8raGuFVcN734svhKwFXfqtgftZgYEh5cL+YO3msM8WnAmsnu1J0=@openvpn.net X-Received: by 2002:a05:6820:2913:b0:663:e51:5eb3 with SMTP id 006d021491bc7-67767866f81mr6951867eaf.34.1771336587039; Tue, 17 Feb 2026 05:56:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1771336587; cv=none; d=google.com; s=arc-20240605; b=WxLno2/FOYl4iSlRABOE1j8mRo7i5rrCzvG6lOpikbYpngKX3PUluSiBgGr945Lwn2 doLmGp2K4ob1GvwuSwe9nlKADTKtl0kUvwbHkcfP8DgHL5zlU/V/7/XUs04iFU1DNN9p NlAWgvt4Z3Aq+0qKmGihb3Ltb+HI7DWYUvqpp48IROAvpsoIiWKrcsJJ9OqtWZZ8ovCl exW+wOfhb5Cb3rUUXea1twmwqZcEU2SzKZw4E8c2CrWA86U6QrFJHoz0uq0fglntxX9E dptN5zO7o5wQ8Ck0pVVA4tNr+wwOdIsUIuUOu4pccSYAgnTf1NwRLA9g5eWFvFYMFhMT dP8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:content-transfer-encoding:cc: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:dkim-signature; bh=7IPQF5JX/9mybel3D11La0Zf+tVKRLwnCrYVJNy9+rY=; fh=10tBNjXj/wkJoIBSfHvI5xr4knRr+m5zCVrzABMRuHI=; b=MclB+E2PuBE7u85QJdQUizbvMqVAMEL2o3Z39lfD5UOw6DskudAd8RsxWh68SUpI9n NjLqN/+KPN77GH8GpWl55Q0NoAIgSp/C3JxrA9FJE/gVh688DwG3iVr+s8Zkf5mgeS8z fC2Zc0dYqIxyQwX59u90ThWskWJ2pbyLtHRcFWTvw9Bnn6f/+nhNcI1McMmcUGPU6uzC oGgKsavjiCAoWm0e0qx+ZPlz8JpCAGYV3b6QVG0PdLoTsIg2031xG1tIRqeM9dMqWE07 4h5doID95klibqbie6w5KqQLfi2tSbNfRUxx7zMLHQWaFGNumELUtDx6JK2pEzME6Upt JYaA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=fm4Tqm05; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=Ff5CvKIE; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=gLi114tH; dkim=neutral (body hash did not verify) header.i=@lichtenheld.com header.s=MBO0001 header.b="WQ/LrgZv"; 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 Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 006d021491bc7-6747310c9c5si10725598eaf.27.2026.02.17.05.56.26 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Feb 2026 05:56:26 -0800 (PST) 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=fm4Tqm05; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=Ff5CvKIE; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=gLi114tH; dkim=neutral (body hash did not verify) header.i=@lichtenheld.com header.s=MBO0001 header.b="WQ/LrgZv"; 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 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:Cc: 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:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7IPQF5JX/9mybel3D11La0Zf+tVKRLwnCrYVJNy9+rY=; b=fm4Tqm05r/Oa4TqK6txEdaBXdW WR5O/LOOTScUXmlHZPbpgcMEWcOgZicjj9jzTZ0cJK0utXy/dHHYHGKa1D7bu+9Ji4Cjp8FPxW38/ u8kgpmJY/c18knvH4xUoA6lzyMl0a7z7DtyMwJfViZesCYu0DxNB4PVOlZTptowItrVk=; Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1vsLYv-0005cB-1k; Tue, 17 Feb 2026 13:56:25 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1vsLYt-0005c3-1e for openvpn-devel@lists.sourceforge.net; Tue, 17 Feb 2026 13:56:24 +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:Cc:To:From:Sender:Reply-To: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=UBYoQxSN6u2A2xskKWNuvxNUAUyjIC6iJSo6XrAfV7g=; b=Ff5CvKIE6Yc+BQWTaVQwwlkN/k M+705V8JLDhq8xisjJ133DIQiH4OpNf2VOK3OS6JXJjYUq78NwFbp3ORwVP+ikQyyBTcscIURdxDW b0GvbEc2TKxKZBVzwnJdEjGPXMiRDJNh3OFu8jAltx+wNMDJ8lY/6Xq1UEbMiKidWO00=; 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:Cc:To:From:Sender:Reply-To: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=UBYoQxSN6u2A2xskKWNuvxNUAUyjIC6iJSo6XrAfV7g=; b=gLi114tHv6w3cLiqws3J36oiN5 rleuO1+FrL2xN1AzSc7luAVVlNR9Aii2KlljLvXGbL7iQAEoRUvLbJMik622+FzmirXf4gwDPQx5I XAse7W9h58rgrynPwoFtUqRLHr11eTgShr2gy2gNmoKgsisN0bniVATAQZG70fPzT7GI=; Received: from mout-p-202.mailbox.org ([80.241.56.172]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1vsLYr-0005zH-EC for openvpn-devel@lists.sourceforge.net; Tue, 17 Feb 2026 13:56:22 +0000 Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4fFh4l5JGZz9tTM; Tue, 17 Feb 2026 14:56:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lichtenheld.com; s=MBO0001; t=1771336567; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UBYoQxSN6u2A2xskKWNuvxNUAUyjIC6iJSo6XrAfV7g=; b=WQ/LrgZvOn2ldkphwy+My0kpP2q/8o2ayGtrjUpRxcxRd23Nm3tD2P3Oi9iEpmsdbxlcmG DQlywVTvgLh6CPzCS7qVHda4MTz+aag/L+KdkHWrhW7qsySwSCO6VF6x50rQlJW9R0c9Lt LbLq6VNOvQQfk6vcchDAuIlTOJZqwsPHw3pJlN8J2P1dK8/vO7lgNSFwZ9Otak3SeD26fW 5qK3iCPb/Es4oQRy7ImNXxJAWVH9fijb1VWQyujT2YTOkrrLqKUe+YD17fLWly4xTZhbzC NucNAhKFSu1vkGZWj+5g+EHuZIjuY68MCWkqpkIoCiVEXt1ZjwnfLPe0t5gVBg== From: Frank Lichtenheld To: openvpn-devel@lists.sourceforge.net Date: Tue, 17 Feb 2026 14:56:05 +0100 Message-ID: <20260217135605.154129-1-frank@lichtenheld.com> In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-2.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: Antonio Quartulli The init_option() function is always invoked with the second param "init_gc" set to "true". This makes the parameter useless and it can therefore be removed while always taking the "true" branch in th [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-Headers-End: 1vsLYr-0005zH-EC Subject: [Openvpn-devel] [PATCH v2] options: drop useless init_gc param for init_options() 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: , Cc: Antonio Quartulli Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1857381033036693063?= X-GMAIL-MSGID: =?utf-8?q?1857381033036693063?= From: Antonio Quartulli The init_option() function is always invoked with the second param "init_gc" set to "true". This makes the parameter useless and it can therefore be removed while always taking the "true" branch in the related logic. This way we can also drop the options->gc_owned member as it would also be always set to true. Change-Id: I633d8cbf75ab4da85e16df44684aef60523811c5 Signed-off-by: Antonio Quartulli Acked-by: Frank Lichtenheld Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1536 --- 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/+/1536 This mail reflects revision 2 of this Change. Acked-by according to Gerrit (reflected above): Frank Lichtenheld diff --git a/src/openvpn/openvpn.c b/src/openvpn/openvpn.c index b7eca19..f38660f 100644 --- a/src/openvpn/openvpn.c +++ b/src/openvpn/openvpn.c @@ -202,7 +202,7 @@ #endif /* initialize options to default state */ - init_options(&c.options, true); + init_options(&c.options); /* parse command line options, and read configuration file */ parse_argv(&c.options, argc, argv, M_USAGE, OPT_P_DEFAULT, NULL, c.es); diff --git a/src/openvpn/options.c b/src/openvpn/options.c index cdb02e9..4e1e32a 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -792,15 +792,12 @@ * will be set to 0. */ void -init_options(struct options *o, const bool init_gc) +init_options(struct options *o) { CLEAR(*o); - if (init_gc) - { - gc_init(&o->gc); - gc_init(&o->dns_options.gc); - o->gc_owned = true; - } + gc_init(&o->gc); + gc_init(&o->dns_options.gc); + o->mode = MODE_POINT_TO_POINT; o->topology = TOP_UNDEF; o->ce.proto = PROTO_UDP; @@ -925,11 +922,9 @@ { CLEAR(*o->remote_list); } - if (o->gc_owned) - { - gc_free(&o->gc); - gc_free(&o->dns_options.gc); - } + + gc_free(&o->gc); + gc_free(&o->dns_options.gc); } #ifndef ENABLE_SMALL @@ -2256,7 +2251,7 @@ int dev = DEV_TYPE_UNDEF; bool pull = false; - init_options(&defaults, true); + init_options(&defaults); if (!options->test_crypto) { @@ -4824,7 +4819,7 @@ #else struct options o; - init_options(&o, true); + init_options(&o); fprintf(fp, usage_message, title_string, o.ce.connect_retry_seconds, o.ce.connect_retry_seconds_max, o.ce.local_port, o.ce.remote_port, TUN_MTU_DEFAULT, @@ -5979,7 +5974,7 @@ struct options sub; struct connection_entry *e; - init_options(&sub, true); + init_options(&sub); sub.ce = options->ce; read_config_string("[CONNECTION-OPTIONS]", &sub, p[1], msglevel, OPT_P_CONNECTION, option_types_found, es); diff --git a/src/openvpn/options.h b/src/openvpn/options.h index cf9936b..3d8b505 100644 --- a/src/openvpn/options.h +++ b/src/openvpn/options.h @@ -254,7 +254,6 @@ struct options { struct gc_arena gc; - bool gc_owned; /* first config file */ const char *config; @@ -890,7 +889,7 @@ void show_dco_version(const unsigned int flags); -void init_options(struct options *o, const bool init_gc); +void init_options(struct options *o); void uninit_options(struct options *o); diff --git a/tests/unit_tests/openvpn/test_options_parse.c b/tests/unit_tests/openvpn/test_options_parse.c index bb34f01..0b3d7fe 100644 --- a/tests/unit_tests/openvpn/test_options_parse.c +++ b/tests/unit_tests/openvpn/test_options_parse.c @@ -248,7 +248,6 @@ CLEAR(o); /* NB: avoiding init_options to limit dependencies */ gc_init(&o.gc); gc_init(&o.dns_options.gc); - o.gc_owned = true; char *p_expect_someopt[MAX_PARMS]; char *p_expect_otheropt[MAX_PARMS];