From patchwork Sun Jan 31 20:09:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Cox X-Patchwork-Id: 1586 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director11.mail.ord1d.rsapps.net ([172.31.255.6]) by backend30.mail.ord1d.rsapps.net with LMTP id 2BnNLCjTF2AbMQAAIUCqbw (envelope-from ) for ; Mon, 01 Feb 2021 05:08:40 -0500 Received: from proxy13.mail.iad3b.rsapps.net ([172.31.255.6]) by director11.mail.ord1d.rsapps.net with LMTP id 6DCmLCjTF2CyCgAAvGGmqA (envelope-from ) for ; Mon, 01 Feb 2021 05:08:40 -0500 Received: from smtp32.gate.iad3b ([172.31.255.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy13.mail.iad3b.rsapps.net with LMTPS id UMDYJSjTF2B3cwAAvUvv+w (envelope-from ) for ; Mon, 01 Feb 2021 05:08:40 -0500 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp32.gate.iad3b.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dmarc=fail (p=none; dis=none) header.from=mozilla.com X-Suspicious-Flag: YES X-Classification-ID: 74bda282-6475-11eb-96f2-5254006a2e70-1-1 Received: from [216.105.38.7] ([216.105.38.7:57528] helo=lists.sourceforge.net) by smtp32.gate.iad3b.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id AC/C8-30546-823D7106; Mon, 01 Feb 2021 05:08:40 -0500 Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1l6W7l-0003AN-1k; Mon, 01 Feb 2021 10:08:01 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6W7j-0003A9-0U for openvpn-devel@lists.sourceforge.net; Mon, 01 Feb 2021 10:07:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=FS7Nx9mV34UTX0bnGW/P2TzhygZ2DfM4rMgYMEEzzSI=; b=loxeMCSkZY9IkwpYJTKWIIp1Ml jX8qNjz3yvwGZmWp9lCbFwHG6kAeATJnBS01cHPAREIG0mfCuVuWxQ7lvClLstBon+S1TuVAPQHsG PxfS4V0xjWzy6ypsTOcuoIVfscom+aGWpLipNQDDsaNcXfZNYNLCZEWVkgwL9QSOQtXU=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version: Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=FS7Nx9mV34UTX0bnGW/P2TzhygZ2DfM4rMgYMEEzzSI=; b=FWazB8YfuoAD01p5ItcJiO/dR+ izJ5A5Cx0tKWkqgvEPzm57PnLUnmSonSt+TM1JgGNb6qPj4cyaVv7eb8wxQjVTncPOAUXBnIJ+Iz1 3P7Cu6XkMCqFH1ovosaa0zICEbawVdMalC7Ns6xHXWmiDNeOVAsvMGtUUHT09wkXDYmk=; Received: from smtp1.mdc1.mozilla.com ([63.245.208.103] helo=smtp.mozilla.org) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1l6W7e-00ALAh-QS for openvpn-devel@lists.sourceforge.net; Mon, 01 Feb 2021 10:07:58 +0000 Received: from localhost (localhost4.localdomain [127.0.0.1]) by smtp1.mail.mdc1.mozilla.com (Postfix) with ESMTP id D9A1AA1F1A; Mon, 1 Feb 2021 07:10:23 +0000 (UTC) Received: from smtp.mozilla.org ([127.0.0.1]) by localhost (smtp1.mail.mdc1.mozilla.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PtoQ6T6sGctm; Mon, 1 Feb 2021 07:10:23 +0000 (UTC) Received: from centos7-rpmbuild1.private.mdc1.mozilla.com (centos7-rpmbuild1.private.mdc1.mozilla.com [10.48.75.35]) by smtp1.mail.mdc1.mozilla.com (Postfix) with ESMTPS id B1FC9A1F18; Mon, 1 Feb 2021 07:10:23 +0000 (UTC) From: Greg Cox To: openvpn-devel@lists.sourceforge.net Date: Mon, 1 Feb 2021 07:09:49 +0000 Message-Id: <1612163389-16421-1-git-send-email-gcox@mozilla.com> X-Mailer: git-send-email 2.7.6 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-Headers-End: 1l6W7e-00ALAh-QS Subject: [Openvpn-devel] [PATCH] Explain structvar usage in sample defer plugin. 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: , MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox sample-plugins/defer/simple.c uses OPENVPN_PLUGINv3_STRUCTVER settings that may not be obvious to a new author. Add a comment to reduce possible confusion. Acked-By: David Sommerseth --- sample/sample-plugins/defer/simple.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sample/sample-plugins/defer/simple.c b/sample/sample-plugins/defer/simple.c index 05bfc4efa6d85bb1696b6811428260f4cc5e9914..6f08bedd6319827c05786303f8a4007791042208 100644 --- a/sample/sample-plugins/defer/simple.c +++ b/sample/sample-plugins/defer/simple.c @@ -69,12 +69,18 @@ static plugin_log_t plugin_log = NULL; * Constants indicating minimum API and struct versions by the functions * in this plugin. Consult openvpn-plugin.h, look for: * OPENVPN_PLUGIN_VERSION and OPENVPN_PLUGINv3_STRUCTVER + * + * Strictly speaking, this sample code only requires plugin_log, a feature + * of structver version 1. However, '1' lines up with ancient versions + * of openvpn that are past end-of-support. As such, we are requiring + * structver '5' here to indicate a desire for modern openvpn, rather + * than a need for any particular feature found in structver beyond '1'. */ #define OPENVPN_PLUGIN_VERSION_MIN 3 #define OPENVPN_PLUGIN_STRUCTVER_MIN 5 /* -* Our context, where we keep our state. + * Our context, where we keep our state. */ struct plugin_context { @@ -160,7 +166,6 @@ openvpn_plugin_open_v3(const int v3structver, const char **envp = args->envp; /* environment variables */ struct plugin_context *context; - /* Check API compatibility -- struct version 5 or higher needed */ if (v3structver < OPENVPN_PLUGIN_STRUCTVER_MIN) { fprintf(stderr, "%s: this plugin is incompatible with the running version of OpenVPN\n", MODULE); @@ -442,7 +447,6 @@ openvpn_plugin_func_v3(const int v3structver, struct openvpn_plugin_args_func_in const *args, struct openvpn_plugin_args_func_return *ret) { - /* Check API compatibility -- struct version 5 or higher needed */ if (v3structver < OPENVPN_PLUGIN_STRUCTVER_MIN) { fprintf(stderr, "%s: this plugin is incompatible with the running version of OpenVPN\n", MODULE);