Set netlink socket to be non-blocking
PATCH 1/1 Set netlink socket to be non-blocking
Even though we use select/poll to explicitly query when the nextlink 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 seoneds (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.
--- src/openvpn/dco_linux.c | 2 ++ 1 file changed, 2 insertions(+)
src/openvpn/dco_linux.c +2 -0
@@ -359,7 +359,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)
Signature · 1 line
2.37.1 (Apple Git-137.1)
Hi,
Quoted 1 line · Arne Schwabe
Even though we use select/poll to explicitly query when the nextlink
nextlink -> netlink
Quoted 7 lines
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 seoneds (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 I35447c23a9350176007df5455bf9451021e9856dSigned-off-by Arne Schwabe <[email protected]...>
Well spotted!
Quoted 18 lines
--- src/openvpn/dco_linux.c | 2 ++ 1 file changed, 2 insertions(+)src/openvpn/dco_linux.c +2
-0@@ -359,7 +359,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)
Signature · 1 line
Antonio Quartulli
I cannot reproduce this particular problem on my Linux/DCO systems here, but with the problem description, the patch makes sense.
Minimally tested on a Linux/DCO system.
Your patch has been applied to the master and release/2.6 branch.
commit 7aa3520768a68fb6a73ab64569c7be5d571f86fc (master) commit 35104bdc937191d49c3505a354444eb6a267e9ee (release/2.6)
Author: Arne Schwabe Date: Wed Mar 8 16:19:45 2023 +0100
Set netlink socket to be non-blocking
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]...>--
kind regards,
Gert Doering