From: Arne Schwabe Date: Thu, 22 Apr 2021 15:29:39 +0000 (+0200) Subject: Remove a number of platform specific checks in configure.ac X-Git-Tag: v2.6_beta1~514 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ba49c9a7bf7dfeea181b5f18a921a5d29c9b10b3;p=thirdparty%2Fopenvpn.git Remove a number of platform specific checks in configure.ac - Remove windows XP/old mingw compat code in socket.c - Use _WIN32 instead checking for existence of windows.h, winsock2.h and ws2tcpip.h in autconf - Remove check for unlink. The last remaining use is a check inside a Unix socket. - Even Windows has umask, so remove the check for it - Move epoll.h inclusion to event.c Patch V2: Add epoll.h syshead.h that accidently was put into another patch Signed-off-by: Arne Schwabe Acked-by: Gert Doering Message-Id: <20210422152939.2134046-6-arne@rfc2549.org> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22201.html Signed-off-by: Gert Doering --- diff --git a/configure.ac b/configure.ac index 6fab623f4..267ffee8e 100644 --- a/configure.ac +++ b/configure.ac @@ -419,7 +419,6 @@ AC_CHECK_HEADERS([ \ unistd.h dlfcn.h \ netinet/in.h netinet/in_systm.h \ netinet/tcp.h arpa/inet.h netdb.h \ - windows.h winsock2.h ws2tcpip.h \ versionhelpers.h \ ]) AC_CHECK_HEADERS([ \ @@ -445,13 +444,13 @@ SOCKET_INCLUDES=" #ifdef HAVE_NETINET_IN_H #include #endif -#ifdef HAVE_WINDOWS_H +#ifdef _WIN32 #include #endif -#ifdef HAVE_WINSOCK2_H +#ifdef _WIN32 #include #endif -#ifdef HAVE_WS2TCPIP_H +#ifdef _WIN32 #include #endif #ifdef HAVE_NETINET_IN_SYSTM_H @@ -630,8 +629,8 @@ AC_CHECK_FUNCS([ \ daemon chroot getpwnam setuid nice system getpid dup dup2 \ syslog openlog mlockall getrlimit getgrnam setgid \ setgroups flock readv writev time gettimeofday \ - setsid chdir getpeername unlink \ - chsize ftruncate execve getpeereid umask basename dirname access \ + setsid chdir getpeername \ + chsize ftruncate execve getpeereid basename dirname access \ epoll_create strsep \ ]) diff --git a/src/compat/compat.h b/src/compat/compat.h index 2bf48a5eb..026974a81 100644 --- a/src/compat/compat.h +++ b/src/compat/compat.h @@ -24,11 +24,8 @@ #ifndef COMPAT_H #define COMPAT_H -#ifdef HAVE_WINSOCK2_H +#ifdef _WIN32 #include -#endif - -#ifdef HAVE_WS2TCPIP_H #include #endif diff --git a/src/openvpn/event.c b/src/openvpn/event.c index 14a25155c..d766f8be8 100644 --- a/src/openvpn/event.c +++ b/src/openvpn/event.c @@ -35,6 +35,10 @@ #include "event.h" #include "fdmisc.h" +#if EPOLL +#include +#endif + #include "memdbg.h" /* diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 8a6e42cc6..23b12560b 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -1385,14 +1385,6 @@ socket_listen_accept(socket_descriptor_t sd, return new_sd; } -/* older mingw versions and WinXP do not have this define, - * but Vista and up support the functionality - just define it here - */ -#ifdef _WIN32 -#ifndef IPV6_V6ONLY -#define IPV6_V6ONLY 27 -#endif -#endif void socket_bind(socket_descriptor_t sd, struct addrinfo *local, @@ -3913,10 +3905,7 @@ socket_bind_unix(socket_descriptor_t sd, const char *prefix) { struct gc_arena gc = gc_new(); - -#ifdef HAVE_UMASK const mode_t orig_umask = umask(0); -#endif if (bind(sd, (struct sockaddr *) local, sizeof(struct sockaddr_un))) { @@ -3927,10 +3916,7 @@ socket_bind_unix(socket_descriptor_t sd, sockaddr_unix_name(local, "NULL")); } -#ifdef HAVE_UMASK umask(orig_umask); -#endif - gc_free(&gc); } @@ -3975,12 +3961,10 @@ void socket_delete_unix(const struct sockaddr_un *local) { const char *name = sockaddr_unix_name(local, NULL); -#ifdef HAVE_UNLINK if (name && strlen(name)) { unlink(name); } -#endif } bool diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h index 05aaa5183..0a3bc0b94 100644 --- a/src/openvpn/syshead.h +++ b/src/openvpn/syshead.h @@ -100,10 +100,6 @@ #include #endif -#ifdef HAVE_IO_H -#include -#endif - #ifdef HAVE_SYS_FILE_H #include #endif @@ -155,10 +151,6 @@ #include #endif -#ifdef HAVE_SYS_EPOLL_H -#include -#endif - #ifdef ENABLE_SELINUX #include #endif @@ -342,6 +334,8 @@ typedef int MIB_TCP_STATE; #include #include #include +#include + /* The following two headers are needed of PF_INET6 */ #include #include @@ -541,12 +535,6 @@ socket_defined(const socket_descriptor_t sd) #define EPOLL 0 #endif -/* Disable EPOLL */ -#if 0 -#undef EPOLL -#define EPOLL 0 -#endif - /* * Is non-blocking connect() supported? */