[Openvpn-devel,5/7] Remove support for blocking connect()

Message ID 20210421134348.1950392-5-arne@rfc2549.org
State Changes Requested
Headers show
Series [Openvpn-devel,1/7] Remove --disable-multihome option | expand

Commit Message

Arne Schwabe April 21, 2021, 3:43 a.m. UTC
It is hard to imagine that we still have any supported OS that does
not support non-blocking connect while still supporting non-blocking
sockets in general.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
---
 src/openvpn/socket.c  |  8 --------
 src/openvpn/syshead.h | 11 -----------
 2 files changed, 19 deletions(-)

Comments

Gert Doering April 21, 2021, 10:32 a.m. UTC | #1
Hi,

On Wed, Apr 21, 2021 at 03:43:46PM +0200, Arne Schwabe wrote:
> It is hard to imagine that we still have any supported OS that does
> not support non-blocking connect while still supporting non-blocking
> sockets in general.
[..]
> diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h
> index f29c63c73..a964ffd35 100644
> --- a/src/openvpn/syshead.h
> +++ b/src/openvpn/syshead.h
> @@ -155,10 +155,6 @@
>  #include <poll.h>
>  #endif
>  
> -#ifdef HAVE_SYS_EPOLL_H
> -#include <sys/epoll.h>
> -#endif
> -

Is that intentional?

gert
Arne Schwabe April 21, 2021, 12:19 p.m. UTC | #2
Am 21.04.21 um 22:32 schrieb Gert Doering:
> Hi,
> 
> On Wed, Apr 21, 2021 at 03:43:46PM +0200, Arne Schwabe wrote:
>> It is hard to imagine that we still have any supported OS that does
>> not support non-blocking connect while still supporting non-blocking
>> sockets in general.
> [..]
>> diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h
>> index f29c63c73..a964ffd35 100644
>> --- a/src/openvpn/syshead.h
>> +++ b/src/openvpn/syshead.h
>> @@ -155,10 +155,6 @@
>>  #include <poll.h>
>>  #endif
>>  
>> -#ifdef HAVE_SYS_EPOLL_H
>> -#include <sys/epoll.h>
>> -#endif
>> -
> 
> Is that intentional?

Managed to slip into wrong patch. I accidentally commited it with 5/7
instead of 7/7.

Arne

Patch

diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c
index 8a6e42cc6..4e13c65e8 100644
--- a/src/openvpn/socket.c
+++ b/src/openvpn/socket.c
@@ -1459,7 +1459,6 @@  openvpn_connect(socket_descriptor_t sd,
     protect_fd_nonlocal(sd, remote);
 #endif
 
-#ifdef CONNECT_NONBLOCK
     set_nonblock(sd);
     status = connect(sd, remote, af_addr_size(remote->sa_family));
     if (status)
@@ -1540,13 +1539,6 @@  openvpn_connect(socket_descriptor_t sd,
             }
         }
     }
-#else  /* ifdef CONNECT_NONBLOCK */
-    status = connect(sd, remote, af_addr_size(remote->sa_family));
-    if (status)
-    {
-        status = openvpn_errno();
-    }
-#endif /* ifdef CONNECT_NONBLOCK */
 
     return status;
 }
diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h
index f29c63c73..a964ffd35 100644
--- a/src/openvpn/syshead.h
+++ b/src/openvpn/syshead.h
@@ -155,10 +155,6 @@ 
 #include <poll.h>
 #endif
 
-#ifdef HAVE_SYS_EPOLL_H
-#include <sys/epoll.h>
-#endif
-
 #ifdef ENABLE_SELINUX
 #include <selinux/selinux.h>
 #endif
@@ -545,13 +541,6 @@  socket_defined(const socket_descriptor_t sd)
 #define EPOLL 0
 #endif
 
-/*
- * Is non-blocking connect() supported?
- */
-#if defined(SOL_SOCKET) && defined(SO_ERROR) && defined(EINPROGRESS) && defined(ETIMEDOUT)
-#define CONNECT_NONBLOCK
-#endif
-
 /*
  * Compression support
  */