Linux DCO: pre-existing ovpn interface handling is broken

Aperta
#1,064 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

@ralflici ci sta già lavorando.

Dal 27/6/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

When starting openvpn with a pre-existing Linux DCO interface, userspace appears to enter the intended "existing DCO device" path, but the interface is not actually adopted correctly.

Reproducer:

modprobe ovpn
ip link add tun0 type ovpn
openvpn --dev tun0 ...

The program seems to correctly detect the underlying interface:

open_tun_dco: tun0
net_iface_new: add tun0 type ovpn
sitnl_send: rtnl: generic error (-17): File exists
Cannot create DCO interface tun0: -17
DCO device tun0 already exists, won't be destroyed at shutdown
ovpn-dco device [tun0] opened

But when a client connects, DCO netlink operations fail:

dco_new_peer: peer-id 0 ...
kernel error: ovpn: ifindex does not match any interface
dco_new_peer: netlink reports device not found
Exiting due to fatal error

And despite the earlier "won't be destroyed at shutdown" message, shutdown deletes the interface:

Closing ovpn-dco interface
net_iface_del: delete tun0

So there seem to be two userspace bugs in this path:

  1. The -EEXIST branch in net_iface_new() marks the interface persistent, but does not set tt->dco.ifindex from the existing device. Later generic netlink messages are sent with an invalid ifindex.
  2. close_tun_dco() deletes the interface unconditionally and does not honor tt->persistent_if.

Note that there is also a mode wrinkle: ovpn interfaces need to be created with the correct mode (as a netlink parameter): MP for server and P2P for p2p/client. Userspace will likely need to verify that mode too when adopting a pre-existing ovpn interface.

Lingua principale
C
Stelle
14.8k
Fork
3.4k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OpenVPN/openvpn

Tutte le issue di OpenVPN/openvpn

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.