diff options
author | Thomas Haller <thaller@redhat.com> | 2018-04-05 21:07:34 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-04-16 15:30:07 +0200 |
commit | aae483c0a95813ceccfb466f7e5dfbc894af6b20 (patch) | |
tree | d533f262a7aa7a8f709303900d1903f50fe550f2 | |
parent | acc8244ca2dce5f977f2a2552f598c79169ff909 (diff) | |
download | NetworkManager-aae483c0a95813ceccfb466f7e5dfbc894af6b20.tar.gz |
settings: add NMSettingsConnectionFlags flags
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.h | 16 | ||||
-rw-r--r-- | src/settings/nm-settings-connection.h | 17 |
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; |