summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-04-19 13:24:11 +0200
committerThomas Haller <thaller@redhat.com>2018-04-30 16:36:29 +0200
commit5a1f84b085835742e715a05b4e5e65e518a47c42 (patch)
treed110e1a194686efad4c50629ce94e906ed0e0405
parentfeb1ec1e879146b88c6ee23ddf5ed37b2ec83ec5 (diff)
downloadNetworkManager-5a1f84b085835742e715a05b4e5e65e518a47c42.tar.gz
core: add activation-reasons for external/assume connections
Until now, we only really cared about whether a connection was activated with reason NM_ACTIVATION_REASON_AUTOCONNECT_SLAVES or not. Now however, we will care about whether a connection was activated via (genuine) autoconnect by NMPolicy, or external/assume by NMManager. Add a new reason to distinguish between them.
-rw-r--r--src/nm-active-connection.c8
-rw-r--r--src/nm-manager.c2
-rw-r--r--src/nm-types.h10
3 files changed, 14 insertions, 6 deletions
diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c
index 4c77d45bb1..ae8e9e7ed2 100644
--- a/src/nm-active-connection.c
+++ b/src/nm-active-connection.c
@@ -55,7 +55,12 @@ typedef struct _NMActiveConnectionPrivate {
bool master_ready:1;
NMActivationType activation_type:3;
- NMActivationReason activation_reason:3;
+
+ /* capture the original reason why the connection was activated.
+ * For example with NM_ACTIVATION_REASON_ASSUME, the connection
+ * will later change to become fully managed. But the original
+ * reason never changes. */
+ NMActivationReason activation_reason:4;
NMAuthSubject *subject;
NMActiveConnection *master;
@@ -1422,6 +1427,7 @@ constructed (GObject *object)
}
g_return_if_fail (priv->subject);
+ g_return_if_fail (priv->activation_reason != NM_ACTIVATION_REASON_UNSET);
}
static void
diff --git a/src/nm-manager.c b/src/nm-manager.c
index 4a831f3e8c..25ba1c278a 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -2562,7 +2562,7 @@ recheck_assume_connection (NMManager *self,
device,
subject,
generated ? NM_ACTIVATION_TYPE_EXTERNAL : NM_ACTIVATION_TYPE_ASSUME,
- NM_ACTIVATION_REASON_AUTOCONNECT,
+ generated ? NM_ACTIVATION_REASON_EXTERNAL : NM_ACTIVATION_REASON_ASSUME,
&error);
if (!active) {
diff --git a/src/nm-types.h b/src/nm-types.h
index fb48dfef39..1477d22696 100644
--- a/src/nm-types.h
+++ b/src/nm-types.h
@@ -75,10 +75,12 @@ typedef enum {
} NMActivationType;
typedef enum {
- NM_ACTIVATION_REASON_UNSET = 0,
- NM_ACTIVATION_REASON_AUTOCONNECT = 1,
- NM_ACTIVATION_REASON_AUTOCONNECT_SLAVES = 2,
- NM_ACTIVATION_REASON_USER_REQUEST = 3,
+ NM_ACTIVATION_REASON_UNSET,
+ NM_ACTIVATION_REASON_EXTERNAL,
+ NM_ACTIVATION_REASON_ASSUME,
+ NM_ACTIVATION_REASON_AUTOCONNECT,
+ NM_ACTIVATION_REASON_AUTOCONNECT_SLAVES,
+ NM_ACTIVATION_REASON_USER_REQUEST,
} NMActivationReason;
typedef enum {