aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-05-26 10:21:10 -0700
committerFlorin Coras <florin.coras@gmail.com>2021-05-26 18:48:32 +0000
commit88b2269a45c91e8378a1fd652f28aa39926a7a6a (patch)
tree8dd9bdac14cefab1830da80ab31a2467fc2eb863 /src/vppinfra
parente82d59f3819aa7ca989eed5b8c4c890e9f7fe74e (diff)
vppinfra: explicit blocking mode for sock connects
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I3a33230de13fef613dc9523cf24a9968d200c2e5 (cherry picked from commit 57e0af924b8b48cf39b1020bf11f10e3c227f22c)
Diffstat (limited to 'src/vppinfra')
-rw-r--r--src/vppinfra/socket.c4
-rw-r--r--src/vppinfra/socket.h2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/vppinfra/socket.c b/src/vppinfra/socket.c
index 1d8b2ca2e45..d8427852400 100644
--- a/src/vppinfra/socket.c
+++ b/src/vppinfra/socket.c
@@ -518,8 +518,10 @@ clib_socket_init (clib_socket_t * s)
s->fd, s->config);
goto done;
}
- /* Connect was blocking so set fd to non-blocking now */
+ /* Connect was blocking so set fd to non-blocking now unless
+ * blocking mode explicitly requested. */
if (!(s->flags & CLIB_SOCKET_F_NON_BLOCKING_CONNECT) &&
+ !(s->flags & CLIB_SOCKET_F_BLOCKING) &&
fcntl (s->fd, F_SETFL, O_NONBLOCK) < 0)
{
error = clib_error_return_unix (0, "fcntl NONBLOCK2 (fd %d, '%s')",
diff --git a/src/vppinfra/socket.h b/src/vppinfra/socket.h
index b5f005839e4..78a56fee53e 100644
--- a/src/vppinfra/socket.h
+++ b/src/vppinfra/socket.h
@@ -62,7 +62,7 @@ typedef struct _socket_t
#define CLIB_SOCKET_F_ALLOW_GROUP_WRITE (1 << 4)
#define CLIB_SOCKET_F_SEQPACKET (1 << 5)
#define CLIB_SOCKET_F_PASSCRED (1 << 6)
-
+#define CLIB_SOCKET_F_BLOCKING (1 << 7)
/* Transmit buffer. Holds data waiting to be written. */
u8 *tx_buffer;