From 39cd7f29cbccd37b07ddc27eb23b8ad270f43e77 Mon Sep 17 00:00:00 2001 From: Antonio Quartulli Date: Tue, 25 Mar 2025 11:57:24 +0100 Subject: [PATCH] socket: use remote proto when creating client sockets When creating a socket to connect to a remote (this happens in client mode) always use the protocol specified for the remote. The listening protocol in this case is just ignored as it does not make any sense. Change-Id: I6d2ec69ac7a9ef5900d8f1d8541d6a19c9cb7df9 Signed-off-by: Antonio Quartulli Acked-by: Arne Schwabe Message-Id: <20250325105724.1285-1-gert@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31234.html Signed-off-by: Gert Doering --- src/openvpn/socket.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 09de1b0b..4fb6fe6c 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -1903,6 +1903,11 @@ link_socket_init_phase1(struct context *c, int sock_index, int mode) const char *remote_host = o->ce.remote; const char *remote_port = o->ce.remote_port; + if (remote_host) + { + proto = o->ce.proto; + } + if (c->mode == CM_CHILD_TCP || c->mode == CM_CHILD_UDP) { struct link_socket *tmp_sock = NULL;