OpenVPN / OpenVPN/openvpn

Not using socks5 proxy after server push reset command

Open
#662 0 comments 0 reactions 1 assignee View on GitHub

@flichtenheld is already working on this.

Since Jan 7, 2025.

bug
Dominant language
C
Stars
14.6k
Forks
3.4k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
My ISP is blocking openvpn, so I use openvpn via a socks5 proxy.
The initial connection from my client to the server always succeeds.
However, my OpenVPN server sometimes pushes the connection reset command to the client.
I found out that every connection immediately after connection reset would fail.
According to the log, when reconnecting after receiving the connection reset command, OpenVPN was not using the SOCKS proxy.
So I debugged this issue.
It seems that the following code is causing the bug.

// from socket.c:1697
static void
resolve_remote(struct link_socket *sock,
               int phase,
               const char **remote_dynamic,
               struct signal_info *sig_info)
{
    volatile int *signal_received = sig_info ? &sig_info->signal_received : NULL;
    struct gc_arena gc = gc_new();

    /* resolve remote address if undefined */
    if (!sock->info.lsa->remote_list)  // <<<<< remote_list is not null
    {
    ....
    }

    if (link_socket_actual_defined(&sock->info.lsa->actual)) {....}
    else
    {
        CLEAR(sock->info.lsa->actual);
        if (sock->info.lsa->current_remote)
        {
            set_actual_address(&sock->info.lsa->actual,
                               sock->info.lsa->current_remote); // <<<<< runs up to here, the current_remote(openvpn server) instead of the proxy server is used
        }
    }



To Reproduce

  1. connect to server via a socks proxy
  2. server push reset command to client

Expected behavior
client connect to server via socks proxy

Version information (please complete the following information):

  • OS: Windows 11 23H2
  • OpenVPN version: 2.6.12

Additional context
Add any other context about the problem here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.