From patchwork Mon Jan 30 16:17:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 3025 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:c95:b0:82:e4b3:40a0 with SMTP id p21csp3348381dyk; Mon, 30 Jan 2023 08:18:41 -0800 (PST) X-Google-Smtp-Source: AMrXdXsuEZ9ynaZVtBWZmD34oKfgFtNrNzPDgcR29u1MJXpy0ogKxYU9V7oZtk6oTqSwDdEqjtIT X-Received: by 2002:a05:6102:3a0d:b0:3d0:d767:246d with SMTP id b13-20020a0561023a0d00b003d0d767246dmr33768108vsu.3.1675095521115; Mon, 30 Jan 2023 08:18:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675095521; cv=none; d=google.com; s=arc-20160816; b=ytQ4oafO5LvN9P2IjXWII9Fclj1Jm9KOJeZaQdrfNMnMH0D0Kz3wVHNSdCX9Q8FxLW 68PguV9U+bMgB+EKzgDjO3ZZmK8ODDcpqXg+zQZsOzG/8qzi2GDT9xZZl0l38FfExkZE PYd0xPcPS5bUKe33vKiyHMPN3w5j+XrIb6Zc43zOLP5RBvq+vg26BTbw6FRdau6p3lw5 YkH+fhqthxeLYdO1nyN7qnOxUPurhXgDxI8owiQSXf5cc1f/bkijkiJ9G2gRWqu61pdw R+QDeiea6Ouikt5fZbF6RdG5qo8kJeT9qUAQoNohnCGeyTXR/SOtaBMUZYnZqkXHlwVC Ytcg== 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:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature; bh=N9ir3a5Qfbd0CvsxL12cW+TJkeDoGQbEgiOjVsY3FOw=; b=s6sB9hMD3V709Muxq98CgDKn0FWS4Ty2cOOfSl9d0cf0OolmpJfajywrMAD4rJ0qCy pHn6a+Tb39XRlF5+hcEL3hlsdGf1sV5XubQBiy9bajIvT+wd2aqSTHUbt67o/QfIMJGg tClBoDouHT08erOXi9pY4jYGw1CLiUFuC423Knd0MMN4lyACcL+2j4+HmSFgk1oQ4XJ5 ODsGOuv8jZVO/LKv+fhTW9mqq2V9h8hJiuHv3S0PioQzlsIEeZWyvCugsp6au6xJeaQx BjtwkkPvk2m0Tj5/91f5Kbr+A0CTaif5Tv5f0z3ZkAg5stNpraiZv36X3qGrJwsSaDxZ jmzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=N0YUNEc9; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=Pq2J3i8k; 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 f24-20020a67db98000000b003f04c12738csi2246898vsk.790.2023.01.30.08.18.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Jan 2023 08:18:41 -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=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=N0YUNEc9; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=Pq2J3i8k; 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 1pMWqp-00053f-Ib; Mon, 30 Jan 2023 16:17:46 +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 1pMWqk-00053U-M4 for openvpn-devel@lists.sourceforge.net; Mon, 30 Jan 2023 16:17:43 +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=6prgKO+/LP67vlpzxbdJr/aK3a0K72HGv8sRQdEQx70=; b=N0YUNEc95TxovJjFfjjfUBG4Z0 bRkmHlc9Qz+SNSriTt1wwDqouW16praN9Gjn5cLJbFJoo2+4XaTpsJ1nVbGKgJGYCLO+gXowM+SP6 aRmCng6nF8E6NW/hDk4NQnSY5hF05eEcGydPKG+ADeK5Otrz20KFpvIB5vJH9p97f4xQ=; 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=6prgKO+/LP67vlpzxbdJr/aK3a0K72HGv8sRQdEQx70=; b=Pq2J3i8kCDsP0fVGapxXYsBBDg MKqKmXBp5CW0UE8ewxnA5PPlKkVHQAdjLtC296lQmJhMCX1tzDt54ftMBJrQD0wj3Jex8mOlHMrG/ RZtDROx5KmV72t8OMpdBEwmUs07Clx8/GiTyZVEtzT4BjmETaaatRGSmnTTphBEKD8LY=; Received: from vmail1.greenie.net ([195.30.8.66]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1pMWqf-003tt3-D0 for openvpn-devel@lists.sourceforge.net; Mon, 30 Jan 2023 16:17:41 +0000 Received: from ubuntu2204.ov.greenie.net (ubuntu2204.ov.greenie.net [IPv6:2001:608:0:814:0:0:b00:24]) by vmail1.greenie.net (8.17.1/8.16.1) with SMTP id 30UGHU1e077838 for ; Mon, 30 Jan 2023 17:17:30 +0100 (CET) Received: (nullmailer pid 110033 invoked by uid 1000); Mon, 30 Jan 2023 16:17:30 -0000 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Mon, 30 Jan 2023 16:17:30 +0000 Message-Id: <20230130161730.110021-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230130144112.109560-1-gert@greenie.muc.de> References: <20230130144112.109560-1-gert@greenie.muc.de> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.4 (vmail1.greenie.net [IPv6:2001:608:1:995a:20c:29ff:feb8:10eb]); Mon, 30 Jan 2023 17:17:30 +0100 (CET) X-Spam-Score: -2.0 (--) 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: overlapped_io_init() has a "bool tuntap_buffer" argument which is only passed onwards to alloc_buf_sock_tun(), which does nothing with it. Remove from both functions. While at it, move alloc_buf_sock_tun() from mtu.c to win32.c and make static. It's only ever called from win32.c / overlapped_io_init(). Content analysis details: (-2.0 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [195.30.8.66 listed in list.dnswl.org] 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: 1pMWqf-003tt3-D0 Subject: [Openvpn-devel] [PATCH v2] Get rid of unused 'bool tuntap_buffer' arguments. 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?1756461060393478906?= X-GMAIL-MSGID: =?utf-8?q?1756464961159165957?= overlapped_io_init() has a "bool tuntap_buffer" argument which is only passed onwards to alloc_buf_sock_tun(), which does nothing with it. Remove from both functions. While at it, move alloc_buf_sock_tun() from mtu.c to win32.c and make static. It's only ever called from win32.c / overlapped_io_init(). v2: move alloc_buf_sock_tun() to win32.c Signed-off-by: Gert Doering Acked-By: Arne Schwabe --- src/openvpn/mtu.c | 13 ------------- src/openvpn/mtu.h | 7 ------- src/openvpn/socket.c | 4 ++-- src/openvpn/tun.c | 4 ++-- src/openvpn/win32.c | 17 ++++++++++++++--- src/openvpn/win32.h | 3 +-- 6 files changed, 19 insertions(+), 29 deletions(-) diff --git a/src/openvpn/mtu.c b/src/openvpn/mtu.c index 1d9ebe01..4b32daff 100644 --- a/src/openvpn/mtu.c +++ b/src/openvpn/mtu.c @@ -39,19 +39,6 @@ #include "memdbg.h" -/* allocate a buffer for socket or tun layer */ -void -alloc_buf_sock_tun(struct buffer *buf, - const struct frame *frame, - const bool tuntap_buffer) -{ - /* allocate buffer for overlapped I/O */ - *buf = alloc_buf(BUF_SIZE(frame)); - ASSERT(buf_init(buf, frame->buf.headroom)); - buf->len = frame->buf.payload_size; - ASSERT(buf_safe(buf, 0)); -} - unsigned int calc_packet_id_size_dc(const struct options *options, const struct key_type *kt) { diff --git a/src/openvpn/mtu.h b/src/openvpn/mtu.h index 0ff4f7bf..afd4ac53 100644 --- a/src/openvpn/mtu.h +++ b/src/openvpn/mtu.h @@ -261,13 +261,6 @@ unsigned int calc_packet_id_size_dc(const struct options *options, const struct key_type *kt); -/* - * allocate a buffer for socket or tun layer - */ -void alloc_buf_sock_tun(struct buffer *buf, - const struct frame *frame, - const bool tuntap_buffer); - /* * EXTENDED_SOCKET_ERROR_CAPABILITY functions -- print extra error info * on socket errors, such as PMTU size. As of 2003.05.11, only works diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index a883ac4a..2c75cb35 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -1623,8 +1623,8 @@ static void socket_frame_init(const struct frame *frame, struct link_socket *sock) { #ifdef _WIN32 - overlapped_io_init(&sock->reads, frame, FALSE, false); - overlapped_io_init(&sock->writes, frame, TRUE, false); + overlapped_io_init(&sock->reads, frame, FALSE); + overlapped_io_init(&sock->writes, frame, TRUE); sock->rw_handle.read = sock->reads.overlapped.hEvent; sock->rw_handle.write = sock->writes.overlapped.hEvent; #endif diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 01c85f9f..20f80798 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -898,8 +898,8 @@ init_tun_post(struct tuntap *tt, return; } - overlapped_io_init(&tt->reads, frame, FALSE, true); - overlapped_io_init(&tt->writes, frame, TRUE, true); + overlapped_io_init(&tt->reads, frame, FALSE); + overlapped_io_init(&tt->writes, frame, TRUE); tt->adapter_index = TUN_ADAPTER_INDEX_INVALID; if (tt->windows_driver == WINDOWS_DRIVER_WINTUN) diff --git a/src/openvpn/win32.c b/src/openvpn/win32.c index 44176936..9f0c119f 100644 --- a/src/openvpn/win32.c +++ b/src/openvpn/win32.c @@ -170,11 +170,22 @@ init_security_attributes_allow_all(struct security_attributes *obj) return true; } +/* allocate a buffer for socket or tun layer */ +static void +alloc_buf_sock_tun(struct buffer *buf, + const struct frame *frame) +{ + /* allocate buffer for overlapped I/O */ + *buf = alloc_buf(BUF_SIZE(frame)); + ASSERT(buf_init(buf, frame->buf.headroom)); + buf->len = frame->buf.payload_size; + ASSERT(buf_safe(buf, 0)); +} + void overlapped_io_init(struct overlapped_io *o, const struct frame *frame, - BOOL event_state, - bool tuntap_buffer) /* if true: tuntap buffer, if false: socket buffer */ + BOOL event_state) { CLEAR(*o); @@ -186,7 +197,7 @@ overlapped_io_init(struct overlapped_io *o, } /* allocate buffer for overlapped I/O */ - alloc_buf_sock_tun(&o->buf_init, frame, tuntap_buffer); + alloc_buf_sock_tun(&o->buf_init, frame); } void diff --git a/src/openvpn/win32.h b/src/openvpn/win32.h index a1a45503..72ffb012 100644 --- a/src/openvpn/win32.h +++ b/src/openvpn/win32.h @@ -217,8 +217,7 @@ struct overlapped_io { void overlapped_io_init(struct overlapped_io *o, const struct frame *frame, - BOOL event_state, - bool tuntap_buffer); + BOOL event_state); void overlapped_io_close(struct overlapped_io *o);