Skip to content
  • Thomas Haller's avatar
    device: remove default-unmanaged and refactor unmanaged flags · 87a3df2e
    Thomas Haller authored
    Get rid of NM_UNMANAGED_DEFAULT and refine the interaction between
    unmanaged flags, device state and managed property.
    
    Previously, the NM_UNMANAGED_DEFAULT was special in that a device was
    still considered managed if it had solely the NM_UNMANAGED_DEFAULT flag
    set and its state was managed. Thus, whether the device (state) was managed,
    depended on the device state too.
    
    Now, a device is considered managed (or unmanaged) based on the unmanaged
    flags and realization state alone. At the same time, the device state
    directly corresponds to the managed property of the device. Of course,
    while changing the unmanaged flags, that invariant is shortly violated
    until the state transistion is complete.
    
    Introduce more unmanaged flags whereas some of them are non-authorative.
    For example, the EXTERNAL_DOWN flag has only effect as long as the user
    didn't explicitly manage the device (NM_UNMANAGED_USER_EXPLICIT). In other
    words, certain flags can render other flags ineffective. Whether the device
    is considered managed depends on the flags but also at the explicitly unset flags.
    In a way, this is similar to previous where NM_UNMANAGED_DEFAULT was ignored
    (if no other flags were present).
    
    Also, previously a device that was NM_UNMANAGED_DEFAULT and in disconnected
    state would transition back to unmanaged. No longer do that. Once a device is
    managed, it stays managed as long as the flags indicate it should be managed.
    However, the user can also modify the unmanaged flags via the D-Bus API.
    
    Also get rid or nm_device_finish_init(). That was previously called
    by NMManager after add_device(). As we now realize devices (possibly
    multiple times) this should be handled during realization.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=746566
    87a3df2e