Mac-VLAN is a Linux network driver that allows creating multiple virtual interfaces with unique MAC addresses on top of a single physical interface. These virtual interfaces act as standalone devices on the network, each with its own IP and MAC address.
CRIU identifies Mac-VLAN interfaces by monitoring netlink messages (specifically RTM_NEWLINK) and inspecting their attributes.
During a dump, CRIU extracts the following attributes for each Mac-VLAN device:
IFLA_LINK).bridge, private, vepa, passthru), extracted from IFLA_MACVLAN_MODE.IFLA_MACVLAN_FLAGS).To recreate a Mac-VLAN interface exactly as it was, CRIU performs the following:
RTM_NEWLINK netlink message with the kind set to "macvlan", specifying the original mode and the link to the parent device.IFLA_NEW_IFINDEX attribute. This allows CRIU to request the exact same interface index that the device possessed before the checkpoint. (This kernel feature was originally developed specifically to support CRIU).Since the parent physical interface may have a different name or index on the destination host during migration, CRIU provides the --external option to map these dependencies:
# Example mapping of an internal macvlan interface to a host physical interface
criu restore --external macvlan[eth0]:phys0 ...
This tells CRIU that the Mac-VLAN interface which was originally attached to eth0 should now be attached to the physical interface phys0 on the current host.