settings: add NM_SETTINGS_UPDATE2_FLAG_BLOCK_AUTOCONNECT flag

This commit is contained in:
Thomas Haller
2017-11-30 12:43:05 +01:00
parent 98ff1e291c
commit 8bb95a8365
3 changed files with 15 additions and 2 deletions

View File

@@ -107,7 +107,8 @@
Provide an empty array, to use the current settings.
@flags: optional flags argument. Currently supported flags are:
"0x1" (to-disk),
"0x2" (in-memory).
"0x2" (in-memory),
"0x20" (block-autoconnect).
Unknown flags cause the call to fail.
@args: optional arguments dictionary, for extensibility. Currently no
arguments are accepted. Specifying unknown keys causes the call

View File

@@ -901,6 +901,10 @@ typedef enum { /*< flags >*/
* @NM_SETTINGS_UPDATE2_FLAG_NONE: an alias for numeric zero, no flags set.
* @NM_SETTINGS_UPDATE2_FLAG_TO_DISK: to persist the connection to disk.
* @NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY: to make the connection in-memory only.
* @NM_SETTINGS_UPDATE2_FLAG_BLOCK_AUTOCONNECT: usually, when the connection
* has autoconnect enabled and is modified, it becomes elegible to autoconnect
* right away. Setting this flag, disables autoconnect until the connection
* is manually activated.
*
* Since: 1.12
*/
@@ -908,6 +912,7 @@ typedef enum { /*< flags >*/
NM_SETTINGS_UPDATE2_FLAG_NONE = 0,
NM_SETTINGS_UPDATE2_FLAG_TO_DISK = (1LL << 0),
NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY = (1LL << 1),
NM_SETTINGS_UPDATE2_FLAG_BLOCK_AUTOCONNECT = (1LL << 5),
} NMSettingsUpdate2Flags;
#endif /* __NM_DBUS_INTERFACE_H__ */

View File

@@ -1742,6 +1742,12 @@ update_auth_cb (NMSettingsConnection *self,
else
log_diff_name = info->new_settings ? "update-settings" : "write-out-to-disk";
if (NM_FLAGS_HAS (info->flags, NM_SETTINGS_UPDATE2_FLAG_BLOCK_AUTOCONNECT)) {
nm_settings_connection_autoconnect_blocked_reason_set (self,
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_USER_REQUEST,
TRUE);
}
_update (self,
info->new_settings,
persist_mode,
@@ -1915,7 +1921,8 @@ impl_settings_connection_update2 (NMSettingsConnection *self,
const NMSettingsUpdate2Flags flags = (NMSettingsUpdate2Flags) flags_u;
if (NM_FLAGS_ANY (flags_u, ~((guint32) (NM_SETTINGS_UPDATE2_FLAG_TO_DISK |
NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY)))) {
NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY |
NM_SETTINGS_UPDATE2_FLAG_BLOCK_AUTOCONNECT)))) {
error = g_error_new_literal (NM_SETTINGS_ERROR,
NM_SETTINGS_ERROR_INVALID_ARGUMENTS,
"Unknown flags");