From patchwork Wed Nov 11 15:21:07 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 5670 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:6022:529c:b0:11a:a05e:cb97 with SMTP id x28csp603650lax; Wed, 11 Nov 2026 07:21:32 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErEdghKcTsCgKKLaaY4dYvNYFtWWG0lWQzwJGinujaMseIuBkufi06TelNKQ9M5xVzIy0nhdLLXkWYo=@openvpn.net X-Received: by 2002:a05:6820:806:b0:6d9:4c33:6504 with SMTP id 006d021491bc7-71925f7a0a4mr134589eaf.68.1794410492302; Wed, 11 Nov 2026 07:21:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794410492; cv=none; d=google.com; s=arc-20260327; b=AHF5fWxMU+YZ6lxxvwyiiZ8PRjaaPKoinRuovjvc3l0rzcx8jASMSracVN+J/WFyxx dwP97BPoATJOoODYfuWJQv+IdJYJKusiHIGdSlLTpJuzX9q2IS1vXY5FkGszVExsM2ey ADklUarNVzeZ+jFYg8ZCzHnRVcbfhEYK0jRrkTGGkWm+2O0BGkODGokSyfW9Lk/RcgLO PxZs1XQJzeTAW1v9bjVDi5PnTncJjF5Sq6eQEvQ9nx57kZgZN2STD9XqScNrC8WSKBDC dyibLcncn3bDXvik2Ez6YETkqtLwgdoPdXkyjArJOy2i0H2nq90AFip6SF2cWWX9+CBl eoDQ== 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=GfvK+wEzKNizQY2x7eEki0u7X3eZf47IepnqtvTibLo=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=MXrVXV+1uqPdCZuyCdXpFbAUiUJUOQp0UBRo7NylKdg7RPz2hhbsSi4q3IOYc8tpis Nh49nEk7eZXdNnd3+Y7SskCVZMI8OpOVjCbU1f4/LBc/DMZ4np/SvAsdfvN64wxqkPL/ DuGqsW4kI9GKo1zFV4fvYwEsyj+LRV3CEsJct7pa2hvcjacM3yApFryFowTFaMy/4FSp pozmUzGaIHJCEWXgIEfUqXKgICuDumpCIWUxeUaRzq3jcjMfR/5Zj2hi83yvuM11+I6r PlFr+XiIXUWoqvKMg66VkA8J4QJReKOKnGs+5dSD/3L4KXHXGqZ1Wly1EngQ0yTT6nf0 53cA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=Cy8RPad6; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=me1UdYuo; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=SICEduDC; 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 006d021491bc7-7191e75361esi1900235eaf.76.2026.11.11.07.21.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Nov 2026 07:21:32 -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=Cy8RPad6; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=me1UdYuo; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=SICEduDC; 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=GfvK+wEzKNizQY2x7eEki0u7X3eZf47IepnqtvTibLo=; b=Cy8RPad6NEHoGn iCsfJSzEdKek1HzSv7GDZ556WnWTCrrHIIiBuQOf1h0bx5CNOEkW7Ykh8neJv9Sa7pclylBTApYuC 4IVCYylyphB9PJIaccMX7M38egY06Bc7pZjqjHf+c8ORPypOFtOENqlmNLUr05B65/r9ZH3FE/rh4 qL4=; 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.100.1) (envelope-from ) id 1xRA8d-000000003Sv-1oXh; Wed, 11 Nov 2026 15:21:27 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.100.1) (envelope-from ) id 1xRA8X-000000003Sm-3H4t for openvpn-devel@lists.sourceforge.net; Wed, 11 Nov 2026 15:21:21 +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=BjNp4OE80Pr74KYbBR/M6IPtIiccWApI8W+0w7e3QzE=; b=me1UdYuoY+lArIgD6dylAZ8ra8 3kGovcMN7SUW1HC2jYf3wQqwegKNSJO3ZyyDSlUYlwZO3u11H/1gd3DagKTerBrXHcHamvkvUjaYY c68VsKzPNkSxLEvxI4PoWEjnr2aLy65JX4h2dA4DbD73FXa37jVgmLrJSlJUkLPgLsqw=; 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=BjNp4OE80Pr74KYbBR/M6IPtIiccWApI8W+0w7e3QzE=; b=SICEduDCrjsf60U5i+cVl/f2ve VUWYL/HHPRlLBVl6jD209E7QQD04ZpskUQuVmbatw9AndDc7XfskftP3HKLqAth4Z1103YM03Mqb7 MPZ6gHdZ4iPXd9dDTnFcT0MP23tsVv74v2IGgs5uobTHrA2gL+ZiVOtiflzYy9GZ5XrA=; 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 1xRA8W-000000000kF-1iBa for openvpn-devel@lists.sourceforge.net; Wed, 11 Nov 2026 15:21:21 +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 6ABFLDRd031493 for ; Wed, 11 Nov 2026 16:21:13 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 6ABFLDMO031492 for openvpn-devel@lists.sourceforge.net; Wed, 11 Nov 2026 16:21:13 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Wed, 11 Nov 2026 16:21:07 +0100 Message-ID: <20261111152112.31478-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: Arne Schwabe Change-Id: I571e30bb22ec7bffc2c5fa04fdcd73b52ce47e5e Signed-off-by: Arne Schwabe Acked-by: Frank Lichtenheld Gerrit URL: https://gerrit.openvpn.net/c/openvpn [...] 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: 1xRA8W-000000000kF-1iBa Subject: [Openvpn-devel] [PATCH v2] Silence remaining cppcheck warnings on macOS and FreeBSD 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: 1881575776103880176 X-GMAIL-MSGID: 1881575776103880176 From: Arne Schwabe Change-Id: I571e30bb22ec7bffc2c5fa04fdcd73b52ce47e5e Signed-off-by: Arne Schwabe Acked-by: Frank Lichtenheld Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2108 --- 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/+/2108 This mail reflects revision 2 of this Change. Acked-by according to Gerrit (reflected above): Frank Lichtenheld diff --git a/src/openvpn/route.c b/src/openvpn/route.c index d0d26c6..449b4f1 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -3331,7 +3331,6 @@ int rtm_addrs; struct sockaddr so_dst, so_mask; char *cp = m_rtmsg.m_space; - struct sockaddr *gate = NULL, *ifp = NULL, *sa; struct rt_msghdr *rtm_aux; #define rtm m_rtmsg.m_rtm @@ -3396,6 +3395,8 @@ sockfd = -1; /* extract return data from routing socket */ + const struct sockaddr_in *gate = NULL; + const struct sockaddr_dl *adl = NULL; rtm_aux = &rtm; cp = (char *)(rtm_aux + 1); if (rtm_aux->rtm_addrs) @@ -3404,14 +3405,14 @@ { if (i & rtm_aux->rtm_addrs) { - sa = (struct sockaddr *)cp; + const struct sockaddr *sa = (const struct sockaddr *)cp; if (i == RTA_GATEWAY) { - gate = sa; + gate = (const struct sockaddr_in *)sa; } else if (i == RTA_IFP) { - ifp = sa; + adl = (const struct sockaddr_dl *)sa; } ADVANCE(cp, sa); } @@ -3423,19 +3424,18 @@ } /* get gateway addr and interface name */ - if (gate != NULL) + if (gate) { /* get default gateway addr */ - rgi->gateway.addr = ntohl(((struct sockaddr_in *)gate)->sin_addr.s_addr); + rgi->gateway.addr = ntohl((gate)->sin_addr.s_addr); if (rgi->gateway.addr) { rgi->flags |= RGI_ADDR_DEFINED; } - if (ifp) + if (adl) { /* get interface name */ - const struct sockaddr_dl *adl = (struct sockaddr_dl *)ifp; if (adl->sdl_nlen && adl->sdl_nlen < sizeof(rgi->iface)) { memcpy(rgi->iface, adl->sdl_data, adl->sdl_nlen); diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index bcea331..a1f9886 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -1040,7 +1040,7 @@ * @param ctx the networking API opaque context */ static void -do_ifconfig_ipv6(struct tuntap *tt, const char *ifname, int tun_mtu, const struct env_set *es, +do_ifconfig_ipv6(const struct tuntap *tt, const char *ifname, int tun_mtu, const struct env_set *es, openvpn_net_ctx_t *ctx) { #if !defined(TARGET_LINUX) @@ -1231,7 +1231,7 @@ * @param ctx the networking API opaque context */ static void -do_ifconfig_ipv4(struct tuntap *tt, const char *ifname, int tun_mtu, const struct env_set *es, +do_ifconfig_ipv4(const struct tuntap *tt, const char *ifname, int tun_mtu, const struct env_set *es, openvpn_net_ctx_t *ctx) { #if !defined(_WIN32) && !defined(TARGET_ANDROID) @@ -1587,7 +1587,7 @@ } static void -undo_ifconfig_ipv4(const struct tuntap *tt, openvpn_net_ctx_t *ctx) +undo_ifconfig_ipv4(const struct tuntap *tt, const openvpn_net_ctx_t *ctx) { #if defined(TARGET_LINUX) int netbits = netmask_to_netbits2(tt->remote_netmask); @@ -1622,7 +1622,7 @@ } static void -undo_ifconfig_ipv6(const struct tuntap *tt, openvpn_net_ctx_t *ctx) +undo_ifconfig_ipv6(const struct tuntap *tt, const openvpn_net_ctx_t *ctx) { #if defined(TARGET_LINUX) if (net_addr_v6_del(ctx, tt->actual_name, &tt->local_ipv6, tt->netbits_ipv6) < 0)