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 <antonio@mandelbit.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
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 <gert@greenie.muc.de>
This commit is contained in:
Antonio Quartulli 2025-03-25 11:57:24 +01:00 committed by Gert Doering
parent 7825a8c586
commit 39cd7f29cb

View file

@ -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;