libnm: mark properties that take effect immediately on active connection (REAPPLY_IMMEDIATELY)

The flag is still unused.
This commit is contained in:
Thomas Haller 2015-09-18 17:21:34 +02:00
parent b1ebbf4c80
commit c9b3617c35
5 changed files with 39 additions and 2 deletions

View file

@ -80,8 +80,20 @@
* takes into account properties marked with the %NM_SETTING_PARAM_INFERRABLE
* flag.
*/
#define NM_SETTING_COMPARE_FLAG_INFERRABLE 0x80000000
#define NM_SETTING_COMPARE_FLAG_INFERRABLE ((NMSettingCompareFlags) 0x80000000)
/* NM_SETTING_COMPARE_FLAG_IGNORE_REAPPLY_IMMEDIATELY: this flag is used for properties
* that automatically get re-applied on an active connection when the settings
* connection is modified. For most properties, the applied-connection is distinct
* from the setting-connection and changes don't propagate. Exceptions are the
* firewall-zone and the metered property.
*/
#define NM_SETTING_COMPARE_FLAG_IGNORE_REAPPLY_IMMEDIATELY ((NMSettingCompareFlags) 0x40000000)
/* NM_SETTING_COMPARE_FLAG_NONE: for convenience, define a special flag NONE -- which
* equals to numeric zero (NM_SETTING_COMPARE_FLAG_EXACT).
*/
#define NM_SETTING_COMPARE_FLAG_NONE ((NMSettingCompareFlags) 0)
#define NM_SETTING_SECRET_FLAGS_ALL \

View file

@ -1533,6 +1533,9 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class)
* (for example "Home", "Work", "Public"). %NULL or unspecified zone means
* the connection will be placed in the default zone as defined by the
* firewall.
*
* When updating this property on a currently activated connection,
* the change takes effect immediately.
**/
/* ---ifcfg-rh---
* property: zone
@ -1549,6 +1552,7 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class)
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
NM_SETTING_PARAM_FUZZY_IGNORE |
NM_SETTING_PARAM_REAPPLY_IMMEDIATELY |
G_PARAM_STATIC_STRINGS));
/**
@ -1677,6 +1681,9 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class)
*
* Whether the connection is metered.
*
* When updating this property on a currently activated connection,
* the change takes effect immediately.
*
* Since: 1.2
**/
/* ---ifcfg-rh---
@ -1693,5 +1700,6 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class)
NM_TYPE_METERED,
NM_METERED_UNKNOWN,
G_PARAM_READWRITE |
NM_SETTING_PARAM_REAPPLY_IMMEDIATELY |
G_PARAM_STATIC_STRINGS));
}

View file

@ -89,6 +89,16 @@ gboolean _nm_setting_clear_secrets_with_flags (NMSetting *setting,
/* This is a legacy property, which clients should not send to the daemon. */
#define NM_SETTING_PARAM_LEGACY (1 << (5 + G_PARAM_USER_SHIFT))
/* When a connection is active and gets modified, usually the change
* to the settings-connection does not propagate automatically to the
* applied-connection of the device. For certain properties like the
* firewall zone and the metered property, this is different.
*
* Such fields can be ignored during nm_connection_compare() with the
* NMSettingCompareFlag NM_SETTING_COMPARE_FLAG_IGNORE_REAPPLY_IMMEDIATELY.
*/
#define NM_SETTING_PARAM_REAPPLY_IMMEDIATELY (1 << (6 + G_PARAM_USER_SHIFT))
/* Ensure the setting's GType is registered at library load time */
#define NM_SETTING_REGISTER_TYPE(x) \
static void __attribute__((constructor)) register_setting (void) \

View file

@ -1107,6 +1107,10 @@ nm_setting_compare (NMSetting *a,
&& !NM_FLAGS_HAS (prop_spec->flags, NM_SETTING_PARAM_INFERRABLE))
continue;
if ( NM_FLAGS_HAS (flags, NM_SETTING_COMPARE_FLAG_IGNORE_REAPPLY_IMMEDIATELY)
&& NM_FLAGS_HAS (prop_spec->flags, NM_SETTING_PARAM_REAPPLY_IMMEDIATELY))
continue;
if ( NM_FLAGS_HAS (flags, NM_SETTING_COMPARE_FLAG_IGNORE_SECRETS)
&& NM_FLAGS_HAS (prop_spec->flags, NM_SETTING_PARAM_SECRET))
continue;
@ -1132,6 +1136,9 @@ should_compare_prop (NMSetting *setting,
if ((comp_flags & NM_SETTING_COMPARE_FLAG_INFERRABLE) && !(prop_flags & NM_SETTING_PARAM_INFERRABLE))
return FALSE;
if ((comp_flags & NM_SETTING_COMPARE_FLAG_IGNORE_REAPPLY_IMMEDIATELY) && !(prop_flags & NM_SETTING_PARAM_REAPPLY_IMMEDIATELY))
return FALSE;
if (prop_flags & NM_SETTING_PARAM_SECRET) {
NMSettingSecretFlags secret_flags = NM_SETTING_SECRET_FLAG_NONE;

View file

@ -127,7 +127,7 @@ typedef enum {
NM_SETTING_COMPARE_FLAG_DIFF_RESULT_NO_DEFAULT = 0x00000040,
NM_SETTING_COMPARE_FLAG_IGNORE_TIMESTAMP = 0x00000080,
/* 0x80000000 is used for a private flag */
/* Higher flags like 0x80000000 and 0x40000000 are used internally as private flags */
} NMSettingCompareFlags;