config: add macros NM_CONFIG_GET_DATA and NM_CONFIG_GET_DATA_ORIG
This commit is contained in:
@@ -805,7 +805,7 @@ _get_ipx_route_metric (NMDevice *self,
|
||||
/* use the current NMConfigData, which makes this configuration reloadable.
|
||||
* Note that that means that the route-metric might change between SIGHUP.
|
||||
* You must cache the returned value if that is a problem. */
|
||||
value = nm_config_data_get_connection_default (nm_config_get_data (nm_config_get ()),
|
||||
value = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
|
||||
is_v4 ? "ipv4.route-metric" : "ipv6.route-metric", self);
|
||||
if (value) {
|
||||
route_metric = _nm_utils_ascii_str_to_int64 (value, 10, 0, G_MAXUINT32, -1);
|
||||
@@ -2329,7 +2329,7 @@ nm_device_generate_connection (NMDevice *self, NMDevice *master)
|
||||
&& g_strcmp0 (ip6_method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL) == 0
|
||||
&& !nm_setting_connection_get_master (NM_SETTING_CONNECTION (s_con))
|
||||
&& !priv->slaves
|
||||
&& !nm_config_data_get_assume_ipv6ll_only (nm_config_get_data (nm_config_get ()), self)) {
|
||||
&& !nm_config_data_get_assume_ipv6ll_only (NM_CONFIG_GET_DATA, self)) {
|
||||
_LOGD (LOGD_DEVICE, "ignoring generated connection (IPv6LL-only and not in master-slave relationship)");
|
||||
g_object_unref (connection);
|
||||
connection = NULL;
|
||||
@@ -4902,7 +4902,7 @@ _ip6_privacy_get (NMDevice *self)
|
||||
}
|
||||
}
|
||||
|
||||
value = nm_config_data_get_connection_default (nm_config_get_data (nm_config_get ()),
|
||||
value = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
|
||||
"ipv6.ip6-privacy", self);
|
||||
|
||||
/* 2.) use the default value from the configuration. */
|
||||
@@ -8454,7 +8454,7 @@ _set_state_full (NMDevice *self,
|
||||
if (nm_device_has_capability (self, NM_DEVICE_CAP_CARRIER_DETECT)) {
|
||||
/* We cache the ignore_carrier state to not react on config-reloads while the connection
|
||||
* is active. But on deactivating, reset the ignore-carrier flag to the current state. */
|
||||
priv->ignore_carrier = nm_config_data_get_ignore_carrier (nm_config_get_data (nm_config_get ()), self);
|
||||
priv->ignore_carrier = nm_config_data_get_ignore_carrier (NM_CONFIG_GET_DATA, self);
|
||||
}
|
||||
|
||||
if (quitting) {
|
||||
|
@@ -69,6 +69,10 @@ char *nm_config_change_flags_to_string (NMConfigChangeFlags flags);
|
||||
|
||||
NMConfigData *nm_config_get_data (NMConfig *config);
|
||||
NMConfigData *nm_config_get_data_orig (NMConfig *config);
|
||||
|
||||
#define NM_CONFIG_GET_DATA (nm_config_get_data (nm_config_get ()))
|
||||
#define NM_CONFIG_GET_DATA_ORIG (nm_config_get_data_orig (nm_config_get ()))
|
||||
|
||||
const char **nm_config_get_plugins (NMConfig *config);
|
||||
gboolean nm_config_get_monitor_connection_files (NMConfig *config);
|
||||
gboolean nm_config_get_auth_polkit (NMConfig *config);
|
||||
|
@@ -2472,7 +2472,7 @@ should_connect_slaves (NMConnection *connection, NMDevice *device)
|
||||
goto out;
|
||||
|
||||
/* Check configuration default for autoconnect-slaves property */
|
||||
value = nm_config_data_get_connection_default (nm_config_get_data (nm_config_get ()),
|
||||
value = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
|
||||
"connection.autoconnect-slaves", device);
|
||||
if (value)
|
||||
autoconnect_slaves = _nm_utils_ascii_str_to_int64 (value, 10, 0, 1, -1);
|
||||
|
@@ -84,7 +84,7 @@ is_managed_plugin (void)
|
||||
{
|
||||
char *result = NULL;
|
||||
|
||||
result = nm_config_data_get_value (nm_config_get_data_orig (nm_config_get ()),
|
||||
result = nm_config_data_get_value (NM_CONFIG_GET_DATA_ORIG,
|
||||
IFNET_KEY_FILE_GROUP, IFNET_KEY_FILE_KEY_MANAGED);
|
||||
if (result) {
|
||||
gboolean ret = is_true (result);
|
||||
@@ -217,7 +217,7 @@ reload_connections (NMSystemConfigInterface *config)
|
||||
|
||||
nm_log_info (LOGD_SETTINGS, "Loading connections");
|
||||
|
||||
str_auto_refresh = nm_config_data_get_value (nm_config_get_data_orig (nm_config_get ()),
|
||||
str_auto_refresh = nm_config_data_get_value (NM_CONFIG_GET_DATA_ORIG,
|
||||
IFNET_KEY_FILE_GROUP, "auto_refresh");
|
||||
if (str_auto_refresh && is_true (str_auto_refresh))
|
||||
auto_refresh = TRUE;
|
||||
|
@@ -419,7 +419,7 @@ SCPluginIfupdown_init (NMSystemConfigInterface *config)
|
||||
g_hash_table_destroy (auto_ifaces);
|
||||
|
||||
/* Check the config file to find out whether to manage interfaces */
|
||||
value = nm_config_data_get_value (nm_config_get_data_orig (nm_config_get ()),
|
||||
value = nm_config_data_get_value (NM_CONFIG_GET_DATA_ORIG,
|
||||
IFUPDOWN_KEY_FILE_GROUP, IFUPDOWN_KEY_FILE_KEY_MANAGED);
|
||||
if (value) {
|
||||
gboolean manage_well_known;
|
||||
|
Reference in New Issue
Block a user