]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Remove a number of platform specific checks in configure.ac
authorArne Schwabe <arne@rfc2549.org>
Thu, 22 Apr 2021 15:29:39 +0000 (17:29 +0200)
committerGert Doering <gert@greenie.muc.de>
Mon, 3 May 2021 06:18:55 +0000 (08:18 +0200)
- 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 <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
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 <gert@greenie.muc.de>
configure.ac
src/compat/compat.h
src/openvpn/event.c
src/openvpn/socket.c
src/openvpn/syshead.h

index 6fab623f488f4d8e964f4418d0744acaee051a69..267ffee8edb2f02aa9ef16d04a1495072cf3fb51 100644 (file)
@@ -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 <netinet/in.h>
 #endif
-#ifdef HAVE_WINDOWS_H
+#ifdef _WIN32
 #include <windows.h>
 #endif
-#ifdef HAVE_WINSOCK2_H
+#ifdef _WIN32
 #include <winsock2.h>
 #endif
-#ifdef HAVE_WS2TCPIP_H
+#ifdef _WIN32
 #include <ws2tcpip.h>
 #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 \
 ])
 
index 2bf48a5ebcdac83a796f0112b387807055987991..026974a81b2fe1a9950e92467527b151757c0dc3 100644 (file)
 #ifndef COMPAT_H
 #define COMPAT_H
 
-#ifdef HAVE_WINSOCK2_H
+#ifdef _WIN32
 #include <winsock2.h>
-#endif
-
-#ifdef HAVE_WS2TCPIP_H
 #include <ws2tcpip.h>
 #endif
 
index 14a25155cdde4515c67c84adf7f3c89cfa755abc..d766f8be881cef7e14e39e23e1d1b8883a5f8e67 100644 (file)
 #include "event.h"
 #include "fdmisc.h"
 
+#if EPOLL
+#include <sys/epoll.h>
+#endif
+
 #include "memdbg.h"
 
 /*
index 8a6e42cc68b35b9c3e800d8a438cc7ad5b24cc42..23b12560b732c7ec78f271c055409c2e5352bc20 100644 (file)
@@ -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
index 05aaa51835917680c19b04e96c8ff922ccba908f..0a3bc0b9420a7cdf0b42adf12753486feb1f0056 100644 (file)
 #include <fcntl.h>
 #endif
 
-#ifdef HAVE_IO_H
-#include <io.h>
-#endif
-
 #ifdef HAVE_SYS_FILE_H
 #include <sys/file.h>
 #endif
 #include <poll.h>
 #endif
 
-#ifdef HAVE_SYS_EPOLL_H
-#include <sys/epoll.h>
-#endif
-
 #ifdef ENABLE_SELINUX
 #include <selinux/selinux.h>
 #endif
@@ -342,6 +334,8 @@ typedef int MIB_TCP_STATE;
 #include <iphlpapi.h>
 #include <wininet.h>
 #include <shellapi.h>
+#include <io.h>
+
 /* The following two headers are needed of PF_INET6 */
 #include <winsock2.h>
 #include <ws2tcpip.h>
@@ -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?
  */