mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-26 19:20:12 +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
(cherry picked from commit 2d333a1769)
This commit is contained in:
parent
00ee848db8
commit
8acd78d1fa
5 changed files with 19 additions and 17 deletions
|
|
@ -8382,7 +8382,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,
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "nm-config.h"
|
||||
#include "nm-device.h"
|
||||
#include "gsystem-local-alloc.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
|
||||
|
|
@ -44,6 +45,8 @@ typedef struct {
|
|||
GSList *specs;
|
||||
} no_auto_default;
|
||||
|
||||
GSList *ignore_carrier;
|
||||
|
||||
char *dns_mode;
|
||||
} NMConfigDataPrivate;
|
||||
|
||||
|
|
@ -139,6 +142,15 @@ nm_config_data_get_dns_mode (const NMConfigData *self)
|
|||
return NM_CONFIG_DATA_GET_PRIVATE (self)->dns_mode;
|
||||
}
|
||||
|
||||
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
|
||||
|
|
@ -302,6 +314,8 @@ finalize (GObject *gobject)
|
|||
|
||||
g_free (priv->dns_mode);
|
||||
|
||||
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);
|
||||
|
|
@ -332,6 +346,8 @@ constructed (GObject *object)
|
|||
|
||||
priv->dns_mode = g_key_file_get_value (priv->keyfile, "main", "dns", 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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -89,6 +89,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);
|
||||
|
||||
gboolean nm_config_data_get_ignore_carrier (const NMConfigData *self, NMDevice *device);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* NM_CONFIG_DATA_H */
|
||||
|
|
|
|||
|
|
@ -75,8 +75,6 @@ typedef struct {
|
|||
|
||||
char *debug;
|
||||
|
||||
GSList *ignore_carrier;
|
||||
|
||||
gboolean configure_and_quit;
|
||||
} NMConfigPrivate;
|
||||
|
||||
|
|
@ -225,15 +223,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 **
|
||||
|
|
@ -850,8 +839,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");
|
||||
|
|
@ -905,7 +892,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);
|
||||
|
||||
|
|
|
|||
|
|
@ -75,8 +75,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