From patchwork Thu Jan 15 09:11:16 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4710 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:9186:b0:80a:3855:ce6a with SMTP id j6csp841273maf; Thu, 15 Jan 2026 01:11:45 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXQHkj9poWPDRplZ8BXXyKiiJfB9VERrGT1HMDYgv1Z2CO21ZUnIzbTpM2kbaY1eNfKZQI3WG8ijQk=@openvpn.net X-Received: by 2002:a05:6830:2b0b:b0:7cf:d642:d36c with SMTP id 46e09a7af769-7cfd642d84emr1319895a34.2.1768468305623; Thu, 15 Jan 2026 01:11:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1768468305; cv=none; d=google.com; s=arc-20240605; b=Nrhb80vlJ7+zdFcn+OdnT/7XzNHgr4V95L4afSTuro1pV6AfxXuFn6o20LoUJEa1C9 VX7H8l2A5HUC2CBeKkODNcyDgEddaCmOHcwIL4arHct9+HHlPQEOl8s/xfbf8t/7xDIs LNNo/m0iDS78VOlJMNZLo/s34b8a8zTp2FcGzg28zfPiLT2Nuwok45R9Bhowe7gmN3p2 PZatjSun9Y17BczDadeXjHkA3LsVpP8lZNnOxIK7FuxVH0cPJr1rXlDOx1/OSTHjr9aB BNaZ+zQw39kAQERMCnLm8FuOHPMc0AqvMB2yS+7jPaVT1zOZhzVdIjkzs9JKCC0Ds+gv YDWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=G80g01uk7u8leg2v7HcYC6xf9PUQg+iBNwte+wQgFc4=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=NlB63P1o6VVNdanO3IEgAYfZqL2wi3YLgaZqGVKAxKnTjg1C96vw8f2Bd89j+U3GHI aHdnqWJ7oXjlBurAavZ5M3yp6705SscYBDfiGbXnmyPdSh5QA5kwV8Xgn0tR4tu9dAJh YZLrp0ofylkhhVwtuXuVvBWWLeSBI+7tkm7y6JL4PgY254phBGsbSjhIUJNAkFnlHf+J 9MRMZyhsAZiBxZ88Fpbg/Oi3nyp3ef5y5TVykOU9YlVcXkn+p+i2/1bMrvuv7tvsNTK3 kgqBKnOv8tli6bXnyt5K6VMt5QNGxPwb2zVQ8I3o5JkSNaIMVZsZxC/BRDTFEre0y2MR CfMg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=hs4V2nAk; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="h3Zg9Ct/"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=E4vIcElW; 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 46e09a7af769-7ce478df992si18342688a34.178.2026.01.15.01.11.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Jan 2026 01:11:45 -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=hs4V2nAk; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="h3Zg9Ct/"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=E4vIcElW; 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=G80g01uk7u8leg2v7HcYC6xf9PUQg+iBNwte+wQgFc4=; b=hs4V2nAkcOa0NrHOWzF8FazIDa NbaXC28bRtUAfItP6vLFdwzXXkkdB7ikcPEbW0rG2xq92hfAszIWz8FoUcYMkxa3q7M9RUwHTiYJg d+qjOWcB0jePc6J4Eqo40bp+VfstFq2JpIIxzkffXY/n9GU/HrTgpPHehyXhLBCYIDYc=; 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 1vgJOI-0001hK-JX; Thu, 15 Jan 2026 09:11:42 +0000 Received: from [172.30.29.66] (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 1vgJOH-0001hE-4e for openvpn-devel@lists.sourceforge.net; Thu, 15 Jan 2026 09:11:41 +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=a0eryg2qY/3pKMtt93FsPok0O170g85YcKVU2hJSEUQ=; b=h3Zg9Ct/xa2GSu5te/x9DRBwvp T/3ggw8Mjg95t25KgNR2XZeSROi2Vuj31Z5BoQVFrzZxZZv4z1LCYKckMreJF9ru2sAmdIZJ9JC8V 0n5bR/+LxqCK/MO3WIrwUo5K/mUPKS7FT6vFv4uFJhUuTc8RkLVefaCmYolrwks9OU8o=; 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=a0eryg2qY/3pKMtt93FsPok0O170g85YcKVU2hJSEUQ=; b=E4vIcElWQj/9yXJ+nTQkdS1KYU Jgz9MBHdml1aAKxGZz4xUgmfJfTGkZfqEKaqtOtSWju46b8m/ia+Ebd9D4ByWK534GS0IoNsMBwae cg61MY9NWRsTOTFzAAJmgWTjK/7Ji46Ri0LCtoMIj0JJBtOiXqkZJuSxxzuMdZkTb2eY=; Received: from [193.149.48.134] (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 1vgJOF-0001mX-Qr for openvpn-devel@lists.sourceforge.net; Thu, 15 Jan 2026 09:11:40 +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 60F9BS36023385 for ; Thu, 15 Jan 2026 10:11:28 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 60F9BSfo023384 for openvpn-devel@lists.sourceforge.net; Thu, 15 Jan 2026 10:11:28 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Thu, 15 Jan 2026 10:11:16 +0100 Message-ID: <20260115091124.23360-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.51.2 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-2.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 Since all values are limited by MAX_ICMPV6LEN we can just cast to uint16_t. While here remove a unused gc arena in neighbouring code. 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: 1vgJOF-0001mX-Qr Subject: [Openvpn-devel] [PATCH v1] forward: Avoid conversion warning in ipv6_send_icmp_unreachable 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?1854373422259118647?= X-GMAIL-MSGID: =?utf-8?q?1854373422259118647?= From: Frank Lichtenheld Since all values are limited by MAX_ICMPV6LEN we can just cast to uint16_t. While here remove a unused gc arena in neighbouring code. Change-Id: I701f9e0a96a7b43f278f8e6089e9156feab772c8 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1472 --- 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/+/1472 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index d208c21..3730cd5 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -1352,11 +1352,6 @@ check_status(c->c2.buf.len, "read from TUN/TAP", NULL, c->c1.tuntap); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - /** * Drops UDP packets which OS decided to route via tun. * @@ -1483,8 +1478,6 @@ void process_incoming_tun(struct context *c, struct link_socket *out_sock) { - struct gc_arena gc = gc_new(); - if (c->c2.buf.len > 0) { c->c2.tun_read_bytes += c->c2.buf.len; @@ -1528,7 +1521,6 @@ { buf_reset(&c->c2.to_link); } - gc_free(&gc); } /** @@ -1593,7 +1585,7 @@ icmp6out.icmp6_type = OPENVPN_ICMP6_DESTINATION_UNREACHABLE; icmp6out.icmp6_code = OPENVPN_ICMP6_DU_NOROUTE; - int icmpheader_len = sizeof(struct openvpn_ipv6hdr) + sizeof(struct openvpn_icmp6hdr); + const int icmpheader_len = sizeof(struct openvpn_ipv6hdr) + sizeof(struct openvpn_icmp6hdr); int totalheader_len = icmpheader_len; if (TUNNEL_TYPE(c->c1.tuntap) == DEV_TYPE_TAP) @@ -1606,10 +1598,11 @@ * frame should be <= 1280 and have as much as possible of the original * packet */ - int max_payload_size = min_int(MAX_ICMPV6LEN, c->c2.frame.tun_mtu - icmpheader_len); - int payload_len = min_int(max_payload_size, BLEN(&inputipbuf)); + const int max_payload_size = min_int(MAX_ICMPV6LEN, c->c2.frame.tun_mtu - icmpheader_len); + const int payload_len = min_int(max_payload_size, BLEN(&inputipbuf)); + const uint16_t icmp_len = (uint16_t)(sizeof(struct openvpn_icmp6hdr) + payload_len); - pip6out.payload_len = htons(sizeof(struct openvpn_icmp6hdr) + payload_len); + pip6out.payload_len = htons(icmp_len); /* Construct the packet as outgoing packet back to the client */ struct buffer *outbuf; @@ -1665,10 +1658,6 @@ #undef MAX_ICMPV6LEN } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - void process_ip_header(struct context *c, unsigned int flags, struct buffer *buf, struct link_socket *sock)