From patchwork Thu Mar 23 17:05:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 3160 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7301:10f:b0:b2:6796:f29 with SMTP id gj15csp72981dyb; Thu, 23 Mar 2023 10:06:43 -0700 (PDT) X-Google-Smtp-Source: AKy350aglD45n7qM0NmC/JUPDQFdthhJE18qZDQdYHN+mZPauMDFIA2mbIRDKeZVROAEXh4oJqan X-Received: by 2002:a92:dc4d:0:b0:325:ca46:7c59 with SMTP id x13-20020a92dc4d000000b00325ca467c59mr182725ilq.30.1679591203247; Thu, 23 Mar 2023 10:06:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679591203; cv=none; d=google.com; s=arc-20160816; b=0OSXd99e7KnYLcSaIcQBI4XL6VhjVxhljtWSbDaGfFed7b80b2xR7jzX9qhYWfIeJU hUKLakAdnM5sGM6MUkFj2VHfjNGks6rbN8KARQN+nsWAbGllIhd1WJX3E8QSI71Ja0gd DCEMt+Hw+MS9cHtqGa071DM6VQmmik3DwZCaEgQvPWtW9s0Ou5FanSbKJTbes83ajqfL P5qaevvBFNkVXOQF8vkV/JY6incFJHPwHSuNS/pEL4KACZHV/y/1ljZY2cziJ3ChH41k mcvKfkMa5j9ONMNQ371wk4oBeRp/wyCYAPg4yXPCAhjRqYOSJTc3OZTGwLlmIW9Q6ygk n2DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:message-id:date:to:from:dkim-signature:dkim-signature; bh=jC8FiTnLC3Z/gckyURPm/f1PG8GzyzV4EYJKnIPkipc=; b=wXFaWK+T6U6Ber+FcnsiT6vSo5xeT7HKeizObongmfLO2eXTk0ZNtZLnf3qun7P1d3 HjLgojfjqJDY/aLEvTsey1RPygUl1zfjU8XbxF7XN4lLJXji69agVi0g+GHd8LieB39a rd1nxAQKRBBM3tsV+Ph+1XUjMLHhXWXiuooq0LuiZCfimLkusuFj+hovy1pkAElZE/JZ 0StwXQ+6//xHg8wSHPZ3b0P3o15pT/soEnK+OTcqStqdwIQfLdMW3G5gfYG+92y+al7T Aikxn6bKow6Ta809QOHUHGgiyfXW+Jxoc5nF7JxDcXm/U2eOgXxLSzjl2tMxv2nQsZwy gXug== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=BrR9uABc; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=QWMx1BZl; 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 ([216.105.38.7]) by mx.google.com with ESMTPS id u5-20020a056638134500b004061d6abcd0si20935102jad.125.2023.03.23.10.06.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Mar 2023 10:06:43 -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=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=BrR9uABc; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=QWMx1BZl; 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 [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 1pfOOJ-0007ek-17; Thu, 23 Mar 2023 17:06:19 +0000 Received: from [172.30.20.202] (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 1pfOOG-0007eJ-8u for openvpn-devel@lists.sourceforge.net; Thu, 23 Mar 2023 17:06:16 +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: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:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=t/HhlgHlxpV5ftgbPwkITRzCP3jUk7rMrQ0jFOj0tZU=; b=BrR9uABcFKRjWOaGPc2term37X 8e1wx73P8uLdyWcCaZTcehfc2g4KTY1B+usdVpvqK808bBI5Sx962QU9CaqG0ZFSdut8dEOxQprLv NpQPnniCtSfUXMj38TGNtt4SmF7R3UiqFpKgNelN43+KexXDuGsDmCmlsGdANwKMO0tY=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version: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:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=t/HhlgHlxpV5ftgbPwkITRzCP3jUk7rMrQ0jFOj0tZU=; b=Q WMx1BZlXhECtzfGeDQDcTQg+tztrrdB5aqB7Jpf8pweplIPxjZ4vRW32xhqqjXrfuSry0sve5dxC/ fd3n+0pY+deZEGxPDGpasqqFogzwbgS5soCicwbz7rlFBaIrRc7u7m6L7sUHKzcM9iNIxA2gtn6GG z9gwXrwobqfAP5dc=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1pfOOF-0004VW-0J for openvpn-devel@lists.sourceforge.net; Thu, 23 Mar 2023 17:06:15 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.95 (FreeBSD)) (envelope-from ) id 1pfOO1-000M0Q-JA for openvpn-devel@lists.sourceforge.net; Thu, 23 Mar 2023 18:06:01 +0100 Received: (nullmailer pid 1256178 invoked by uid 10006); Thu, 23 Mar 2023 17:06:01 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Thu, 23 Mar 2023 18:05:58 +0100 Message-Id: <20230323170601.1256132-1-arne@rfc2549.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Score: 0.3 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-2.v13.lw.sourceforge.com", 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: This removes a level of identation and make the "stub" condition easier to see. Change-Id: Iae47b191f522625f81eedd3a237b272cb7374d90 Signed-off-by: Arne Schwabe --- src/openvpn/options.c | 87 +++++++++++++++++++++ 1 file changed, 43 insert [...] Content analysis details: (0.3 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record X-Headers-End: 1pfOOF-0004VW-0J Subject: [Openvpn-devel] [PATCH v3 1/4] Simplify --compress parsing in options.c 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?1761179025131924255?= X-GMAIL-MSGID: =?utf-8?q?1761179025131924255?= This removes a level of identation and make the "stub" condition easier to see. Change-Id: Iae47b191f522625f81eedd3a237b272cb7374d90 Signed-off-by: Arne Schwabe Acked-by: Gert Doering --- src/openvpn/options.c | 87 +++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 44 deletions(-) diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 64a8250b2..2bed4ce99 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -8458,60 +8458,59 @@ add_option(struct options *options, else if (streq(p[0], "compress") && !p[2]) { VERIFY_PERMISSION(OPT_P_COMP); + const char *alg = "stub"; if (p[1]) { - if (streq(p[1], "stub")) - { - options->comp.alg = COMP_ALG_STUB; - options->comp.flags |= (COMP_F_SWAP|COMP_F_ADVERTISE_STUBS_ONLY); - } - else if (streq(p[1], "stub-v2")) - { - options->comp.alg = COMP_ALGV2_UNCOMPRESSED; - options->comp.flags |= COMP_F_ADVERTISE_STUBS_ONLY; - } - else if (streq(p[1], "migrate")) - { - options->comp.alg = COMP_ALG_UNDEF; - options->comp.flags = COMP_F_MIGRATE; + alg = p[1]; + } - } - else if (options->comp.flags & COMP_F_ALLOW_STUB_ONLY) - { - /* Also printed on a push to hint at configuration problems */ - msg(msglevel, "Cannot set compress to '%s', " - "allow-compression is set to 'no'", p[1]); - goto err; - } + if (streq(alg, "stub")) + { + options->comp.alg = COMP_ALG_STUB; + options->comp.flags |= (COMP_F_SWAP|COMP_F_ADVERTISE_STUBS_ONLY); + } + else if (streq(alg, "stub-v2")) + { + options->comp.alg = COMP_ALGV2_UNCOMPRESSED; + options->comp.flags |= COMP_F_ADVERTISE_STUBS_ONLY; + } + else if (streq(alg, "migrate")) + { + options->comp.alg = COMP_ALG_UNDEF; + options->comp.flags = COMP_F_MIGRATE; + + } + else if (options->comp.flags & COMP_F_ALLOW_STUB_ONLY) + { + /* Also printed on a push to hint at configuration problems */ + msg(msglevel, "Cannot set compress to '%s', " + "allow-compression is set to 'no'", alg); + goto err; + } #if defined(ENABLE_LZO) - else if (streq(p[1], "lzo")) - { - options->comp.alg = COMP_ALG_LZO; - options->comp.flags &= ~(COMP_F_ADAPTIVE | COMP_F_SWAP); - } + else if (streq(alg, "lzo")) + { + options->comp.alg = COMP_ALG_LZO; + options->comp.flags &= ~(COMP_F_ADAPTIVE | COMP_F_SWAP); + } #endif #if defined(ENABLE_LZ4) - else if (streq(p[1], "lz4")) - { - options->comp.alg = COMP_ALG_LZ4; - options->comp.flags |= COMP_F_SWAP; - } - else if (streq(p[1], "lz4-v2")) - { - options->comp.alg = COMP_ALGV2_LZ4; - } -#endif - else - { - msg(msglevel, "bad comp option: %s", p[1]); - goto err; - } + else if (streq(alg, "lz4")) + { + options->comp.alg = COMP_ALG_LZ4; + options->comp.flags |= COMP_F_SWAP; + } + else if (streq(alg, "lz4-v2")) + { + options->comp.alg = COMP_ALGV2_LZ4; } +#endif else { - options->comp.alg = COMP_ALG_STUB; - options->comp.flags |= COMP_F_SWAP; + msg(msglevel, "bad comp option: %s", alg); + goto err; } + show_compression_warning(&options->comp); } #endif /* USE_COMP */