mirror of
https://github.com/containers/gvisor-tap-vsock.git
synced 2025-12-24 13:29:22 +08:00
Add command line option to make network configuration of the TAP interface optional. This allows to use create the tap device using 'native' tools, for example: # nmcli connection add type tun ifname tap0 con-name tap0 mode tap # nmcli conn up tap0 ifname tap0 The advantage of not doing the configuration in the 'vm' binary is that we don't need to hardcode the name of a dhcp client and call it from go code, we can just use native OS networking (NetworkManager, systemd-resolved, ...) and let it do its work. There is currently no dhcp client easily available in ubi8 images, and for the images we use in CRC, we'd prefer not to use a busybox base image, this work helps with that. After this change, 'vm' can be started as a systemd service: [Unit] Description=gvisor-tap-vsock traffic forwarder BindsTo=sys-devices-virtual-net-tap0.device After=sys-devices-virtual-net-tap0.device [Service] Restart=on-success TimeoutStopSec=70 ExecStart=/usr/bin/gvisor-tap-vsock-forwarder -preexisting [Install] WantedBy=default.target Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>