From patchwork Thu Nov 27 10:37:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4639 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:6c3:b0:7b1:439f:bdf with SMTP id j3csp3983004maw; Thu, 27 Nov 2025 02:37:35 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWawmBlpQR70f2/w4Sp6EdNoSvcQ0eepeQm936oABzOc4N2SBb1zj+7eSfrptgVtcRU1ydrVV30opU=@openvpn.net X-Google-Smtp-Source: AGHT+IGLwTxEe+dFo/cYWejZUkx8vYcY7XgQNS/ygjOAMHNT0wtL1dl/p3ehaF2C88nGSLgHAMLB X-Received: by 2002:a05:6808:180a:b0:450:1b83:a092 with SMTP id 5614622812f47-45115b1dcf3mr9300167b6e.63.1764239854772; Thu, 27 Nov 2025 02:37:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1764239854; cv=none; d=google.com; s=arc-20240605; b=Pz7HhY7JOk7J2oTfv13IppVNByIJ5a4yUy77KrLdMKvsV3a1QasL5sXsbV44//vbEc c/iFPQTgm6u4d5xKqJgpXk/iQEsWZ+cx1V6nCOVIr5cTouv6+q0r/pFew+LQUY7M6+3P IaCEcTZbFIbCtwba95H0Z8in9SRyDxJtMHVNFBnC2F8LbfLuEydOeds3KfwVrxr3fygu sXYiRaoJONryqYNgoYjB7AmNgK4TwblSisfnD3/1Bvw4pAyuFDN8hregYuReXvC2uJqC JZWEniIDs00jJyD0Z/zpHYQLMmiEsyGtT7wOWmBrc9tKIgYr2yFDIS6uGV6yQkCVPumQ eh7w== 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=EgJPgVQHqLDM7PzN/XWqBa5Mbi/VPE8uYmqNWSgvmYM=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=fdArr3O1jMM7bavUJQkCrCM8SofcxSRU5LajIaamBHH6HXDxnoUkhY+0mb7Baz4u5v BhWtEdUpsCxyc3C7biZdqlRg24le7/Kzbz1DxZf5dovYXzsUz5pCGyFL0htXTqe0BGTp YafZ696DT59IjXs1KFX4aa9+HB6MHvNvclvU+XMLeOMwlZflDYHUJ1gOOH2F+QBkeKiV IOkgbsKXDSBMXCEK+GrlML+XhC53GVaV2/LWtm2hOBJj0vXF3T/8RTe+1B/piSaZjl67 4E1mT/XIoGVREb4/21NMapLWKhGZ5H6sNpDypaTHwVETSW+ce0+Wm0+cajxt+OHk2Z3d PW1g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=dswUCSDN; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=CgEJnGEF; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=NowM+gQ1; 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 586e51a60fabf-3f0dd041118si132629fac.1169.2025.11.27.02.37.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Nov 2025 02:37: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=pass header.i=@lists.sourceforge.net header.s=beta header.b=dswUCSDN; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=CgEJnGEF; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=NowM+gQ1; 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=EgJPgVQHqLDM7PzN/XWqBa5Mbi/VPE8uYmqNWSgvmYM=; b=dswUCSDNZ0R7WRbwGyXopNpXb/ YRg/HQgtlTRRGbfE0GJN+WT4Dk/CeaRk9ojOr/+klrOddV5SSAhCyVlv5UBPSnitb3+QmK2cb12mO XbKw3V1Fxaxxa1/ZKczSi8rjCw5iUHBOJGmld3nNAEGFUkegaJpyrJNx2Au/3KmRjvGY=; 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 1vOZNP-0004kv-3h; Thu, 27 Nov 2025 10:37:27 +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 1vOZNM-0004ko-Fi for openvpn-devel@lists.sourceforge.net; Thu, 27 Nov 2025 10:37:24 +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=PgYQR+mwTOzfn8CEU2lwNFeytVn26/JGbEY7ibnlhXs=; b=CgEJnGEF4jZT0ktzpj8bMdEnnQ wygLNeRHQkPUxbx7rfTyTfxKghjF6e19QI3gEB1SJRjlLA4hk/CKt4gHSe/cg7LGLRPif5zS7dkzz ZLE+oqo26Nqp3O1rGzLTyDRzdsptJs+sLAnpREu7Lvib3/bytvPUSIhoBsqA6aww9OpY=; 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=PgYQR+mwTOzfn8CEU2lwNFeytVn26/JGbEY7ibnlhXs=; b=NowM+gQ1hLjXOJnqaf5I7LmxXE nujRqYA/gNpXLHhihiT2doWIbRMMCtnTZTYSw/zmRwzAdXnL3MsoYr8pfce+F3mJ4ykN6W2YkZvzv TAdkKpZOW5NxwoFfwibdLxJaVGfvjISvhp2gJgTczo2pcd+mrl2TK5ybsy0cPzPF32uY=; 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 1vOZNK-0003Ts-Sf for openvpn-devel@lists.sourceforge.net; Thu, 27 Nov 2025 10:37:24 +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 5ARAbAjx029356 for ; Thu, 27 Nov 2025 11:37:10 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 5ARAbAUu029355 for openvpn-devel@lists.sourceforge.net; Thu, 27 Nov 2025 11:37:10 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Thu, 27 Nov 2025 11:37:05 +0100 Message-ID: <20251127103710.29341-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 Some things were detected in configure.ac and just hard-coded in CMake. Move the hard-coding to syshead.h instead and remove the additional code in configure.ac. These are really Windows-specific so I [...] 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: 1vOZNK-0003Ts-Sf Subject: [Openvpn-devel] [PATCH v2] configure/CMake: Unify Windows handling 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?1849939570258435832?= X-GMAIL-MSGID: =?utf-8?q?1849939570258435832?= From: Frank Lichtenheld Some things were detected in configure.ac and just hard-coded in CMake. Move the hard-coding to syshead.h instead and remove the additional code in configure.ac. These are really Windows-specific so I think not dynamically detecting is okay. Change-Id: Ic55e1288b0d3160e68eef07ff4edbb070a03dd31 Signed-off-by: Frank Lichtenheld Acked-by: Arne Schwabe Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1410 --- 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/+/1410 This mail reflects revision 2 of this Change. Acked-by according to Gerrit (reflected above): Arne Schwabe diff --git a/config.h.cmake.in b/config.h.cmake.in index f68ea27..bf1388c 100644 --- a/config.h.cmake.in +++ b/config.h.cmake.in @@ -411,32 +411,3 @@ #ifndef _GNU_SOURCE # define _GNU_SOURCE 1 #endif - -/* if inttypes.h is included this breaks rc.exe when using the ClangCL - * Toolchain as it pulls in a inttypes.h variant for clang that rc.exe does - * not understand (#include_next preprocessor directive) */ -#if defined(_WIN32) && !defined(RC_INVOKED) -#include -typedef uint32_t in_addr_t; -typedef uint16_t in_port_t; - -#define SIGHUP 1 -#define SIGINT 2 -#define SIGUSR1 10 -#define SIGUSR2 12 -#define SIGTERM 15 -#endif - -#if defined(_MSC_VER) && !defined(RC_INVOKED) -#include -typedef SSIZE_T ssize_t; -#define strncasecmp strnicmp -#define strcasecmp _stricmp - -#define S_IRUSR _S_IREAD -#define S_IWUSR _S_IWRITE -#define R_OK 4 -#define W_OK 2 -#define X_OK 1 -#define F_OK 0 -#endif diff --git a/configure.ac b/configure.ac index 60799e0..73b388b 100644 --- a/configure.ac +++ b/configure.ac @@ -527,18 +527,6 @@ [[${SOCKET_INCLUDES}]] ) -AC_CHECK_TYPES( - [in_addr_t], - , - [AC_DEFINE([in_addr_t], [uint32_t], [Workaround missing in_addr_t])], - [[${SOCKET_INCLUDES}]] -) -AC_CHECK_TYPES( - [in_port_t], - , - [AC_DEFINE([in_port_t], [uint16_t], [Workaround missing in_port_t])], - [[${SOCKET_INCLUDES}]] -) AC_CHECK_TYPE( [struct msghdr], [AC_DEFINE([HAVE_MSGHDR], [1], [struct msghdr needed for extended socket error support])], @@ -600,48 +588,6 @@ ) LDFLAGS="$saved_LDFLAGS" -dnl We emulate signals in Windows -AC_CHECK_DECLS( - [SIGHUP], - , - [AC_DEFINE([SIGHUP], [1], [SIGHUP replacement])], - [[ - #include - ]] -) -AC_CHECK_DECLS( - [SIGINT], - , - [AC_DEFINE([SIGINT], [2], [SIGINT replacement])], - [[ - #include - ]] -) -AC_CHECK_DECLS( - [SIGUSR1], - , - [AC_DEFINE([SIGUSR1], [10], [SIGUSR1 replacement])], - [[ - #include - ]] -) -AC_CHECK_DECLS( - [SIGUSR2], - , - [AC_DEFINE([SIGUSR2], [12], [SIGUSR2 replacement])], - [[ - #include - ]] -) -AC_CHECK_DECLS( - [SIGTERM], - , - [AC_DEFINE([SIGTERM], [15], [SIGTERM replacement])], - [[ - #include - ]] -) - AC_FUNC_FORK AC_CHECK_FUNCS([ \ diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h index c6f2608..627ba92 100644 --- a/src/openvpn/syshead.h +++ b/src/openvpn/syshead.h @@ -44,6 +44,35 @@ #define srandom srand #endif +/* if inttypes.h is included this breaks rc.exe when using the ClangCL + * Toolchain as it pulls in a inttypes.h variant for clang that rc.exe does + * not understand (#include_next preprocessor directive) */ +#if defined(_WIN32) && !defined(RC_INVOKED) +#include +typedef uint32_t in_addr_t; +typedef uint16_t in_port_t; + +#define SIGHUP 1 +#define SIGINT 2 +#define SIGUSR1 10 +#define SIGUSR2 12 +#define SIGTERM 15 +#endif + +#if defined(_MSC_VER) && !defined(RC_INVOKED) +#include +typedef SSIZE_T ssize_t; +#define strncasecmp strnicmp +#define strcasecmp _stricmp + +#define S_IRUSR _S_IREAD +#define S_IWUSR _S_IWRITE +#define R_OK 4 +#define W_OK 2 +#define X_OK 1 +#define F_OK 0 +#endif + #if defined(_MSC_VER) && !defined(__clang__) /* Microsoft compiler */ #define __func__ __FUNCTION__ #define __attribute__(x)