Generate connection from device runtime status
This happens at NetworkManager startup or when a new device is detected.
Detect the method
A physical device should be managed and connected if a matching connection profile was found, managed and disconnected if it has no address configuration (link-local IPv6 is not taken into account) or unmanaged (it's already configured but no matching connection was found).
|IPv4 disabled / IPv6 link-local
- IPv4 link-local can be detected as well (by an address from 169.254.0.0/16 range)
- IPv4 shared cannot be detected.
- IPv6 ignore is obsolete.
- IPv6 link-local is an equivalent to IPv4 disabled (subject to change).
- IPv6 DHCP method is still broken and cannot be distinguished from IPv6 auto.
Handle software device (if applicable)
My opinion is that software devices should be managed if their configuration matches a configured connection. Otherwise they should still be tracked but not managed.
What does it mean for a device to be unmanaged
- It won't be touched by NetworkManager as long as it's unmanaged (that includes software device deletion procedure).
- Administrator can make it managed at any time with its current configuration (if any).
- Administrator can choose to activate another connection configuration on it (it's then managed, of course).
- The device can block default gateway configuration