From patchwork Thu Nov 28 13:14:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "d12fk (Code Review)" X-Patchwork-Id: 3970 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:57cb:b0:5db:cfa9:4424 with SMTP id v11csp1224929mau; Thu, 28 Nov 2024 05:18:56 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX3OMYVxjlYhLiak2kAzMa9EJHN4tBpr8NBdDs3TS5Vjjoq8RRRifsxQtfPtFT2SCiEU/Hr4hJsj3M=@openvpn.net X-Received: by 2002:a05:6e02:1c83:b0:3a7:93af:ef55 with SMTP id e9e14a558f8ab-3a7c5568698mr66541595ab.12.1732799696068; Thu, 28 Nov 2024 05:14:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IE/xHfMWQqp08peGp+FSTwAkZoFq0SltJPgzQicJ8YGAUWuwtKdpkgcLyZWONZCGjcSEsUa X-Received: by 2002:a05:6e02:1c83:b0:3a7:93af:ef55 with SMTP id e9e14a558f8ab-3a7c5568698mr66540815ab.12.1732799694332; Thu, 28 Nov 2024 05:14:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732799694; cv=none; d=google.com; s=arc-20240605; b=L6h/nWxexBIpPuIBoWZFBGBFHaenS+/Cs3QI5TY0lfYVddflfXoGVwmaDjeQJpVnER brxf2pPRW8pHmMYHNvgYPIXRiR3QBte5+fFhou5CqOnpkEB3Kd5jqGOdnMVYSOzK/69V eAgrKl7E48Q/90/OOYYD9EW1OGoOLaBDH7B7k4QkmuCeF1PZ3uAvmrQNhZGRfAWO5Ag/ zKo5MPx+FyNM4C9FfNLbAYYib//L0wQgwBIKu79Q467Ypk4MwVldvx3pnYIpcWaSRf9k 994N2QY5Ave5D7SWB8I0EUWV5+VMep4HG49ItZ4PPuX3i5BlD2KUT2wEmYYZ6yN76J/N N4fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:cc:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:user-agent :mime-version:message-id:references:auto-submitted:to:date:from :dkim-signature:dkim-signature:dkim-signature; bh=DUMF2UxwHfQ5JauwGLNnqcFRirFmAn2BsYauLIltHYw=; fh=GFP4qDxgyJ2WEPo/oeLZg3Mj4NqvY1j2nTvTt7psNwg=; b=WHNDdIc5tfNP5Dhvvb5E7oHGqc8AxVq8Uwm3YMEeayDGyWgOhBkw46cI9611JqNYNK BhXn27AyM1oNwrDRHC15w1WVc0QciHOtt1a+w84rsvfXmFcc89thhm7yWPs4MAhx+dTY KiWLom6PohUwqp+HrXSVAHK0JpdLvUm5JwzehOJMELL0RVkHd1PwkWIg3xRKjyimbtd4 PTctf1kcmz7UhTaoYDvacpiCt2NmtsYw8ORMyR802C8sEEu2PobizceoMxBWA4wm/FMX xh+yVSYEOcRt/Q9hQhKJCD1AYxqVFlO0mz3OTXPqOhH0EYjIcfgeeDiV78Ls7o5uphrK RhMQ==; 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=MqgvjSit; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=KlHeZqpu; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=N2EzIy6e; 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=openvpn.net; dara=fail header.i=@openvpn.net Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id e9e14a558f8ab-3a7ccbea01esi7675255ab.61.2024.11.28.05.14.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Nov 2024 05:14:54 -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=MqgvjSit; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=KlHeZqpu; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=N2EzIy6e; 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=openvpn.net; dara=fail header.i=@openvpn.net Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1tGeLz-00081a-NT; Thu, 28 Nov 2024 13:14:43 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tGeLy-00081Q-5e for openvpn-devel@lists.sourceforge.net; Thu, 28 Nov 2024 13:14:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:Content-Transfer-Encoding:MIME-Version :Message-ID:Reply-To:References:Subject:List-Unsubscribe:List-Id:Cc:To:Date: From:Sender:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Help: List-Subscribe:List-Post:List-Owner:List-Archive; bh=OJrwShlWbstdbpwl0NrRwwOcL76f00jpYBwAO1hp7Y0=; b=MqgvjSit8mxVQu0mcvb1oIZnDp NYWf0nQfgwgGWgLK+TXtXsMvunKJ0ZtaqWZx4uOVTdjiY5qSux3Ht7xdxNI8q/raCyJWWXHD0FhD5 C1gZRpywlyZZqQNQ9i4WxM55B3Thne8pS1xbQS/SCynXsqnkNqOsd37E6xfCtKKwuJV4=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:Content-Transfer-Encoding:MIME-Version:Message-ID:Reply-To: References:Subject:List-Unsubscribe:List-Id:Cc:To:Date:From:Sender:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:In-Reply-To:List-Help:List-Subscribe:List-Post: List-Owner:List-Archive; bh=OJrwShlWbstdbpwl0NrRwwOcL76f00jpYBwAO1hp7Y0=; b=K lHeZqpu+YYP+LM6kvprWpbUcLbToE6xo8hJBFOtYMil2hkkBgkFioHjnjsyhWNkCUeo9VVcUFEpIy 7G9iXidb+6F+XMLIR45YTg9OcumwlIVObXYLa6XXyu91jzHs91FDFhpNxHxIGWcxeL3t9rcfW+1nV qGS/XaDWNZAAk/m4=; Received: from mail-wr1-f54.google.com ([209.85.221.54]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1tGeLw-00035I-8k for openvpn-devel@lists.sourceforge.net; Thu, 28 Nov 2024 13:14:41 +0000 Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-3824a8a5c56so625278f8f.3 for ; Thu, 28 Nov 2024 05:14:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvpn.net; s=google; t=1732799674; x=1733404474; darn=lists.sourceforge.net; h=user-agent:content-disposition:content-transfer-encoding :mime-version:message-id:reply-to:references:subject :list-unsubscribe:list-id:auto-submitted:cc:to:date:from:from:to:cc :subject:date:message-id:reply-to; bh=OJrwShlWbstdbpwl0NrRwwOcL76f00jpYBwAO1hp7Y0=; b=N2EzIy6evKL2F10+9AXhOt5w5L9oZXAVK3AH0DmROTiy5jC7hLJ70IQqqo7SQ8SLU4 qwNCfdcGDOAwTWFRPQhkHVHBic4niRqAvdYLUw70m4Tjsg6mNvMqXX3WHI2OYxXmD9j3 B/yS4Hu5NuWwlJMkXXx/mK7Ltnq5duiSNhZo1ddImXl8ghG1p/tmw/2UjA8ec2mmHjLO owh8xpvxVuEtjPgfyYCL2dF+KmAYfgYZg0M+eUobM4BmWglaQ+Xt11KXhkqCxXMTPGsZ AWz60ugDFBKISaHz4a3E2c8A6wZpOpdGl3GtMMjebHz2HI6fUsnc5KsoMnvtMWb5WQr6 kBgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732799674; x=1733404474; h=user-agent:content-disposition:content-transfer-encoding :mime-version:message-id:reply-to:references:subject :list-unsubscribe:list-id:auto-submitted:cc:to:date:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=OJrwShlWbstdbpwl0NrRwwOcL76f00jpYBwAO1hp7Y0=; b=fYP2KczMrgFr3UBU3YDLU0zPW0WJVC99tXAlEtpLGP7Yer0Jf1CW3tcfkumIh3F0dH sSyaETJ6a15yKUe9CSee7ILVk/dvEsCLOOpoiM5a+YW6GcoCKsNzFm1tolWhkPwmjoPp 5FZ+xEHa1/sJ/q63EYCFp2L+SYdNJ3cfntqOTmCjF1s4h3ceW5kj/jPtxVjjGADtHnwc lsAgybp2P4WEmRsDwgSwZmT73jv4IcEksxC6iC25bYYjNDuTWza1Zk9DxEwWA7oMpzNW MDOBYp3IfhS4MWcHlVDLuc9dilYOyKxd8B8y2cxWPkG1cCV0TqwyPXaoZjCkHorAW+Xk vNjw== X-Gm-Message-State: AOJu0YxvY18cqffoVzkocnXuH8DZe22AArQr8+E9AAkhhXyWREVu5qNy txaCUM4iWhHpxhATMtVNNin0y3vRRzNipF8jOJvEtzKgiC0uV/csl9snsvPffPo= X-Gm-Gg: ASbGncu//snJZ+nswg5PO43Sn65a/bUJg4yIevIRS14JBDuiFFdeXGqfMPYEPejfHJS O0lTrCPig81J5Q4q3EKuEXPeOHAy19XTy1MuK9QQ2XCVjC7f4lj35wd4XVC9J9J8N4KQjptdYP+ 5UW/SWVWC9Cg7hX5AJRc/GBWKmqjo+12v5FejEU/4J0u817ape1nB1Av2CyFCQVHUhRnZNjNhhG Jhqbw2pRQAndT9HJVxkypzFQwnmxVr1r9d83dl+/u4wLBgvtE101qkY4npuWTLnSnv44yePtJTp bz4RAy/fJnOwUKmWVzmq6fnMDezkjB4fQSzFGz6fBA== X-Received: by 2002:a05:6000:481b:b0:382:4f80:1359 with SMTP id ffacd0b85a97d-385c6eb74d4mr6681626f8f.20.1732799673595; Thu, 28 Nov 2024 05:14:33 -0800 (PST) Received: from gerrit.openvpn.in (ec2-18-159-0-78.eu-central-1.compute.amazonaws.com. [18.159.0.78]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-385ccd801e9sm1608097f8f.103.2024.11.28.05.14.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2024 05:14:33 -0800 (PST) From: "flichtenheld (Code Review)" X-Google-Original-From: "flichtenheld (Code Review)" X-Gerrit-PatchSet: 1 Date: Thu, 28 Nov 2024 13:14:32 +0000 To: plaisthos Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange X-Gerrit-Change-Id: I41eeae35ab23d9fb2512f33086f20f54c2d4f6df X-Gerrit-Change-Number: 823 X-Gerrit-Project: openvpn X-Gerrit-ChangeURL: X-Gerrit-Commit: 8e306c969c29257dfcf83f9d4a637d0dacce1733 References: Message-ID: MIME-Version: 1.0 User-Agent: Gerrit/3.8.2 X-Spam-Score: -1.1 (-) 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: Attention is currently required from: plaisthos. Hello plaisthos, I'd like you to do a code review. Please visit Content analysis details: (-1.1 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [209.85.221.54 listed in sa-trusted.bondedsender.org] 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. [209.85.221.54 listed in bl.score.senderscore.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.221.54 listed in list.dnswl.org] -0.9 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.221.54 listed in wl.mailspike.net] 0.0 WEIRD_PORT URI: Uses non-standard port number for HTTP 0.0 HTML_MESSAGE BODY: HTML included in message 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 T_KAM_HTML_FONT_INVALID Test for Invalidly Named or Formatted Colors in HTML X-Headers-End: 1tGeLw-00035I-8k Subject: [Openvpn-devel] [S] Change in openvpn[master]: 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: , Reply-To: frank@lichtenheld.com, arne-openvpn@rfc2549.org, openvpn-devel@lists.sourceforge.net Cc: openvpn-devel Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1816972171966853105?= X-GMAIL-MSGID: =?utf-8?q?1816972171966853105?= X-getmail-filter-classifier: gerrit message type newchange Attention is currently required from: plaisthos. Hello plaisthos, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/823?usp=email to review the following change. Change subject: macOS: Assume that net/if_utun.h is always present ...................................................................... macOS: Assume that net/if_utun.h is always present 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 --- M CMakeLists.txt M config.h.cmake.in M configure.ac M src/openvpn/tun.c 4 files changed, 14 insertions(+), 26 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/23/823/1 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)