From patchwork Sat Oct 3 17:55:24 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 5432 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:2999:b0:8b3:6e77:b38b with SMTP id f25csp1970917max; Sat, 3 Oct 2026 10:56:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBwpXDefN+hnfKPDDmq3RfcdNPJ80plRx7TgLBH2zA54IKqFY1IzKpdatSaLuSANt0h2kslvX+dZm9I=@openvpn.net X-Received: by 2002:a05:6871:680c:b0:470:e97e:8f88 with SMTP id 586e51a60fabf-49df051e99cmr6457840fac.24.1791050161727; Sat, 03 Oct 2026 10:56:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1791050161; cv=none; d=google.com; s=arc-20260327; b=ssvOV0kgXOuebmAfiGbWyUXdiEK8biC2QUVLfxEiQlKhYpi28VSz5w4VSba/bxQwQx v4hb3sQXTw2LvzOTaLkxjSEEFWB6RUOqleTijuHAbAgB5/nh8IzJ2aoN0ChzWWTTED26 NomcdaVnX2nTVu41FCuG7AD7AZTEtfabEjpglEKxhEvjZhjo0rdV3GxGh5zM51Sg8p6x Nqn7mtONdWGM3+cosUsLzWg0TqdflBM0Hzi8Xfo0s9aTh8hviCroHM+E3P1IRKwDsZCO 4pN/UZJ3qlagsf1O9noJEa3Tn7s+VDMNYU6ZlCZ4sSJ1huIEUiKAvwWSADYdNCdEzBNj riPQ== 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=0XpeFv0IhBgtBX88fSc1jfF5XEcmtEDvkqk2OyQD6jk=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=aohmrZTO3xE4jdP6hzqVT1gX3ZDisEzrZ6EWMmqqcaiKVKQjqvALUqgK2cJKRR9n0a WRdf7EatXynvA5QBP2l2qHwFjMFU1F0NQQmXqSr9c3aD+PeGIPmJQJxqbFvkP55Qo5jY QZJyGVJA0GjIhfSXTuyfjSj8f2WI0IUiCX5agdL7DwO7ALzggO7TZETtHEe9PD4hCSWO XX1ZSIpboNH+IxmQng3v+P9VlCm/7+9bHaGfP3wgxAk6tuCtkOhGH0VuB5CXYf7LuSVA oG3d8CkIrLB2hHsRJWSZVjMtere+uOUAcVDE8j7bMJbJ6v+ioo1lBB5kJcVtoaufx117 sj+Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=e2Cx5it8; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=SPoFdM+T; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=AjeMNsDt; 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 586e51a60fabf-49e16e0b29bsi9199546fac.63.2026.10.03.10.56.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 03 Oct 2026 10:56:01 -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=pass header.i=@lists.sourceforge.net header.s=beta header.b=e2Cx5it8; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=SPoFdM+T; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=AjeMNsDt; 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-Owner; bh=0XpeFv0IhBgtBX88fSc1jfF5XEcmtEDvkqk2OyQD6jk=; b=e2Cx5it82myTC22+E59F53XcLJ mJei8dK5dmmQzch3OP22XIJbP/m+Ysf3B6C2joelv+MV9gi/RuoyZwrXXn/SJhKFxMm6XcdxdGQD3 zi27vHOFBPeIK/+ecLvBBGSpt3v/ewhUjUsUxwen7OzcihFuKu5Z8Wui2QVseFfXvSSY=; 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 1xD3xm-0003EE-Eb; Sat, 03 Oct 2026 17:55:59 +0000 Received: from [172.30.29.66] (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 1xD3xl-0003Ce-00 for openvpn-devel@lists.sourceforge.net; Sat, 03 Oct 2026 17:55:57 +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-Subscribe:List-Post:List-Owner:List-Archive; bh=0N4zee8z5eb86ueHHX7sKBdblERmgnp308xm/bs4dWo=; b=SPoFdM+T6Dgh2IWM2Uo/uJ1dZz eQNa+706ZmM5SW4rE7/Tdtnh+m8kMi9Ss6/S/qB131tvPFaY20r6WqR36GHjC9JplSyTkz8zftQVl ZbTuXyfKcxABc5REUFrE4QTIkWGUhEwTR2zMHpx6nLrQZ9FhZmvQzsdvRpGNO8I77MNY=; 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-Subscribe: List-Post:List-Owner:List-Archive; bh=0N4zee8z5eb86ueHHX7sKBdblERmgnp308xm/bs4dWo=; b=AjeMNsDtOxwM3txOQgqZl9fv+U e1arPBhQ+qAQcDdkX3EIXwzE6ylN2T6QHP+oSq7WIccXGG5xgzxi/tsGSZj+FigAop2VpKycsKqFB NrOE8BHohaUkNCk6yJ80fogbQUmyj2EDfdiJwajiyRjwZBFDJBjphmOo7sl8vAlyNMV8=; Received: from [193.149.48.129] (helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1xD3xR-0003Uq-3O for openvpn-devel@lists.sourceforge.net; Sat, 03 Oct 2026 17:55:37 +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 693HtUL5006376 for ; Sat, 3 Oct 2026 19:55:30 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 693HtU9h006375 for openvpn-devel@lists.sourceforge.net; Sat, 3 Oct 2026 19:55:30 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Sat, 3 Oct 2026 19:55:24 +0200 Message-ID: <20261003175529.6360-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.53.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: Frank Lichtenheld - Fix several constVariablePointer issues that were newly reported - Fix one unreadVariable issue that was newly reported - Remove --showtime=summary from cppcheck args again, it is now much more verb [...] 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: 1xD3xR-0003Uq-3O Subject: [Openvpn-devel] [PATCH v3] Fix various issues found by cppcheck 2.21.0 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: 1878052214700336122 X-GMAIL-MSGID: 1878052214700336122 From: Frank Lichtenheld - Fix several constVariablePointer issues that were newly reported - Fix one unreadVariable issue that was newly reported - Remove --showtime=summary from cppcheck args again, it is now much more verbose Change-Id: I6693b5aa2988102f5e7884a65119ebfc87dd07e1 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1954 --- 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/+/1954 This mail reflects revision 3 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/dev-tools/run-cppcheck.sh b/dev-tools/run-cppcheck.sh index ad012ac..3c71c83 100755 --- a/dev-tools/run-cppcheck.sh +++ b/dev-tools/run-cppcheck.sh @@ -33,7 +33,7 @@ --suppress-xml=${SCRIPT_DIR}/cppcheck-suppressions.xml --inline-suppr \ --cppcheck-build-dir=${CPPCHECK_DIR} \ --check-level=${CPPCHECK_CHECK_LEVEL} --max-configs=10 \ - --error-exitcode=1 --showtime=summary" + --error-exitcode=1" set -x diff --git a/src/openvpn/dco.c b/src/openvpn/dco.c index 6d88f6f..9fc0e3b 100644 --- a/src/openvpn/dco.c +++ b/src/openvpn/dco.c @@ -534,7 +534,7 @@ ASSERT(sock->info.connection_established); struct sockaddr *remoteaddr = &sock->info.lsa->actual.dest.addr.sa; - struct tls_multi *multi = c->c2.tls_multi; + const struct tls_multi *multi = c->c2.tls_multi; #ifdef TARGET_FREEBSD /* In Linux in P2P mode the kernel automatically removes an existing peer * when adding a new peer. FreeBSD needs to explicitly be told to do that */ diff --git a/src/openvpn/mudp.c b/src/openvpn/mudp.c index 4794b7e..2b08ada 100644 --- a/src/openvpn/mudp.c +++ b/src/openvpn/mudp.c @@ -316,10 +316,9 @@ multi_get_instance_udp_real(struct multi_context *m, struct mroute_addr *real) { struct hash *hash = m->hash; - struct hash_element *he; const uint64_t hv = hash_value(hash, real); struct hash_bucket *bucket = hash_bucket(hash, hv); - he = hash_lookup_fast(hash, bucket, real, hv); + const struct hash_element *he = hash_lookup_fast(hash, bucket, real, hv); if (he) { return he->value; diff --git a/src/openvpn/pkcs11_openssl.c b/src/openvpn/pkcs11_openssl.c index 69c5a50..24dce84 100644 --- a/src/openvpn/pkcs11_openssl.c +++ b/src/openvpn/pkcs11_openssl.c @@ -184,7 +184,6 @@ { tbs = buf; tbslen = (size_t)buflen; - sigalg.op = "Sign"; } else { diff --git a/src/openvpn/socks.c b/src/openvpn/socks.c index 19f3d54..65ecb3c 100644 --- a/src/openvpn/socks.c +++ b/src/openvpn/socks.c @@ -323,8 +323,7 @@ return port; } - struct servent *service; - service = getservbyname(servname, NULL); + const struct servent *service = getservbyname(servname, NULL); if (service) { return service->s_port; diff --git a/tests/unit_tests/openvpn/siphash_openssl.c b/tests/unit_tests/openvpn/siphash_openssl.c index c301f2d..99a7763 100644 --- a/tests/unit_tests/openvpn/siphash_openssl.c +++ b/tests/unit_tests/openvpn/siphash_openssl.c @@ -101,7 +101,7 @@ bool siphash_openssl_available(void *sip_context) { - struct siphash_context *sip = sip_context; + const struct siphash_context *sip = sip_context; return (bool)(sip->mac); }