From patchwork Thu Nov 28 14:27:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 3971 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:57cb:b0:5db:cfa9:4424 with SMTP id v11csp1275141mau; Thu, 28 Nov 2024 06:27:34 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWNsrmYAZvhSQEfhDdM0j1gJin06sAt6V2ZNjxaCuPlsyOksoK5vv7SaC6n/IIH7+NK5OAAAikRAkQ=@openvpn.net X-Google-Smtp-Source: AGHT+IFgkJJe587W7cEPM6FZPGljkFR8ZwN1LTllJ6YXIW7TxciM5VBwr4BsrMIBTRUa+2HqOMFg X-Received: by 2002:a05:6830:3914:b0:71d:5812:15a0 with SMTP id 46e09a7af769-71d70bf3dc1mr1851918a34.4.1732804054577; Thu, 28 Nov 2024 06:27:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732804054; cv=none; d=google.com; s=arc-20240605; b=BmABxDef2I8HPHkVrpjKlFRMM1dPlCdzH4MQ02KD7jjoyMdcs3eksfAUDHZ15cvRO4 xNbgQ6xIVTfwaLJ+FCGVQ/yrDUjhVtQVxu17ljxCwI8HSz6h4I4I+pz/7jkKx2ZFPwN5 SZoLErJz7SCI49iL6u8GeMnJIrpqm0M7+ZqY8VsIcMXwRrN6My9kA4Nqu3brIzLS+YR5 OfxcW1dZManc/AZKVgGs1Xc3obg/yf6hFYsfSlgHLb72+7gKe/oYCngnk+GEp8r6seXh j8zECqqCBLjnquTx5KEjaDUELPStNlVEWS/M/7/H2Ujcn/dfFjLfgiwH+LF8QCQz05VU DCgQ== 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; bh=mYRMOmMu0Sot2NDfZA6ytzycuwLvOONp9Kcguk+n3C8=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=JjA63xQhT/p/Hs9gxqwc4w/NW2OoAq0vSjY+9kozkMLDx7Kv2YOy8CV+wmOjKHC6+E Rn7soNTuCTf/WM5khLCnfFaFlsBzi1J8943HnjFZT6QSCdEkwA37SJlSL03KivIzqart zB7C9v5g+pe/cf2oJZ9Jjxo4a5Dx7/BmUXDDoTXLEuUqwka2VP4A5nWakFpSkTiW7B2T XOcnwi7MuIj9lTfvwvCHZi4vtbT2URJOgo7+hgPNY26mdGb3T0Zognbmik+Fjmwb/VlH nJ5S80SOyX0InOmh/5s/5y5O0DfL31FFcTGN+h0yeDmFFPsKTe9fUTJr8g41sHjYaKsW ztvA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=KXKrMtaG; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=ISrcQvEN; 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-71d7243f13bsi755361a34.39.2024.11.28.06.27.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Nov 2024 06:27:34 -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=KXKrMtaG; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=ISrcQvEN; 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 [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 1tGfUJ-00009k-JH; Thu, 28 Nov 2024 14:27:24 +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 1tGfUH-00009d-TW for openvpn-devel@lists.sourceforge.net; Thu, 28 Nov 2024 14:27:22 +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=BP+WG0aZS73n/Q386Osxf6i7VW/8gzeMdJWTsxhRWTQ=; b=KXKrMtaGlP3lR4hhCsjbWZHy11 aRxivBSm0RveFrPSn8CrY6HpDxMVj/XhwLNdc2iZATfpRyqaGWP5dja8gJHBASKJUjrXEs9uCaIIh qxScnLtZ2HHsiw6+PayC9kOAdUKhXHWpc3H+BIaAEYazdPBjh/cLzT3EAO8a7kwZGMD8=; 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=BP+WG0aZS73n/Q386Osxf6i7VW/8gzeMdJWTsxhRWTQ=; b=ISrcQvENSox4sZHmJKSVYFAFPw QewJecvCJkXpGlqUvBat6CaZkHorTAvPDelr5UR3hBaBFNJH4rqbk3d5Fh4I5ThEZ72lFi0WlzvEV JaXdOjvRkWezZK690TsdKWzeJhAcX2jZlx6mF9SC/KmK3KBC3NqAEJoBkzrSTsqkAsvM=; Received: from dhcp-174.greenie.muc.de ([193.149.48.174] 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 1tGfUH-00009S-7B for openvpn-devel@lists.sourceforge.net; Thu, 28 Nov 2024 14:27:22 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.17.1.9/8.17.1.9) with ESMTP id 4ASER91E014676 for ; Thu, 28 Nov 2024 15:27:09 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.17.1.9/8.17.1.9/Submit) id 4ASER9bu014675 for openvpn-devel@lists.sourceforge.net; Thu, 28 Nov 2024 15:27:09 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Thu, 28 Nov 2024 15:27:08 +0100 Message-ID: <20241128142708.14665-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 0.0 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-2.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: From: Frank Lichtenheld Has been present in all releases since 10.7, i.e. about 13 years ago. At this point the check just makes the code uglier for no actual benefit. Change-Id: I41eeae35ab23d9fb2512f33086f20f54c2d4f6df Signed-off-by: Frank Lichtenheld Acked-by: Arne Schwabe --- Content analysis details: (0.0 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [193.149.48.174 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [193.149.48.174 listed in bl.score.senderscore.com] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1tGfUH-00009S-7B Subject: [Openvpn-devel] [PATCH v1] macOS: Assume that net/if_utun.h is always present 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?1816976744725343467?= X-GMAIL-MSGID: =?utf-8?q?1816976744725343467?= From: Frank Lichtenheld Has been present in all releases since 10.7, i.e. about 13 years ago. At this point the check just makes the code uglier for no actual benefit. Change-Id: I41eeae35ab23d9fb2512f33086f20f54c2d4f6df Signed-off-by: Frank Lichtenheld Acked-by: Arne Schwabe --- 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/+/823 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Arne Schwabe diff --git a/CMakeLists.txt b/CMakeLists.txt index 5db207d..ca58cd7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -145,7 +145,6 @@ set(ENABLE_DCO YES) elseif (APPLE) set(TARGET_DARWIN YES) - set(HAVE_NET_IF_UTUN_H YES) else() message(FATAL_ERROR "Unknown system name: \"${CMAKE_SYSTEM_NAME}\"") endif () @@ -223,7 +222,6 @@ check_include_files(net/if.h HAVE_NET_IF_H) check_include_files("${NETEXTRA};netinet/ip.h" HAVE_NETINET_IP_H) check_include_files(arpa/inet.h HAVE_ARPA_INET_H) -check_include_files(net/if_utun.h HAVE_NET_UTUN_H) check_include_files(sys/ioctl.h HAVE_SYS_IOCTL_H) check_include_files(sys/inotify.h HAVE_SYS_INOTIFY_H) check_include_files("${NETEXTRA};sys/uio.h" HAVE_SYS_UIO_H) diff --git a/config.h.cmake.in b/config.h.cmake.in index 18af5e9..3c517d7 100644 --- a/config.h.cmake.in +++ b/config.h.cmake.in @@ -202,9 +202,6 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_NET_IF_TUN_H -/* Define to 1 if you have the header file. */ -#cmakedefine01 HAVE_NET_IF_UTUN_H - /* Define to 1 if you have the header file. */ #cmakedefine HAVE_NET_TUN_IF_TUN_H diff --git a/configure.ac b/configure.ac index 7f6e43d..9777e36 100644 --- a/configure.ac +++ b/configure.ac @@ -502,7 +502,7 @@ " AC_CHECK_HEADERS( - [net/if.h netinet/ip.h resolv.h sys/un.h net/if_utun.h sys/kern_control.h], + [net/if.h netinet/ip.h resolv.h sys/un.h sys/kern_control.h], , , [[${SOCKET_INCLUDES}]] diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 29d823d..c6b53a2 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -437,7 +437,7 @@ #include #endif -#if defined(TARGET_DARWIN) && HAVE_NET_IF_UTUN_H +#if defined(TARGET_DARWIN) #include #include #include @@ -1782,7 +1782,7 @@ #endif } -#if defined (TARGET_OPENBSD) || (defined(TARGET_DARWIN) && HAVE_NET_IF_UTUN_H) +#if defined(TARGET_OPENBSD) || defined(TARGET_DARWIN) /* * OpenBSD and Mac OS X when using utun @@ -1871,7 +1871,7 @@ return read(tt->fd, buf, len); } } -#endif /* if defined (TARGET_OPENBSD) || (defined(TARGET_DARWIN) && HAVE_NET_IF_UTUN_H) */ +#endif /* if defined (TARGET_OPENBSD) || defined(TARGET_DARWIN) */ bool tun_name_is_fixed(const char *dev) @@ -3215,14 +3215,11 @@ * (http://newosxbook.com/src.jl?tree=listings&file=17-15-utun.c) */ -#ifdef HAVE_NET_IF_UTUN_H - /* Helper functions that tries to open utun device - * return -2 on early initialization failures (utun not supported - * at all (old OS X) and -1 on initlization failure of utun - * device (utun works but utunX is already used */ -static -int + * return -2 on early initialization failures (utun not supported + * at all) and -1 on initlization failure of utun + * device (utun works but utunX is already used) */ +static int utun_open_helper(struct ctl_info ctlInfo, int utunnum) { struct sockaddr_ctl sc; @@ -3346,13 +3343,10 @@ tt->backend_driver = DRIVER_UTUN; } -#endif /* ifdef HAVE_NET_IF_UTUN_H */ - void open_tun(const char *dev, const char *dev_type, const char *dev_node, struct tuntap *tt, openvpn_net_ctx_t *ctx) { -#ifdef HAVE_NET_IF_UTUN_H /* If dev_node does not start start with utun assume regular tun/tap */ if ((!dev_node && tt->type==DEV_TYPE_TUN) || (dev_node && !strncmp(dev_node, "utun", 4))) @@ -3387,7 +3381,6 @@ } } else -#endif /* ifdef HAVE_NET_IF_UTUN_H */ { /* Use plain dev-node tun to select /dev/tun style @@ -3431,27 +3424,27 @@ int write_tun(struct tuntap *tt, uint8_t *buf, int len) { -#ifdef HAVE_NET_IF_UTUN_H if (tt->backend_driver == DRIVER_UTUN) { return write_tun_header(tt, buf, len); } else -#endif - return write(tt->fd, buf, len); + { + return write(tt->fd, buf, len); + } } int read_tun(struct tuntap *tt, uint8_t *buf, int len) { -#ifdef HAVE_NET_IF_UTUN_H if (tt->backend_driver == DRIVER_UTUN) { return read_tun_header(tt, buf, len); } else -#endif - return read(tt->fd, buf, len); + { + return read(tt->fd, buf, len); + } } #elif defined(TARGET_AIX)