OpenVPN / openvpn

OpenVPN is an open source VPN daemon
http://openvpn.net
Other
10.58k stars 2.96k forks source link

OpenVPN 2.6.2 crash with DCO module after network connection is back #303

Open bjoernv opened 1 year ago

bjoernv commented 1 year ago

I use OpenVPN 2.6.2 with DCO module 0.2.20230323-5-g961c60d. The OpenVPN connection was lost every day at the same time. I found, that on this time the Internet router reboots. OpenVPN is running in client mode. After checking the logs I found, the the OpenVPN crashes, if the Internet connection is back.

To Reproduce

Expected behavior The OpenVPN daemon should not crash and should reconnect if the Internet is available again.

Version information (please complete the following information):

Additional context The coredump shows this information:

# coredumpctl gdb 17442
           PID: 17442 (openvpn)
           UID: 0 (root)
           GID: 0 (root)
        Signal: 11 (SEGV)
     Timestamp: Sat 2023-04-01 18:18:13 CEST (6min ago)
  Command Line: /usr/sbin/openvpn --daemon openvpn@client-mybox --writepid /run/openvpn/client-mybox.pid --cd /etc/openvpn/ --config client-mybox.conf
    Executable: /usr/sbin/openvpn
 Control Group: /system.slice/system-openvpn.slice/openvpn@client-mybox.service
          Unit: openvpn@client-mybox.service
         Slice: system-openvpn.slice
       Boot ID: 990cd0d299374b82808b548806bae5d8
    Machine ID: bce8d279423663d4735b9a3c000003e1
      Hostname: mybox
       Storage: /var/lib/systemd/coredump/core.openvpn.0.990cd0d299374b82808b548806bae5d8.17442.1680365893000000.zst (present)
  Size on Disk: 220.9K
       Message: Process 17442 (openvpn) of user 0 dumped core.

                Stack trace of thread 17442:
                #0  0x00005569876be4bc n/a (openvpn + 0x2b4bc)
                #1  0x00005569876bfae0 dco_get_peer_stats (openvpn + 0x2cae0)
                #2  0x00005569876f8d60 n/a (openvpn + 0x65d60)
                #3  0x00005569876b0dcb main (openvpn + 0x1ddcb)
                #4  0x00007fc648554bb0 __libc_start_call_main (libc.so.6 + 0x27bb0)
                #5  0x00007fc648554c79 __libc_start_main@@GLIBC_2.34 (libc.so.6 + 0x27c79)
                #6  0x00005569876b0df5 _start (openvpn + 0x1ddf5)
                ELF object binary architecture: AMD x86-64

This is the OpenVPN client profile:

client
tls-client
dev tun
txqueuelen 1000
proto udp
port 1194
remote vpn-server.domain.tld 1194
resolv-retry infinite
nobind
persist-key
ca /etc/openvpn/pki/ca.crt
cert /etc/openvpn/pki/issued/mybox-client1.crt
key /etc/openvpn/pki/private/mybox-client1.key
auth-retry interact
management-signal
management 127.0.0.1 8888 management-auth.txt
management-query-passwords
crl-verify /etc/openvpn/pki/crl.pem
remote-cert-tls server
tls-auth /etc/openvpn/pki/HMAC-key/ta.key 1
data-ciphers-fallback AES-256-GCM
verb 2
auth-user-pass /etc/openvpn/login.txt
auth-nocache
script-security 2
explicit-exit-notify 2
reneg-sec 0
fast-io
selvanair commented 1 year ago

Thanks for the report with stack trace:

#0  0x00005569876be4bc n/a (openvpn + 0x2b4bc)
#1  0x00005569876bfae0 dco_get_peer_stats (openvpn + 0x2cae0)

This is fixed by commit d01b9d75 and will be in 2.6.3.

bjoernv commented 1 year ago

This is fixed by commit d01b9d7 and will be in 2.6.3.

Yes, I tested successfully with this patch.