summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-04-05 21:07:34 +0200
committerThomas Haller <thaller@redhat.com>2018-04-13 11:54:53 +0200
commitb77528863cf10b71a1cb5020cff2b2ff219009f6 (patch)
tree2b1e9ff1b978923e78d33505cd3ce9f208cc447e
parent70ba27e1eb4234766845802b004c110e80d8d478 (diff)
downloadNetworkManager-th/settings-flags-rh1460295.tar.gz
settings: add NMSettingsConnectionFlags flagsth/settings-flags-rh1460295
Up to now, it was not visible on D-Bus whether a connection was generated by NetworkManager and/or volatile. That is for example interesting for firewalld, which aims to store persistant configuration in NetworkManager's profile. However, that doesn't make sense for external connections (which are nm-generated & volatile). In fact, it probably makes no sense for volatile connections in general, because modifying them, likely makes them non-volatile (depending on how the profile is modified). Also, the Update2() D-Bus operation allows to carefully make connections volatile and unsaved. As we have public API to set these flags, we should also expose them on D-Bus. Related: https://bugzilla.redhat.com/show_bug.cgi?id=1460295
-rw-r--r--libnm-core/nm-dbus-interface.h16
-rw-r--r--src/settings/nm-settings-connection.h17
2 files changed, 28 insertions, 5 deletions
diff --git a/libnm-core/nm-dbus-interface.h b/libnm-core/nm-dbus-interface.h
index 28ede4985c..6c1e97fe87 100644
--- a/libnm-core/nm-dbus-interface.h
+++ b/libnm-core/nm-dbus-interface.h
@@ -888,6 +888,19 @@ typedef enum { /*< skip >*/
/**
* NMSettingsConnectionFlags:
* @NM_SETTINGS_CONNECTION_FLAG_NONE: an alias for numeric zero, no flags set.
+ * @NM_SETTINGS_CONNECTION_FLAG_UNSAVED: the connection is not saved to disk.
+ * That either means, that the connection is in-memory only and currently
+ * is not backed by a file. Or, that the connection is backed by a file,
+ * but has modifications in-memory that were not persisted to disk.
+ * @NM_SETTINGS_CONNECTION_FLAG_NM_GENERATED: A connection is "nm-generated" if
+ * it was generated by NetworkManger. If the connection gets modified or saved
+ * by the user, the flag gets cleared. A nm-generated is also unsaved
+ * and has no backing file as it is in-memory only.
+ * @NM_SETTINGS_CONNECTION_FLAG_VOLATILE: The connection will be deleted
+ * when it disconnects. That is for in-memory connections (unsaved), which are
+ * currently active but deleted on disconnect. Volatile connections are
+ * always unsaved, but they are also no backing file on disk and are entirely
+ * in-memory only.
*
* Flags describing the current activation state.
*
@@ -895,6 +908,9 @@ typedef enum { /*< skip >*/
**/
typedef enum { /*< flags >*/
NM_SETTINGS_CONNECTION_FLAG_NONE = 0,
+ NM_SETTINGS_CONNECTION_FLAG_UNSAVED = 0x01,
+ NM_SETTINGS_CONNECTION_FLAG_NM_GENERATED = 0x02,
+ NM_SETTINGS_CONNECTION_FLAG_VOLATILE = 0x04,
} NMSettingsConnectionFlags;
/**
diff --git a/src/settings/nm-settings-connection.h b/src/settings/nm-settings-connection.h
index f7ee28528d..589016996c 100644
--- a/src/settings/nm-settings-connection.h
+++ b/src/settings/nm-settings-connection.h
@@ -52,13 +52,16 @@
/**
* NMSettingsConnectionIntFlags:
* @NM_SETTINGS_CONNECTION_INT_FLAGS_NONE: no flag set
- * @NM_SETTINGS_CONNECTION_INT_FLAGS_UNSAVED: the connection is not saved to disk
+ * @NM_SETTINGS_CONNECTION_INT_FLAGS_UNSAVED: the connection is not saved to disk.
+ * See also #NM_SETTINGS_CONNECTION_FLAG_UNSAVED.
* @NM_SETTINGS_CONNECTION_INT_FLAGS_NM_GENERATED: A connection is "nm-generated" if
* it was generated by NetworkManger. If the connection gets modified or saved
* by the user, the flag gets cleared. A nm-generated is implicitly unsaved.
+ * See also #NM_SETTINGS_CONNECTION_FLAG_NM_GENERATED.
* @NM_SETTINGS_CONNECTION_INT_FLAGS_VOLATILE: The connection will be deleted
* when it disconnects. That is for in-memory connections (unsaved), which are
* currently active but cleanup on disconnect.
+ * See also #NM_SETTINGS_CONNECTION_FLAG_VOLATILE.
* @NM_SETTINGS_CONNECTION_INT_FLAGS_VISIBLE: The connection is visible
* @NM_SETTINGS_CONNECTION_INT_FLAGS_EXPORTED_MASK: the entire enum is
* internal, however, parts of it is public API as #NMSettingsConnectionFlags.
@@ -70,15 +73,19 @@
typedef enum {
NM_SETTINGS_CONNECTION_INT_FLAGS_NONE = 0,
- NM_SETTINGS_CONNECTION_INT_FLAGS_UNSAVED = (1LL << 0),
- NM_SETTINGS_CONNECTION_INT_FLAGS_NM_GENERATED = (1LL << 1),
- NM_SETTINGS_CONNECTION_INT_FLAGS_VOLATILE = (1LL << 2),
+ NM_SETTINGS_CONNECTION_INT_FLAGS_UNSAVED = NM_SETTINGS_CONNECTION_FLAG_UNSAVED,
+ NM_SETTINGS_CONNECTION_INT_FLAGS_NM_GENERATED = NM_SETTINGS_CONNECTION_FLAG_NM_GENERATED,
+ NM_SETTINGS_CONNECTION_INT_FLAGS_VOLATILE = NM_SETTINGS_CONNECTION_FLAG_VOLATILE,
NM_SETTINGS_CONNECTION_INT_FLAGS_VISIBLE = (1LL << 3),
__NM_SETTINGS_CONNECTION_INT_FLAGS_LAST,
- NM_SETTINGS_CONNECTION_INT_FLAGS_EXPORTED_MASK = 0,
+ NM_SETTINGS_CONNECTION_INT_FLAGS_EXPORTED_MASK = 0
+ | NM_SETTINGS_CONNECTION_INT_FLAGS_UNSAVED
+ | NM_SETTINGS_CONNECTION_INT_FLAGS_NM_GENERATED
+ | NM_SETTINGS_CONNECTION_INT_FLAGS_VOLATILE
+ | 0,
NM_SETTINGS_CONNECTION_INT_FLAGS_ALL = ((__NM_SETTINGS_CONNECTION_INT_FLAGS_LAST - 1) << 1) - 1,
} NMSettingsConnectionIntFlags;