mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-03-24 11:20:59 +01:00
core: add "external" flag for active connections of external devices
This commit is contained in:
parent
96c9703b50
commit
8d6dbd1746
2 changed files with 22 additions and 3 deletions
|
|
@ -1024,6 +1024,8 @@ typedef enum { /*< flags >*/
|
|||
* of the activation is bound to the visilibity of the connection profile,
|
||||
* which in turn depends on "connection.permissions" and whether a session
|
||||
* for the user exists. Since: 1.16
|
||||
* @NM_ACTIVATION_STATE_FLAG_EXTERNAL: the active connection was generated to
|
||||
* represent an external configuration of a networking device. Since: 1.26
|
||||
*
|
||||
* Flags describing the current activation state.
|
||||
*
|
||||
|
|
@ -1039,6 +1041,7 @@ typedef enum { /*< flags >*/
|
|||
NM_ACTIVATION_STATE_FLAG_IP6_READY = 0x10,
|
||||
NM_ACTIVATION_STATE_FLAG_MASTER_HAS_SLAVES = 0x20,
|
||||
NM_ACTIVATION_STATE_FLAG_LIFETIME_BOUND_TO_PROFILE_VISIBILITY = 0x40,
|
||||
NM_ACTIVATION_STATE_FLAG_EXTERNAL = 0x80,
|
||||
} NMActivationStateFlags;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -163,6 +163,7 @@ NM_UTILS_FLAGS2STR_DEFINE (_state_flags_to_string, NMActivationStateFlags,
|
|||
NM_UTILS_FLAGS2STR (NM_ACTIVATION_STATE_FLAG_IP6_READY, "ip6-ready"),
|
||||
NM_UTILS_FLAGS2STR (NM_ACTIVATION_STATE_FLAG_MASTER_HAS_SLAVES, "master-has-slaves"),
|
||||
NM_UTILS_FLAGS2STR (NM_ACTIVATION_STATE_FLAG_LIFETIME_BOUND_TO_PROFILE_VISIBILITY, "lifetime-bound-to-profile-visibility"),
|
||||
NM_UTILS_FLAGS2STR (NM_ACTIVATION_STATE_FLAG_EXTERNAL, "external"),
|
||||
);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -340,7 +341,12 @@ nm_active_connection_set_state_fail (NMActiveConnection *self,
|
|||
NMActivationStateFlags
|
||||
nm_active_connection_get_state_flags (NMActiveConnection *self)
|
||||
{
|
||||
return NM_ACTIVE_CONNECTION_GET_PRIVATE (self)->state_flags;
|
||||
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self);
|
||||
|
||||
return priv->state_flags
|
||||
| ( priv->activation_type == NM_ACTIVATION_TYPE_EXTERNAL
|
||||
? NM_ACTIVATION_STATE_FLAG_EXTERNAL
|
||||
: NM_ACTIVATION_STATE_FLAG_NONE);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -351,6 +357,8 @@ nm_active_connection_set_state_flags_full (NMActiveConnection *self,
|
|||
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self);
|
||||
NMActivationStateFlags f;
|
||||
|
||||
nm_assert (!NM_FLAGS_HAS (mask, NM_ACTIVATION_STATE_FLAG_EXTERNAL));
|
||||
|
||||
f = (priv->state_flags & ~mask) | (state_flags & mask);
|
||||
if (f != priv->state_flags) {
|
||||
char buf1[_NM_ACTIVATION_STATE_FLAG_TO_STRING_BUFSIZE];
|
||||
|
|
@ -869,10 +877,14 @@ _set_activation_type (NMActiveConnection *self,
|
|||
NMActivationType activation_type)
|
||||
{
|
||||
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self);
|
||||
gboolean state_flags_changed;
|
||||
|
||||
if (priv->activation_type == activation_type)
|
||||
return;
|
||||
|
||||
state_flags_changed = (priv->activation_type == NM_ACTIVATION_TYPE_EXTERNAL)
|
||||
!= (activation_type == NM_ACTIVATION_TYPE_EXTERNAL);
|
||||
|
||||
priv->activation_type = activation_type;
|
||||
|
||||
if (priv->settings_connection.obj) {
|
||||
|
|
@ -881,6 +893,9 @@ _set_activation_type (NMActiveConnection *self,
|
|||
else
|
||||
g_signal_handlers_disconnect_by_func (priv->settings_connection.obj, _settings_connection_flags_changed, self);
|
||||
}
|
||||
|
||||
if (state_flags_changed)
|
||||
_notify (self, PROP_STATE_FLAGS);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1253,7 +1268,8 @@ static void
|
|||
get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (object);
|
||||
NMActiveConnection *self = NM_ACTIVE_CONNECTION (object);
|
||||
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self);
|
||||
char **strv;
|
||||
NMDevice *master_device = NULL;
|
||||
|
||||
|
|
@ -1300,7 +1316,7 @@ get_property (GObject *object, guint prop_id,
|
|||
}
|
||||
break;
|
||||
case PROP_STATE_FLAGS:
|
||||
g_value_set_uint (value, priv->state_flags);
|
||||
g_value_set_uint (value, nm_active_connection_get_state_flags (self));
|
||||
break;
|
||||
case PROP_DEFAULT:
|
||||
g_value_set_boolean (value, priv->is_default);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue