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.
This commit is contained in:
Thomas Haller 2018-04-19 13:24:11 +02:00
parent feb1ec1e87
commit 5a1f84b085
3 changed files with 14 additions and 6 deletions

View file

@ -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

View file

@ -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) {

View file

@ -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 {