From patchwork Tue Nov 24 12:24:43 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 5778 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:6022:91c9:10b0:11b:d6c:f273 with SMTP id tl9-n1csp4119705lad; Tue, 24 Nov 2026 04:25:29 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErHVSTHlz30wXuOLXEuKhjF5IpaoeM98tv4HSnmQf3q1WZ/oWIqEtCdevrHw9r417jMDEte8+bi4zF4=@openvpn.net X-Received: by 2002:a05:7022:3d14:b0:151:6e80:baa9 with SMTP id a92af1059eb24-1b55687f17dmr22477732c88.12.1795523128702; Tue, 24 Nov 2026 04:25:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1795523128; cv=none; d=google.com; s=arc-20260327; b=W7g5jz5ANb6VljjB/rtxcOJqY28dut2UrM48LZvyYernxiMdwm5fOZasAPZqBJnQlZ 2BbNqWuPLBsee+8Q19cLu2k+QTDVFG480/cpyln0wJBl1CA+7LvVY0jczyigrfNG10N+ iJ0jtQom9aQbodz75+2rPahhP79sfhwkWlXat13bLmofFWyWgdw00s1Qygqgy+E3Xnhf CK9eYXamRzt4O3aiscDLMa3eIaepLVkfHJ3EkQNh0YlocM+m7AxQARLG4kXnGnzrKCCd vtPQY7b8UHsdnKcL/ws57WpEAcTmidl/xnHpej1G9j6m1MBRbUgQK72D4Xt+j3Ra9KTJ MspA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; 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=LluO6+Z+Fbp+Oj9wm/ijJNJQ57eZF2yclyf9hsBAb2c=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=gj9LoOAX1/jQh3RqWIbxVchmE1+OrCCwiu3zZPisEBKUuaPR/KJiRF/iPpT+VzId2I ie7Al1kl5KxCOBzuyvueQodwqsYi8i2BurBaxyZrK2qKU3vAlr5X171p+xRDVPjq/37w RVr3D7nxIgRTNsR3By+OcxDgPCvQWjP//W0MtwWskGLYkqdvGijyz7qT5omYqnLUBTzb E2V+AUe1y3aOXtKJS6udB0ATImJClONkF6zF2GEljmiabj51shaOoJmpVD0lRzpEnugc MTezAs9XQ/rs7nk6ZjGrNMoen9evOswAg4TWsLqnUGEmMOC6CXflUVsFAI+5t8dF/GGz qcHA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=cqgYSKVG; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="Xl/+n5I3"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=D8B2q4SC; 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 a92af1059eb24-1b55f4d233csi32330569c88.45.2026.11.24.04.25.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Nov 2026 04:25:28 -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=cqgYSKVG; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="Xl/+n5I3"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=D8B2q4SC; 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-Unsubscribe-Post: List-Owner; bh=LluO6+Z+Fbp+Oj9wm/ijJNJQ57eZF2yclyf9hsBAb2c=; b=cqgYSKVGlnttii RLJ37FyAXBLhATNOFlVn2oICfDKZAfVK2+/7AIM1PNl/X6BpD2apbqWA0y0XhA3FBTmmFzo8ke3UE rliLu1Y8CXhffbxjv1QJxpvs2CvkmkV9eenYdOC+NDlEfbbcMWLd/8/RFhLVfDlY3ySoGkIB3ZXJR qoI=; 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.100.1) (envelope-from ) id 1xVpaR-000000002A1-2C5i; Tue, 24 Nov 2026 12:25:27 +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.100.1) (envelope-from ) id 1xVpa6-0000000028r-3jUB for openvpn-devel@lists.sourceforge.net; Tue, 24 Nov 2026 12:25:06 +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-Unsubscribe-Post:List-Subscribe:List-Post:List-Owner:List-Archive; bh=e2y3iTZMj+on3EFRHgYodGyPp8Z7iyqykvXOgjrSFgg=; b=Xl/+n5I30t8JHUB58hqE+x7rzF pzI343Cz0Hw4Ju5/IK1UZtncPx33mJpqlwFJjElFMKs1iCI56yJN0C5lVPOqlszf35uNWrouHGP9U XXK52y6ld8sO6cbv0flqMTDy64RlaAy4HPE5CKUQfwI6bD5rTCVlBss2So99e+RJWXOg=; 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-Unsubscribe-Post: List-Subscribe:List-Post:List-Owner:List-Archive; bh=e2y3iTZMj+on3EFRHgYodGyPp8Z7iyqykvXOgjrSFgg=; b=D8B2q4SCZuAp3kLlezq/yZ5buP Pm2L6aU8Ng5ZcF0LLVULbcAr6KCD3jx/C7fWTrFsrP4RLNTKBmZeUpA7Vn1wUJzz8TrbXzu2pDvxn fJIN6wxOA/DSThQyEI/IGYxGv9jLZ1eSmmipy5GtscXsUfoggk2s6c2Z3ro935PVlaOM=; Received: from [193.149.48.129] (helo=blue.greenie.muc.de) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.100.1) id 1xVpZv-000000000rN-39OT for openvpn-devel@lists.sourceforge.net; Tue, 24 Nov 2026 12:24:58 +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 6AOCOm7F008423 for ; Tue, 24 Nov 2026 13:24:48 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 6AOCOmQh008422 for openvpn-devel@lists.sourceforge.net; Tue, 24 Nov 2026 13:24:48 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Tue, 24 Nov 2026 13:24:43 +0100 Message-ID: <20261124122448.8407-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.55.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: Razvan Cojocaru Turn the CM_* defines into enum context_mode and use it for struct context.mode, so -Wswitch covers switches over it. Drop the stale CM_THREAD mention from the comments. 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: 1xVpZv-000000000rN-39OT Subject: [Openvpn-devel] [PATCH v2] openvpn: make the context mode an enum 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: 1882742460031514366 X-GMAIL-MSGID: 1882742460031514366 From: Razvan Cojocaru Turn the CM_* defines into enum context_mode and use it for struct context.mode, so -Wswitch covers switches over it. Drop the stale CM_THREAD mention from the comments. Change-Id: Ifa05b9fd06e5d52818c91c5b160b6dd06ec71396 Signed-off-by: Razvan Cojocaru Acked-by: Lev Stipakov Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2333 --- 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/+/2333 This mail reflects revision 2 of this Change. Acked-by according to Gerrit (reflected above): Lev Stipakov diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 8b64944..10a232c 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -2768,6 +2768,9 @@ case CM_CHILD_TCP: sec = c->options.ce.connect_retry_seconds; break; + + default: + break; } #ifdef ENABLE_DEBUG diff --git a/src/openvpn/openvpn.h b/src/openvpn/openvpn.h index ad6be88..cbda2e3 100644 --- a/src/openvpn/openvpn.h +++ b/src/openvpn/openvpn.h @@ -430,6 +430,16 @@ }; +/** Role of a context within the OpenVPN process */ +enum context_mode +{ + CM_P2P, /**< standalone point-to-point session or client */ + CM_TOP, /**< top level of a multi-client or point-to-multipoint server */ + CM_TOP_CLONE, /**< clone of a CM_TOP context for one thread */ + CM_CHILD_UDP, /**< child context of a CM_TOP */ + CM_CHILD_TCP, /**< child context of a CM_TOP */ +}; + /** * Contains all state information for one tunnel. * @@ -443,22 +453,14 @@ */ struct context { - struct options options; /**< Options loaded from command line or - * configuration file. */ + struct options options; /**< Options loaded from command line or + * configuration file. */ - bool first_time; /**< True on the first iteration of - * OpenVPN's main loop. */ + bool first_time; /**< True on the first iteration of + * OpenVPN's main loop. */ - /* context modes */ -#define CM_P2P 0 /* standalone point-to-point session or client */ -#define CM_TOP 1 /* top level of a multi-client or point-to-multipoint server */ -#define CM_TOP_CLONE 2 /* clone of a CM_TOP context for one thread */ -#define CM_CHILD_UDP 3 /* child context of a CM_TOP or CM_THREAD */ -#define CM_CHILD_TCP 4 /* child context of a CM_TOP or CM_THREAD */ - int mode; /**< Role of this context within the - * OpenVPN process. Valid values are \c - * CM_P2P, \c CM_TOP, \c CM_TOP_CLONE, - * \c CM_CHILD_UDP, and \c CM_CHILD_TCP. */ + enum context_mode mode; /**< Role of this context within the + * OpenVPN process. */ struct multi_context *multi; /**< Pointer to the main P2MP context. * Non-NULL only when mode == CM_TOP. */