Skip to content

Commit

Permalink
Set netlink socket to be non-blocking
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Antonio Quartulli <[email protected]>
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg26353.html
Signed-off-by: Gert Doering <[email protected]>
  • Loading branch information
schwabe authored and cron2 committed Mar 9, 2023
1 parent 5a14a5e commit 7aa3520
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/openvpn/dco_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,9 @@ ovpn_dco_init_netlink(dco_context_t *dco)
nl_geterror(ret));
}

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

dco->nl_cb = nl_cb_alloc(NL_CB_DEFAULT);
if (!dco->nl_cb)
Expand Down

0 comments on commit 7aa3520

Please sign in to comment.