Comment 15 for bug 1701023

Revision history for this message
Dan Streetman (ddstreet) wrote :

The reason that udev calls /lib/udev/vlan-network-interface is because of hotplugging.

During boot up, as network interfaces are detected by the kernel, they are reported to udev, and udev passes each to vlan-network-interface. If the vlan-network-interface script detects that a new interface is configured in ifupdown as a 'vlan-raw-device', then it calls /etc/network/if-pre-up.d/vlan which creates the vlan interface.

Udev also, after all other processing, calls systemd (or upstart) with the interface, and that in turn calls ifup for the interface. Thus, during boot up, all physical interfaces are ifup'ed directly, and all vlans are created and also ifup'ed manually. After all that completes, then systemd/upstart finally calls ifup -a to bring up any remaining configured interfaces.

The bootup process does not require vlan interfaces to be created and configured, as the final 'ifup -a' will create and configure them. However, after bootup, and physical devices that are hotplugged will be detected by udev, and passed to systemd/upstart which calls ifup for the hotplugged interface - but, without udev calling vlan-network-interface, the hotplugging of a physical interface will not cause any of its associated vlan interfaces to be created or configured.

So what this means is vlan interfaces do need to be created when their raw-device interface is detected and/or configured; however, it does not need to (and, should not happen during) udev processing of the raw-device interface. That is what causes the race condition between the raw device interface and its vlan(s), as described in bug 1573272.

Instead, an physical device's vlan interfaces should be created during ifup of that physical device. That way, the vlan interface's raw-device is guaranteed to be already up and configured, but also vlan interfaces will be created and configured when a physical device is hotplugged.

I'll investigate updating ifupdown and/or the vlan scripts to change to this method instead of the current design.