Commit 79b0a436 authored by Thomas Haller's avatar Thomas Haller

device: merge branch 'th/device-unmanaged-settings-bgo762331'

https://bugzilla.gnome.org/show_bug.cgi?id=762331
parents 1f46ae57 c210134b
......@@ -8968,7 +8968,7 @@ NM_UTILS_FLAGS2STR_DEFINE (nm_unmanaged_flags2str, NMUnmanagedFlags,
NM_UTILS_FLAGS2STR (NM_UNMANAGED_PLATFORM_INIT, "platform-init"),
NM_UTILS_FLAGS2STR (NM_UNMANAGED_USER_EXPLICIT, "user-explicit"),
NM_UTILS_FLAGS2STR (NM_UNMANAGED_BY_DEFAULT, "by-default"),
NM_UTILS_FLAGS2STR (NM_UNMANAGED_USER_CONFIG, "user-config"),
NM_UTILS_FLAGS2STR (NM_UNMANAGED_USER_SETTINGS, "user-settings"),
NM_UTILS_FLAGS2STR (NM_UNMANAGED_USER_UDEV, "user-udev"),
NM_UTILS_FLAGS2STR (NM_UNMANAGED_EXTERNAL_DOWN, "external-down"),
NM_UTILS_FLAGS2STR (NM_UNMANAGED_IS_SLAVE, "is-slave"),
......@@ -9029,7 +9029,7 @@ _get_managed_by_flags(NMUnmanagedFlags flags, NMUnmanagedFlags mask, gboolean fo
* Some flags are authoritative, meaning they always cause
* the device to be unmanaged (e.g. @NM_UNMANAGED_PLATFORM_INIT).
*
* OTOH, some flags can be overwritten. For example NM_UNMANAGED_USER_CONFIG
* OTOH, some flags can be overwritten. For example NM_UNMANAGED_USER_SETTINGS
* is ignored once NM_UNMANAGED_USER_EXPLICIT is set. The idea is that
* the flag from the configuration has no effect once the user explicitly
* touches the unmanaged flags. */
......@@ -9051,31 +9051,20 @@ _get_managed_by_flags(NMUnmanagedFlags flags, NMUnmanagedFlags mask, gboolean fo
flags &= ~NM_UNMANAGED_USER_EXPLICIT;
}
if ( NM_FLAGS_ANY (mask, NM_UNMANAGED_USER_CONFIG)
&& !NM_FLAGS_ANY (flags, NM_UNMANAGED_USER_CONFIG)) {
/* NM_UNMANAGED_USER_CONFIG can only explicitly unmanage a device. It cannot
* *manage* it. Having NM_UNMANAGED_USER_CONFIG explicitly not set, is the
if ( NM_FLAGS_ANY (mask, NM_UNMANAGED_USER_SETTINGS)
&& !NM_FLAGS_ANY (flags, NM_UNMANAGED_USER_SETTINGS)) {
/* NM_UNMANAGED_USER_SETTINGS can only explicitly unmanage a device. It cannot
* *manage* it. Having NM_UNMANAGED_USER_SETTINGS explicitly not set, is the
* same as having it not set at all. */
mask &= ~NM_UNMANAGED_USER_CONFIG;
mask &= ~NM_UNMANAGED_USER_SETTINGS;
}
if (NM_FLAGS_ANY (mask, NM_UNMANAGED_USER_UDEV | NM_UNMANAGED_USER_CONFIG)) {
if (NM_FLAGS_ANY (mask, NM_UNMANAGED_USER_UDEV)) {
/* configuration from udev or nm-config overwrites the by-default flag
* which is based on the device type. */
flags &= ~NM_UNMANAGED_BY_DEFAULT;
}
if (NM_FLAGS_HAS (mask, NM_UNMANAGED_USER_CONFIG)) {
/* configuration from configuration overwrites the setting
* originating from udev.
*
* Actually, this check has no effect, because at this point,
* the device also is NM_UNMANAGED_USER_CONFIG. Thus clearing
* NM_UNMANAGED_USER_UDEV doesn't change the outcome.
* Just be explicit about this. */
flags &= ~NM_UNMANAGED_USER_UDEV;
}
if ( NM_FLAGS_HAS (mask, NM_UNMANAGED_IS_SLAVE)
&& !NM_FLAGS_HAS (flags, NM_UNMANAGED_IS_SLAVE)) {
/* for an enslaved device, by-default doesn't matter */
......@@ -9087,7 +9076,6 @@ _get_managed_by_flags(NMUnmanagedFlags flags, NMUnmanagedFlags mask, gboolean fo
* are ignored. */
flags &= ~( NM_UNMANAGED_BY_DEFAULT
| NM_UNMANAGED_USER_CONFIG
| NM_UNMANAGED_USER_UDEV
| NM_UNMANAGED_EXTERNAL_DOWN);
}
......@@ -9294,7 +9282,7 @@ nm_device_set_unmanaged_by_user_config (NMDevice *self, const GSList *unmanaged_
unmanaged = nm_device_spec_match_list (self, unmanaged_specs);
nm_device_set_unmanaged_by_flags (self,
NM_UNMANAGED_USER_CONFIG,
NM_UNMANAGED_USER_SETTINGS,
unmanaged,
unmanaged
? NM_DEVICE_STATE_REASON_NOW_UNMANAGED
......
......@@ -430,9 +430,11 @@ RfKillType nm_device_get_rfkill_type (NMDevice *device);
* yet initialized. Unrealized device are also unmanaged for this reason.
* @NM_UNMANAGED_USER_EXPLICIT: %TRUE when unmanaged by explicit user decision
* (e.g. via a D-Bus command)
* @NM_UNMANAGED_USER_SETTINGS: %TRUE when unmanaged by user decision via
* the settings plugin (for example keyfile.unmanaged-devices or ifcfg-rh's
* NM_CONTROLLED=no)
* @NM_UNMANAGED_BY_DEFAULT: %TRUE for certain device types where we unmanage
* them by default
* @NM_UNMANAGED_USER_CONFIG: %TRUE when unmanaged by user decision (via unmanaged-specs)
* @NM_UNMANAGED_USER_UDEV: %TRUE when unmanaged by user decision (via UDev rule)
* @NM_UNMANAGED_EXTERNAL_DOWN: %TRUE when unmanaged because !IFF_UP and not created by NM
* @NM_UNMANAGED_IS_SLAVE: indicates that the device is enslaved. Note that
......@@ -450,11 +452,11 @@ typedef enum { /*< skip >*/
NM_UNMANAGED_LOOPBACK = (1LL << 3),
NM_UNMANAGED_PLATFORM_INIT = (1LL << 4),
NM_UNMANAGED_USER_EXPLICIT = (1LL << 5),
NM_UNMANAGED_USER_SETTINGS = (1LL << 6),
/* These flags can be non-effective and be overwritten
* by other flags. */
NM_UNMANAGED_BY_DEFAULT = (1LL << 8),
NM_UNMANAGED_USER_CONFIG = (1LL << 9),
NM_UNMANAGED_USER_UDEV = (1LL << 10),
NM_UNMANAGED_EXTERNAL_DOWN = (1LL << 11),
NM_UNMANAGED_IS_SLAVE = (1LL << 12),
......
......@@ -516,6 +516,9 @@ dispose (GObject *object)
g_clear_object (&priv->inotify_helper);
g_clear_pointer (&priv->unmanaged_spec, g_free);
g_clear_pointer (&priv->unrecognized_spec, g_free);
G_OBJECT_CLASS (nm_ifcfg_connection_parent_class)->dispose (object);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment