From patchwork Tue Mar 21 10:28:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 3144 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:2310:b0:9f:bfa4:120f with SMTP id r16csp2284314dye; Tue, 21 Mar 2023 03:30:07 -0700 (PDT) X-Google-Smtp-Source: AK7set+8SnOIedj+Jo37kQ9yxWra/u+iKzyiOXpuSYhNhw/yjcQ12CUytMiC/zmXFpm8b8lwkkec X-Received: by 2002:a17:903:2291:b0:19c:dbce:dce8 with SMTP id b17-20020a170903229100b0019cdbcedce8mr2216269plh.15.1679394607775; Tue, 21 Mar 2023 03:30:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679394607; cv=none; d=google.com; s=arc-20160816; b=OtI7DfEL7eXhDOp8k63GkpBrLTAXPbhPv2s1XQARA3gIkBVUFwH6/Xl+1W+tbEi/zr 5w2/FK19egxr42aa2i7tiOPLrxpbobKsKbw6cGX0kpwsCa2Ngjbfy+IG1ULt7VwVSKxX wt0F20s1cW2J4j3BcxpQyQBXA3m4FAyVvT1lFBUntBQuHFpN/07mS9DMjQqAIWyo5ghQ vCqVsjJuqd8/xB2WPC6/ThWdjjy0tcrAygOiJYfpTr1BlGP0WkC+PKwSIvQuxSYWpG8M CzIdR64ex7tQp+D53mxphvI4B44rYemQkCOKwjQ7x+CBj/knE/CJEj+zNV+zEq4eXT+/ matQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:content-transfer-encoding:cc: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 :dkim-signature; bh=l+m8Hab09LR9RsmWsp6W0rt38yKOBdzfRqq1XhO+10A=; b=HVUO87aNP+qDyH/mjw2ySTTzdc0m6eyPwFeAgvQ6WJWopQlcDH6gDH9rVLw4dL48Mh atTj3fJbaTDZGRSPtAuOb+zx2q9xNpVy2Tfwb78c+dxmx84yLqg4f8yu1Q7HdfJNfthu k3hQffiTMHd0KuFrl3EejaMAGLunY/pTbwIM5hG9IwebKAM1ru+TIcznXDc9NQ28qqat TbzW7aWWoukfe1AiHb4tUjlbOnTXjjnUfEloWS/kQrvyEtBiQ4jixWgHuUkbqO5r1vEL lfFXL0yRAxRVro1FKHDzwAxZuP8+QrNcCZh+SN1Qu4rlm01AHz3bl/WPgKxuzBAt5xbW mw8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="Gev/c6R8"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=IjY81Xxn; dkim=fail header.i=@unstable.cc header.s=20220809-q8oc header.b=D8URf+Cc; 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 kk3-20020a170903070300b001a1bb59111bsi8635548plb.604.2023.03.21.03.30.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Mar 2023 03:30:07 -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="Gev/c6R8"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=IjY81Xxn; dkim=fail header.i=@unstable.cc header.s=20220809-q8oc header.b=D8URf+Cc; 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-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1peZEz-0008NV-La; Tue, 21 Mar 2023 10:29:18 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1peZEv-0008NP-A2 for openvpn-devel@lists.sourceforge.net; Tue, 21 Mar 2023 10:29:13 +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: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:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=dfI2QPomvMfoN535oi76AZFvXadyTHIV2hpKBgtyKyA=; b=Gev/c6R8cRpZ24sSb89J/rjg7I B2RywPqxgSERGeyGj3nhqaBfRn+iTkaHE8dKi8N4Y74Rd9IY2W46tYtSFrylc92+wUEeu6Cbw0pVR ThXnvu23YvDLt/dxwWaDzoA1CqLoOFIAiBOhMDca0G7dIROWhsdnp8lPsMUdPAq42NSg=; 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: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:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=dfI2QPomvMfoN535oi76AZFvXadyTHIV2hpKBgtyKyA=; b=I jY81XxnSWmFltnS5LqCci4F4WoAEBteYxDBMxzJiGO6Wu3Zpqm9jQx4q093YPz7pESqiHk9DxKYcm EKOQOemigg7/jE7aNYL22bconxwyCXNfdAnW0/GMzhFs3Hj24Jp9hZL+5QKqn92nOGGcrPUtQaOI6 QOktm28g9+fGF6eY=; Received: from wilbur.contactoffice.com ([212.3.242.68]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1peZEp-0001g6-3o for openvpn-devel@lists.sourceforge.net; Tue, 21 Mar 2023 10:29:13 +0000 Received: from smtpauth2.co-bxl (smtpauth2.co-bxl [10.2.0.24]) by wilbur.contactoffice.com (Postfix) with ESMTP id 8CEE29FD; Tue, 21 Mar 2023 11:28:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1679394538; s=20220809-q8oc; d=unstable.cc; i=a@unstable.cc; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Transfer-Encoding; l=1414; bh=dfI2QPomvMfoN535oi76AZFvXadyTHIV2hpKBgtyKyA=; b=D8URf+CcTLLLGTTtI3rp6StGW8z/hryERtl4c7ELEYo8Ft1D+men7obpO3WbZjPD KlMPcE1m0Uy1G6SeQFRH7GgAnHvpHtCX70Z/KP8Ct8nM4ww+EwvOMulmmJP+WCbyXp4 wDXt6ogXtnyUub24bzdUARf5DpWhtR9SUo/2xPVtnen7Z1H9er6FUpANOPB4H/je9NL tiOyBar0JoGFQbNn6RMo+bzuXbR21QBFtFGZy/L3oyasyurswHbq1T9U/maf5Rxp/Nc XP6eXS+pjF+ZK3hDjKByU8URV2nLtsznjyp4iDW1d4YNnlhUK0DsP5nQCdxX46Wnkch 5wlHNiiM1A== Received: by smtp.mailfence.com with ESMTPSA ; Tue, 21 Mar 2023 11:28:53 +0100 (CET) From: Antonio Quartulli To: openvpn-devel@lists.sourceforge.net Date: Tue, 21 Mar 2023 11:28:42 +0100 Message-Id: <20230321102842.10780-1-a@unstable.cc> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Flag: NO X-Spam-Status: No, hits=-2.9 required=4.7 symbols=ALL_TRUSTED, BAYES_00 device=10.2.0.1 X-ContactOffice-Account: com:375058688 X-Spam-Score: -0.9 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-1.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: The agreement with the DCO submodule is that no API should be called if DCO is actually disabled. For this reason, every invocation must happen only after having checked that dco_enabled() returns tru [...] Content analysis details: (-0.9 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [212.3.242.68 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -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 -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-Headers-End: 1peZEp-0001g6-3o Subject: [Openvpn-devel] [PATCH] multi: don't call DCO APIs if DCO is disabled 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: Lev Stipakov , Antonio Quartulli Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1760972880544543131?= X-GMAIL-MSGID: =?utf-8?q?1760972880544543131?= The agreement with the DCO submodule is that no API should be called if DCO is actually disabled. For this reason, every invocation must happen only after having checked that dco_enabled() returns true. Add missing checks before invoking dco_get_peer_stats_multi() Reported-by: Lev Stipakov Signed-off-by: Antonio Quartulli Acked-by: Lev Stipakov --- src/openvpn/multi.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index 53c17b3a..1f0a9c01 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -549,7 +549,10 @@ multi_del_iroutes(struct multi_context *m, static void setenv_stats(struct multi_context *m, struct context *c) { - dco_get_peer_stats_multi(&m->top.c1.tuntap->dco, m); + if (dco_enabled(&m->top.options)) + { + dco_get_peer_stats_multi(&m->top.c1.tuntap->dco, m); + } setenv_counter(c->c2.es, "bytes_received", c->c2.link_read_bytes + c->c2.dco_read_bytes); setenv_counter(c->c2.es, "bytes_sent", c->c2.link_write_bytes + c->c2.dco_write_bytes); @@ -849,7 +852,10 @@ multi_print_status(struct multi_context *m, struct status_output *so, const int status_reset(so); - dco_get_peer_stats_multi(&m->top.c1.tuntap->dco, m); + if (dco_enabled(&m->top.options)) + { + dco_get_peer_stats_multi(&m->top.c1.tuntap->dco, m); + } if (version == 1) {