diff options
author | Duncan Eastoe <duncan@graphiant.com> | 2021-09-08 19:11:33 +0100 |
---|---|---|
committer | Beno�t Ganne <bganne@cisco.com> | 2021-09-15 12:58:35 +0000 |
commit | 764a8780c2ad250b76f289d742d22216d8c0904e (patch) | |
tree | 039a766c83664368ac4f8bd3edefecca70a1ca4a /src/vlib/trace_funcs.h | |
parent | c26cc72edf195a3f57c734b5161bd37995002107 (diff) |
tap: set device name on creation via TUNSETIFF
Type: fix
Currently when a new TAP/TUN device is created from tap_create_if()
via the TUNSETIFF ioctl(), a name is allocated by the kernel (eg.
tap0). If the caller supplied a name this is subsequently set via
netlink, after the device has been created.
Now we request the kernel to create the new device with the caller's
requested name in the first instance, thus avoiding the need to
rename the device, and therefore avoiding a window where the device
exists with a different name.
This can be beneficial, for example, when writing systemd-udevd link
files [1]. Having the TAP/TUN devices created with the requested name
ensures they can be correctly matched by the OriginalName option.
Writing link files might be necessary, for example, to avoid VPP and
systemd-udevd racing to set the MAC address on a newly created TAP
interface. systemd-udevd can be configured to not manipulate the MAC
addresses of matched interfaces.
These changes also resolve an issue where the created device would not
be renamed if the caller requested it be moved to a different network
namespace, since vnet_netlink_set_link_name() was not called in that
case.
[1] https://www.freedesktop.org/software/systemd/man/systemd.link.html
Signed-off-by: Duncan Eastoe <duncan@graphiant.com>
Change-Id: I3d657632856d03979d6b914225c3c841c379e0a1
Diffstat (limited to 'src/vlib/trace_funcs.h')
0 files changed, 0 insertions, 0 deletions