systemd icon indicating copy to clipboard operation
systemd copied to clipboard

networkd: add flag to keep file descriptor open on TUN/TAP to ensure network doesn't flap

Open bluca opened this issue 3 years ago • 0 comments

Component

systemd-networkd

Is your feature request related to a problem? Please describe

When the process owning the other end of a TUN/TAP device goes away and the file descriptor is closed, the interface in the kernel goes from 'running' to 'no-carrier', causing the network to flap. In some cases this happen when the process providing the connection is being swapped out for another one, for any number of reasons (upgrade, move, etc).

Describe the solution you'd like

Having a flag on the network config that causes networkd to keep the FD open, to ensure persistence of the network device, would be great. netdev_tuntap_add() opens a file descriptor on a tun/tap device to set some options, so it could be retained at that point.

Describe alternatives you've considered

Another custom process that opens a device and sits there, but it's a bit clunky and manual, and needs to be managed (eg: interface really needs to go down sometimes).

bluca avatar Aug 09 '22 20:08 bluca