Skip to content

Commit 7aa3520

Browse files
schwabecron2
authored andcommitted
Set netlink socket to be non-blocking
Even though we use select/poll to explicitly query when the netlink socket is ready for read, sometimes we end up reading from the socket when it is not ready to read and then the process hangs for several seconds (20-30s). Avoid this situation by setting the socket to be non-blocking, so we get a status in this case that allows us to continue. Change-Id: I35447c23a9350176007df5455bf9451021e9856d Signed-off-by: Arne Schwabe <arne@rfc2549.org> Acked-by: Antonio Quartulli <a@unstable.cc> Message-Id: <20230308151945.3670151-1-arne@rfc2549.org> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg26353.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
1 parent 5a14a5e commit 7aa3520

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/openvpn/dco_linux.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,9 @@ ovpn_dco_init_netlink(dco_context_t *dco)
355355
nl_geterror(ret));
356356
}
357357

358+
/* set close on exec and non-block on the netlink socket */
358359
set_cloexec(nl_socket_get_fd(dco->nl_sock));
360+
set_nonblock(nl_socket_get_fd(dco->nl_sock));
359361

360362
dco->nl_cb = nl_cb_alloc(NL_CB_DEFAULT);
361363
if (!dco->nl_cb)

0 commit comments

Comments
 (0)