From patchwork Wed Nov 22 13:09:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "plaisthos (Code Review)" X-Patchwork-Id: 3475 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:53c1:b0:f2:62eb:61c1 with SMTP id u1csp1088540dye; Wed, 22 Nov 2023 05:11:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IHoyXf6LrwfvhgagME/YvIARdoGzi0n7F4cCJWluo3rOoKEgv4mem2aXexXYoTTVBDLUkdh X-Received: by 2002:a17:902:f691:b0:1cf:55c7:94e9 with SMTP id l17-20020a170902f69100b001cf55c794e9mr2428907plg.2.1700658679621; Wed, 22 Nov 2023 05:11:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700658679; cv=none; d=google.com; s=arc-20160816; b=FALm+ECYjlOWjsQhoNyEr1kw8NsWGh5yrQZyKDwhrq6AOd/l7WmWgeXCkb9o0mRveQ NJoZY9UAinBB+7FqI7C5DS/c0jF+VVaxTifKCZiK/G6+pnHe0qUEVFgEHnl/X8IBQlEO E5SByfXKT5Ti7eT6W8rS5ypGPTIshklfIR+2uJutciwQCb3mdVBkxRcDvkbLfh4efERz x4Vcnt84s6apyen9CKGWpP6ibqWtoNvb1lpZKRBhShgChMmawkj/nPmpA0FhsOA7Irwa taJKfzGk63b5A79YBQIG60DvC0ls8+rVTQjs5bYR5ZIkcToV6pwJrtrv9xM/3j1kpSQE mnnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=zguVF72ivk0tc2lCEGaZ2CeY7/CzqPVs2K0lFmNyUB0=; fh=lm0MLPW7DntlrDqRECIiC9JlE1uPxhepE0URYHIf+eE=; b=V/Yma76M/Aq+OzKC7+a/3Metn+C0iE8RuanTtiZ4lAnXkFBBTCofx1K8eJm+3fVit3 /8rRbmeXOHYNUcUTG11hC8iHlDK3DJ7J2foliturvDQUCN1D7Ctfj6t6vgKm7JsQtu/1 QmBaI+ZT51aERpgRWsLFGcIIynIEUp/1wZw4TUrwGiB2GbpnU1I1EvQ8CtENAL44Kjnf 2//dk+y4xC2McF4uiZhsvHOxlFoBM2BuUBKQnmlci45Jft4e8DvUdp2Uae7x+IKGHFlU GNppB/uV7AIscajyEcjnplbVyZMFDzsZYguAB6eNENScMclUqsZniHKU2vjxu1nuxAhh eDwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=XJ7koDha; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=dzx6OP3e; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=KVh4pMXS; 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 Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id d4-20020a170902854400b001c9cc243868si11840695plo.618.2023.11.22.05.11.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2023 05:11:19 -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=XJ7koDha; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=dzx6OP3e; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=KVh4pMXS; 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 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 1r5mzn-0003d8-3a; Wed, 22 Nov 2023 13:10:23 +0000 Received: from [172.30.20.202] (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 1r5mzF-0003cL-Ca for openvpn-devel@lists.sourceforge.net; Wed, 22 Nov 2023 13:09:50 +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=88xdSHvDmWkYQtNxedKZPLF2FNg9NMy+coL3Y8I8vlE=; b=XJ7koDha1ywr6+epgK+O0PDF2I toT3AcK2vZJWBkVVsLOD+CdA7tbGljriqW0QSrGc0RoljCPvELnQuFT1V6ZrcVOSOqW0V36sJi9Dd VyWBWdty2q9xg4VQC+N9+sjAcchKQ9lSbRJxrLNPMv98yMPO+YiG68cnY4GaTqORy2VQ=; 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=88xdSHvDmWkYQtNxedKZPLF2FNg9NMy+coL3Y8I8vlE=; b=d zx6OP3eX97HMnh2Zjbx8z1h4VrMXufVM8CJHZswwR+BNtiPCeiqZRYThAzzUPBW7jFRi0fbZibmUU 6hGiYNEwO3uQb0aQB3TWXihXadIVMlzLb9Huz7B1gT2CFLlo8q7jJVtc/Im6cNtj2Q2oGVJ1vtJ5m MVeG6R+We/B6TYBI=; Received: from mail-wr1-f46.google.com ([209.85.221.46]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1r5mz8-00CmOO-Qj for openvpn-devel@lists.sourceforge.net; Wed, 22 Nov 2023 13:09:49 +0000 Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-32f78dcf036so493890f8f.0 for ; Wed, 22 Nov 2023 05:09:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvpn.net; s=google; t=1700658576; x=1701263376; 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=88xdSHvDmWkYQtNxedKZPLF2FNg9NMy+coL3Y8I8vlE=; b=KVh4pMXSt4y7ek7G92G88nY96a3/dsvucONZhbC1hvfd+TUqavwu/kDknxTd7HDTfs ihKusCdeffVldkz1cpczqlE1RCC6XX/Zid++a9ytVneaMMyURtEf9hGPe9R2PJQEzLAA oKhSN4blgVeIMrwsVt2sYj4sewJC5GA1j08Ch5LuLTHWE/XU+QR1hsPldKs4nRt0flw2 c+ZSnyUaFLKnhYjR9GHaBrF7TYuTM/ebiK1TCaMMMJmxkpVlvQWwZKUoKpCAIiycrz31 0Ls/LE87AJGhwJlwVJyQjIf7DDhLgcM81RaaWzy8uKPjAlxHgoQeNEBd8wIT0jJHRWG4 1oBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700658576; x=1701263376; 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=88xdSHvDmWkYQtNxedKZPLF2FNg9NMy+coL3Y8I8vlE=; b=ib0F8essMXtLfOq9YspwPTxkmhTOOhQP8LwOmukjaANlsSNPkGbd+PJ/TG6hprDPjh Vw1crQPJ+OCFw7KQ3CWZlJ94eWsdxNk7/AIJSLqgTaofyqKtUB6ZDNHq967jaVC8UzH2 a9q64eN6vtWfwuIoSP2bHaESaoxzBOwzwGZ5T7X37gSzsQslk4yWfs0JhO3WwyJABDOj BptZo/e+1s3kZpL8RNMe6ZywIZcDTfQp6if05Z+kHy2X7zEHWrUwBYSDYhI5f5uOlHba EaQC4bw0DfDBRtLas2JCNioUjxiHqte5FQnXIX+8gHWwK4GzxEW1WbLpKR5E7tYIh3xA Sohw== X-Gm-Message-State: AOJu0YzBEyxFNwg1chUVRIeiEN0JmTvnFA8eZLwXorJVxDoaOG2JeSia qhPxyv6uMu8j5lIY/QKOYlP4GI/IbMH+mZOj2xo= X-Received: by 2002:a05:6000:1549:b0:332:d05c:79e7 with SMTP id 9-20020a056000154900b00332d05c79e7mr2596714wry.35.1700658575595; Wed, 22 Nov 2023 05:09:35 -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 a18-20020adfeed2000000b00327de0173f6sm17272777wrp.115.2023.11.22.05.09.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 05:09:35 -0800 (PST) From: "plaisthos (Code Review)" X-Google-Original-From: "plaisthos (Code Review)" X-Gerrit-PatchSet: 1 Date: Wed, 22 Nov 2023 13:09:34 +0000 To: flichtenheld Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange X-Gerrit-Change-Id: I66e3dd7b7166459526824fe5ae81a449b375b8db X-Gerrit-Change-Number: 458 X-Gerrit-Project: openvpn X-Gerrit-ChangeURL: X-Gerrit-Commit: 20bdfe8e00f30cb6d5e261d2bbdecc6791e01b8a References: Message-ID: MIME-Version: 1.0 User-Agent: Gerrit/3.8.2 X-Spam-Score: -0.2 (/) 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: Attention is currently required from: flichtenheld. Hello flichtenheld, I'd like you to do a code review. Please visit Content analysis details: (-0.2 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.221.46 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.221.46 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_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 T_KAM_HTML_FONT_INVALID Test for Invalidly Named or Formatted Colors in HTML -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Headers-End: 1r5mz8-00CmOO-Qj Subject: [Openvpn-devel] [S] Change in openvpn[master]: Minimal Solaris/OpenIndiana support to Cmake and clean up -Werror 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: arne-openvpn@rfc2549.org, openvpn-devel@lists.sourceforge.net, frank@lichtenheld.com Cc: openvpn-devel Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1783269875574925475?= X-GMAIL-MSGID: =?utf-8?q?1783269875574925475?= X-getmail-filter-classifier: gerrit message type newchange Attention is currently required from: flichtenheld. Hello flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/458?usp=email to review the following change. Change subject: Minimal Solaris/OpenIndiana support to Cmake and clean up -Werror ...................................................................... Minimal Solaris/OpenIndiana support to Cmake and clean up -Werror Change-Id: I66e3dd7b7166459526824fe5ae81a449b375b8db Signed-off-by: Arne Schwabe --- M CMakeLists.txt M config.h.cmake.in M src/openvpn/route.c M src/openvpn/tun.c 4 files changed, 18 insertions(+), 12 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/58/458/1 diff --git a/CMakeLists.txt b/CMakeLists.txt index d21c9bd..c3a55ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,11 +121,17 @@ set(TARGET_FREEBSD YES) set(ENABLE_DCO YES) link_libraries(-lnv) +elseif (${CMAKE_SYSTEM_NAME} STREQUAL "SunOS") + set(TARGET_SOLARIS YES) + set(HAVE_SYS_SOCKIO_H 1) + link_libraries(-lnsl -lsocket -lresolv) elseif (WIN32) 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 () if (UNIX) diff --git a/config.h.cmake.in b/config.h.cmake.in index 19b79bc..5b93fc5 100644 --- a/config.h.cmake.in +++ b/config.h.cmake.in @@ -336,7 +336,7 @@ #cmakedefine HAVE_SYS_SOCKET_H /* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SOCKIO_H +#cmakedefine HAVE_SYS_SOCKIO_H /* Define to 1 if you have the header file. */ #define HAVE_SYS_STAT_H 1 @@ -443,6 +443,9 @@ /* Are we running on Linux? */ #cmakedefine TARGET_LINUX +/* Are we running on Solaris/OpenIndiana? */ +#cmakedefine TARGET_SOLARIS + /* Are we running WIN32? */ #cmakedefine TARGET_WIN32 diff --git a/src/openvpn/route.c b/src/openvpn/route.c index ff64938..6cc112c 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -2342,12 +2342,11 @@ return; } -#ifndef _WIN32 +#if !defined(_WIN32) #if !defined(TARGET_LINUX) const char *gateway; -#else - int metric; #endif +#if !defined(TARGET_SOLARIS) bool gateway_needed = false; const char *device = tt->actual_name; if (r6->iface != NULL) /* vpn server special route */ @@ -2365,6 +2364,7 @@ gateway_needed = true; } #endif +#endif struct gc_arena gc = gc_new(); struct argv argv = argv_new(); @@ -2395,7 +2395,7 @@ msg( M_INFO, "delete_route_ipv6(%s/%d)", network, r6->netbits ); #if defined(TARGET_LINUX) - metric = -1; + int metric = -1; if ((r6->flags & RT_METRIC_DEFINED) && (r6->metric > 0)) { metric = r6->metric; diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 82ab6c0..f1b8699 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -1900,7 +1900,7 @@ #endif -#if !(defined(_WIN32) || defined(TARGET_LINUX)) +#if !(defined(_WIN32) || defined(TARGET_LINUX) || defined(TARGET_SOLARIS)) static void open_tun_generic(const char *dev, const char *dev_type, const char *dev_node, struct tuntap *tt) @@ -2061,7 +2061,7 @@ } #endif /* TARGET_LINUX || TARGET_FREEBSD*/ -#if !defined(_WIN32) +#if !(defined(_WIN32) || defined(TARGET_SOLARIS)) static void close_tun_generic(struct tuntap *tt) { @@ -2398,13 +2398,12 @@ open_tun(const char *dev, const char *dev_type, const char *dev_node, struct tuntap *tt, openvpn_net_ctx_t *ctx) { - int if_fd, ip_muxid, arp_muxid, arp_fd, ppa = -1; + int if_fd = -1, ip_muxid = -1, arp_muxid = -1, arp_fd = -1, ppa = -1; struct lifreq ifr; const char *ptr; - const char *ip_node, *arp_node; + const char *ip_node = NULL, *arp_node = NULL; const char *dev_tuntap_type; int link_type; - bool is_tun; struct strioctl strioc_if, strioc_ppa; /* improved generic TUN/TAP driver from @@ -2428,7 +2427,6 @@ } dev_tuntap_type = "tun"; link_type = I_PLINK; - is_tun = true; } else if (tt->type == DEV_TYPE_TAP) { @@ -2440,7 +2438,6 @@ arp_node = dev_node; dev_tuntap_type = "tap"; link_type = I_PLINK; /* was: I_LINK */ - is_tun = false; } else {