diff options
-rw-r--r-- | libnm-core/nm-dbus-interface.h | 3 | ||||
-rw-r--r-- | src/devices/nm-device.c | 9 | ||||
-rw-r--r-- | src/nm-active-connection.c | 1 |
3 files changed, 13 insertions, 0 deletions
diff --git a/libnm-core/nm-dbus-interface.h b/libnm-core/nm-dbus-interface.h index 857de7da58..229c5d253f 100644 --- a/libnm-core/nm-dbus-interface.h +++ b/libnm-core/nm-dbus-interface.h @@ -885,6 +885,8 @@ typedef enum { * @NM_ACTIVATION_STATE_FLAG_LAYER2_READY: layer2 is activated and ready. * @NM_ACTIVATION_STATE_FLAG_IP4_READY: IPv4 setting is completed. * @NM_ACTIVATION_STATE_FLAG_IP6_READY: IPv6 setting is completed. + * @NM_ACTIVATION_STATE_FLAG_MASTER_HAS_SLAVES: The master has any slave devices attached. + * This only makes sense if the device is a master. * * Flags describing the current activation state. * @@ -898,6 +900,7 @@ typedef enum { /*< flags >*/ NM_ACTIVATION_STATE_FLAG_LAYER2_READY = (1LL << 2), NM_ACTIVATION_STATE_FLAG_IP4_READY = (1LL << 3), NM_ACTIVATION_STATE_FLAG_IP6_READY = (1LL << 4), + NM_ACTIVATION_STATE_FLAG_MASTER_HAS_SLAVES = (1LL << 5), } NMActivationStateFlags; #endif /* __NM_DBUS_INTERFACE_H__ */ diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 814935a21f..cad5aee7de 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -2215,6 +2215,12 @@ nm_device_master_release_one_slave (NMDevice *self, NMDevice *slave, gboolean co g_object_unref (slave); g_slice_free (SlaveInfo, info); + if (c_list_is_empty (&priv->slaves)) { + _active_connection_set_state_flags_full (self, + 0, + NM_ACTIVATION_STATE_FLAG_MASTER_HAS_SLAVES); + } + /* Ensure the device's hardware address is up-to-date; it often changes * when slaves change. */ @@ -3724,6 +3730,9 @@ nm_device_master_add_slave (NMDevice *self, NMDevice *slave, gboolean configure) c_list_link_tail (&priv->slaves, &info->lst_slave); slave_priv->master = g_object_ref (self); + _active_connection_set_state_flags (self, + NM_ACTIVATION_STATE_FLAG_MASTER_HAS_SLAVES); + /* no need to emit * * _notify (slave, PROP_MASTER); diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c index f7d02eedbc..632e42b4f1 100644 --- a/src/nm-active-connection.c +++ b/src/nm-active-connection.c @@ -153,6 +153,7 @@ NM_UTILS_FLAGS2STR_DEFINE_STATIC (_state_flags_to_string, NMActivationStateFlags NM_UTILS_FLAGS2STR (NM_ACTIVATION_STATE_FLAG_LAYER2_READY, "layer2-ready"), NM_UTILS_FLAGS2STR (NM_ACTIVATION_STATE_FLAG_IP4_READY, "ip4-ready"), NM_UTILS_FLAGS2STR (NM_ACTIVATION_STATE_FLAG_IP6_READY, "ip6-ready"), + NM_UTILS_FLAGS2STR (NM_ACTIVATION_STATE_FLAG_MASTER_HAS_SLAVES, "master-has-slaves"), ); /*****************************************************************************/ |