: Handle (DCO) timeouts in client mode
PATCH v2 1/1 : Handle (DCO) timeouts in client mode
Updated version of the timeout fix for client mode. This time with trigger_ping_timeout_signal() as suggested by Arne.
Best regards,
Kristof
PATCH 1/1 Handle (DCO) timeouts in client mode
From: Kristof Provost <[email protected]...>
Handle the DCO driver telling us that the peer went away, even if we're not running in multi-instance mode.
--- src/openvpn/forward.c | 6 ++++++ 1 file changed, 6 insertions(+)
src/openvpn/forward.c +6 -0
@@ -1111,6 +1111,12 @@ process_incoming_dco(struct context *c)dco_do_read (dco); +if (dco->dco_message_type ==OVPN_NOTIF_DEL_PEER ) + { +trigger_ping_timeout_signal (c); +return ; + } +if (dco->dco_message_type !=OVPN_CMD_PACKET ) { msg(D_DCO_DEBUG, "%s: received message of type %u - ignoring", __func__,
Signature · 1 line
2.36.0
Re: [Openvpn-devel] [PATCH] Handle (DCO) timeouts in client mode
Hi Kristof,
Quoted 4 lines · Kristof Provost via Openvpn-devel
From: Kristof Provost <[email protected]...>
Handle the DCO driver telling us that the peer went away, even if we're not running in multi-instance mode.
thanks for catching and fixing this. It was indeed on the todo list, but well hidden under the rest :-D
Quoted 11 lines
Signed-off-by Kristof Provost <[email protected]...>--- src/openvpn/forward.c | 6 ++++++ 1 file changed, 6 insertions(+)src/openvpn/forward.c +0
-0
src/openvpn/forward.c process_incoming_dco(struct context *c) · line 1114
Quoted 4 lines
src/openvpn/forward.c +1
-0@@ -1111,6 +1111,12 @@ process_incoming_dco(struct context *c)dco_do_read (dco); +if (dco->dco_message_type ==OVPN_NOTIF_DEL_PEER )
Not sure where this constant is coming from, but on ovpn_dco_linux.h we have OVPN_CMD_DEL_PEER (similar format as the following OVPN_CMD_PACKET).
Is that a format we can adhere to on BSD as well?
@Lev, just a heads up: does dco-win deal with this case? It would be good to have a look on your side too.
Regards,
Quoted 8 lines
src/openvpn/forward.c +5
-0+ { +trigger_ping_timeout_signal (c); +return ; + } +if (dco->dco_message_type !=OVPN_CMD_PACKET ) { msg(D_DCO_DEBUG, "%s: received message of type %u - ignoring", __func__,
Signature · 1 line
Antonio Quartulli
Re: [Openvpn-devel] [PATCH] Handle (DCO) timeouts in client mode
Hi,
Quoted 10 lines · Antonio Quartulli
src/openvpn/forward.c process_incoming_dco(struct context *c) · line 1114
Quoted 7 lines
src/openvpn/forward.c +1
-0@@ -1111,6 +1111,12 @@ process_incoming_dco(struct context *c)dco_do_read (dco); +if (dco->dco_message_type ==OVPN_NOTIF_DEL_PEER )Not sure where this constant is coming from, but on
ovpn_dco_linux.hwe haveOVPN_CMD_DEL_PEER(similar format as the followingOVPN_CMD_PACKET).
For "notifications coming from kernel", _NOTIF_ feels more logical than _CMD_ ("commands going into kernel"). No?
gert
Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you
feed honest figures into a computer, honest figures come out. Never doubted
it myself till I met a computer with a sense of humor."
Robert A. Heinlein, The Moon is a Harsh Mistress
Gert Doering - Munich, Germany [email protected]...Re: [Openvpn-devel] [PATCH] Handle (DCO) timeouts in client mode
Hi,
Quoted 9 lines · Gert Doering
Hi,
Quoted 6 lines · Antonio Quartulli
Quoted 6 lines
src/openvpn/forward.c +0
-0@@ -1111,6 +1111,12 @@ process_incoming_dco(struct context *c)dco_do_read (dco);
Quoted 7 lines
Quoted 4 lines
src/openvpn/forward.c process_incoming_dco(struct context *c) · line 1114
Quoted 1 line
src/openvpn/forward.c +1
-0+if (dco->dco_message_type ==OVPN_NOTIF_DEL_PEER )Not sure where this constant is coming from, but on
ovpn_dco_linux.hwe haveOVPN_CMD_DEL_PEER(similar format as the followingOVPN_CMD_PACKET).For "notifications coming from kernel", _NOTIF_ feels more logical than _CMD_ ("commands going into kernel"). No?
It's just the same message that can go both directions.
This is the same that the WiFi stack in the Linux kernel does with messages such as NEW_STA and DEL_STA.
So we're just re-using the same accepted pattern.
Regards,
Signature · 1 line
Antonio Quartulli
Re: [Openvpn-devel] [PATCH] Handle (DCO) timeouts in client mode
In reply to Antonio QuartulliQuoted 10 lines · Antonio Quartulli
Hi Kristof,
Quoted 4 lines · Kristof Provost via Openvpn-devel
From: Kristof Provost <[email protected]...>
Handle the DCO driver telling us that the peer went away, even if we're not running in multi-instance mode.
thanks for catching and fixing this. It was indeed on the todo list, but well hidden under the rest :-D
I know how todo piles work all too well.
Quoted 16 lines
src/openvpn/forward.c process_incoming_dco(struct context *c) · line 1112
Quoted 13 lines
Signed-off-by Kristof Provost <[email protected]...>--- src/openvpn/forward.c | 6 ++++++ 1 file changed, 6 insertions(+)src/openvpn/forward.c +0
-0@@ -1111,6 +1111,12 @@ process_incoming_dco(struct context *c)dco_do_read (dco); + if (dco->dco_message_type == OVPN_NOTIF_DEL_PEER)Not sure where this constant is coming from, but on
ovpn_dco_linux.hwe haveOVPN_CMD_DEL_PEER(similar format as the followingOVPN_CMD_PACKET).
Quoted 2 lines
Is that a format we can adhere to on BSD as well?
Good catch. OVPN_NOTIF_DEL_PEER is specific to the FreeBSD DCO interface and shouldn’t be used in the generic openvpn code. It worked accidentally because it has the same value as OVPN_CMD_DEL_PEER. We should indeed be using OVPN_CMD_DEL_PEER here.
I’ll update the patch and probably submit both the freebsd dco patch and this together in a few hours.
Kristof
Re: [Openvpn-devel] [PATCH] Handle (DCO) timeouts in client mode
In reply to Antonio QuartulliHi,
@Lev, just a heads up: does dco-win deal with this case? It would be
Quoted 2 lines
good to have a look on your side too.
Good point - this functionality (dco keepalive timeout) works in openvpn3 but not in openvpn2.
dco-win notifies userspace about keepalive timeout by returning certain error code (STATUS_CONNECTION_DISCONNECTED in kernel
which translates to GetLastError 64 ERROR_NETNAME_DELETED, don't ask me why) in response to read request, so we should catch it inside read_incoming_link() after link_socket_read() call. Will do.
Signature · 1 line
-Lev
Re: [Openvpn-devel] [PATCH] Handle (DCO) timeouts in client mode
How about we'll add dco_check_timeout(int, context) to dco.h with platform specific implementations?
Here is what I just did for Windows (Linux part is no-nop):
https://github.com/lstipakov/openvpn/commit/ce242896c621273578a446c5194d5ca6aee04237
ke 27. huhtik. 2022 klo 15.32 Lev Stipakov ([email protected]...) kirjoitti:
Quoted 18 lines
Hi,
@Lev, just a heads up: does dco-win deal with this case? It would be
Quoted 2 lines
good to have a look on your side too.
Good point - this functionality (dco keepalive timeout) works in openvpn3 but not in openvpn2.
dco-win notifies userspace about keepalive timeout by returning certain error code (
STATUS_CONNECTION_DISCONNECTEDin kernel
which translates to GetLastError 64ERROR_NETNAME_DELETED, don't ask me why) in response to read request, so we should catch it insideread_incoming_link()afterlink_socket_read()call. Will do.--
-Lev
Signature · 1 line
-Lev
Re: [Openvpn-devel] [PATCH] Handle (DCO) timeouts in client mode
And of course I forgot non-dco dummy implementation (which we don't call yet, because on Windows dco is always defined)
https://github.com/lstipakov/openvpn/commit/f223bef8449f15ff5de06acdfee16088b855c47a
ke 27. huhtik. 2022 klo 16.18 Lev Stipakov ([email protected]...) kirjoitti:
Quoted 32 lines
How about we'll add
dco_check_timeout(int, context)todco.hwith platform specific implementations?Here is what I just did for Windows (Linux part is no-nop):
https://github.com/lstipakov/openvpn/commit/ce242896c621273578a446c5194d5ca6aee04237ke 27. huhtik. 2022 klo 15.32 Lev Stipakov ([email protected]...) kirjoitti:
Quoted 9 lines
Hi,
@Lev, just a heads up: does dco-win deal with this case? It would be
Quoted 2 lines
good to have a look on your side too.
Good point - this functionality (dco keepalive timeout) works in openvpn3 but not in openvpn2.
Quoted 9 lines
dco-win notifies userspace about keepalive timeout by returning certain error code (
STATUS_CONNECTION_DISCONNECTEDin kernel
which translates to GetLastError 64ERROR_NETNAME_DELETED, don't ask me why) in response to read request, so we should catch it insideread_incoming_link()afterlink_socket_read()call. Will do.--
-Lev--
-Lev
Signature · 1 line
-Lev