Hi,

I did some testing and found out that this breaks when establishing
TCP connection to a server which cannot be reached:

> +    *tt = dco_create_socket(sock->info.lsa->current_remote,
> +                            sock->bind_local,
> +                            sock->info.lsa->bind_local,
> +                            c->options.dev_node,
> +                            &c->gc,
> +                            
> get_server_poll_remaining_time(sock->server_poll_timeout),
> +                            signal_received);
> +    if (*signal_received)
> +    {
> +        return;
> +    }
> +    c->c1.tuntap = tt;
> +    sock->info.dco_installed = true;

If TCP server cannot be reached, the kernel reports it to userspace
which triggers a signal. Signal handler calls
teardown code which accesses c->c1.tuntap, which is not set (since
return is above the assignment), causing access violation.

dco_installed flag should also be moved above return, since if not
set, c->c1.tuntap won't be cleared
which triggers this assert after reconnect:

    /* In this case persist-tun is enabled, which we don't support yet */
    ASSERT(!c->c1.tuntap);

I suggest to change code like this:

    /* This state is used by signal handler which does teardown,
     * so it has to be set before return */
    c->c1.tuntap = tt;
    sock->info.dco_installed = true;

    if (*signal_received)
    {
        return;
    }

Again, we discussed this in chat and suggested changes are already
pushed to the dco branch.

-Lev


_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to