mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-06 16:20:34 +01:00
config: make ignore-carrier option reloadable
Only move the ignore-carrier option from NMConfig to NMConfigData. The ignore-carrier option is still immutable after startup. https://bugzilla.gnome.org/show_bug.cgi?id=748050
This commit is contained in:
parent
4d4f5fff5c
commit
2d333a1769
5 changed files with 19 additions and 17 deletions
|
|
@ -8593,7 +8593,7 @@ constructed (GObject *object)
|
|||
|
||||
/* Have to call update_initial_hw_address() before calling get_ignore_carrier() */
|
||||
if (nm_device_has_capability (self, NM_DEVICE_CAP_CARRIER_DETECT)) {
|
||||
priv->ignore_carrier = nm_config_get_ignore_carrier (nm_config_get (), self);
|
||||
priv->ignore_carrier = nm_config_data_get_ignore_carrier (nm_config_get_data_orig (nm_config_get ()), self);
|
||||
|
||||
check_carrier (self);
|
||||
_LOGD (LOGD_HW,
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "nm-config.h"
|
||||
#include "gsystem-local-alloc.h"
|
||||
#include "nm-device.h"
|
||||
|
||||
typedef struct {
|
||||
char *config_main_file;
|
||||
|
|
@ -43,6 +44,8 @@ typedef struct {
|
|||
GSList *specs;
|
||||
} no_auto_default;
|
||||
|
||||
GSList *ignore_carrier;
|
||||
|
||||
char *dns_mode;
|
||||
char *rc_manager;
|
||||
} NMConfigDataPrivate;
|
||||
|
|
@ -147,6 +150,15 @@ nm_config_data_get_rc_manager (const NMConfigData *self)
|
|||
return NM_CONFIG_DATA_GET_PRIVATE (self)->rc_manager;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_config_data_get_ignore_carrier (const NMConfigData *self, NMDevice *device)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_CONFIG_DATA (self), FALSE);
|
||||
g_return_val_if_fail (NM_IS_DEVICE (device), FALSE);
|
||||
|
||||
return nm_device_spec_match_list (device, NM_CONFIG_DATA_GET_PRIVATE (self)->ignore_carrier);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
static gboolean
|
||||
|
|
@ -314,6 +326,8 @@ finalize (GObject *gobject)
|
|||
g_free (priv->dns_mode);
|
||||
g_free (priv->rc_manager);
|
||||
|
||||
g_slist_free_full (priv->ignore_carrier, g_free);
|
||||
|
||||
g_key_file_unref (priv->keyfile);
|
||||
|
||||
G_OBJECT_CLASS (nm_config_data_parent_class)->finalize (gobject);
|
||||
|
|
@ -340,6 +354,8 @@ constructed (GObject *object)
|
|||
priv->dns_mode = g_key_file_get_value (priv->keyfile, "main", "dns", NULL);
|
||||
priv->rc_manager = g_key_file_get_value (priv->keyfile, "main", "rc-manager", NULL);
|
||||
|
||||
priv->ignore_carrier = nm_config_get_device_match_spec (priv->keyfile, "main", "ignore-carrier");
|
||||
|
||||
G_OBJECT_CLASS (nm_config_data_parent_class)->constructed (object);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -91,6 +91,8 @@ const GSList * nm_config_data_get_no_auto_default_list (const NMConfigData *c
|
|||
const char *nm_config_data_get_dns_mode (const NMConfigData *self);
|
||||
const char *nm_config_data_get_rc_manager (const NMConfigData *self);
|
||||
|
||||
gboolean nm_config_data_get_ignore_carrier (const NMConfigData *self, NMDevice *device);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* NM_CONFIG_DATA_H */
|
||||
|
|
|
|||
|
|
@ -76,8 +76,6 @@ typedef struct {
|
|||
|
||||
char *debug;
|
||||
|
||||
GSList *ignore_carrier;
|
||||
|
||||
gboolean configure_and_quit;
|
||||
} NMConfigPrivate;
|
||||
|
||||
|
|
@ -226,15 +224,6 @@ nm_config_get_configure_and_quit (NMConfig *config)
|
|||
return NM_CONFIG_GET_PRIVATE (config)->configure_and_quit;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_config_get_ignore_carrier (NMConfig *config, NMDevice *device)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_CONFIG (config), FALSE);
|
||||
g_return_val_if_fail (NM_IS_DEVICE (device), FALSE);
|
||||
|
||||
return nm_device_spec_match_list (device, NM_CONFIG_GET_PRIVATE (config)->ignore_carrier);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
static char **
|
||||
|
|
@ -860,8 +849,6 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
|
|||
|
||||
priv->debug = g_key_file_get_value (keyfile, "main", "debug", NULL);
|
||||
|
||||
priv->ignore_carrier = nm_config_get_device_match_spec (keyfile, "main", "ignore-carrier");
|
||||
|
||||
priv->configure_and_quit = _get_bool_value (keyfile, "main", "configure-and-quit", FALSE);
|
||||
|
||||
no_auto_default_orig_list = nm_config_get_device_match_spec (keyfile, "main", "no-auto-default");
|
||||
|
|
@ -915,7 +902,6 @@ finalize (GObject *gobject)
|
|||
g_free (priv->log_level);
|
||||
g_free (priv->log_domains);
|
||||
g_free (priv->debug);
|
||||
g_slist_free_full (priv->ignore_carrier, g_free);
|
||||
|
||||
_nm_config_cmd_line_options_clear (&priv->cli);
|
||||
|
||||
|
|
|
|||
|
|
@ -73,8 +73,6 @@ const char *nm_config_get_log_domains (NMConfig *config);
|
|||
const char *nm_config_get_debug (NMConfig *config);
|
||||
gboolean nm_config_get_configure_and_quit (NMConfig *config);
|
||||
|
||||
gboolean nm_config_get_ignore_carrier (NMConfig *config, NMDevice *device);
|
||||
|
||||
/* for main.c only */
|
||||
NMConfigCmdLineOptions *nm_config_cmd_line_options_new (void);
|
||||
void nm_config_cmd_line_options_free (NMConfigCmdLineOptions *cli);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue