mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-01 13:55:36 +00:00
settings: drop deprecated NetworkManager.conf option "main.monitor-connection-files"
It's deprecated and off by default for a long time. It is bad to automatically reload connection profiles. For example, ifcfg files may consist of multiple files, there is no guarantee that we pick up the connection when it's fully written. Just don't do this anymore. Users should use D-Bus API or `nmcli connection reload` or `nmcli connection load $FILENAME` to reload profiles from disk.
This commit is contained in:
parent
48b3a3e311
commit
1ae5e6465f
4
NEWS
4
NEWS
|
@ -16,6 +16,10 @@ USE AT YOUR OWN RISK. NOT RECOMMENDED FOR PRODUCTION USE!
|
|||
configuration file.
|
||||
* Added support for configuring fq_codel line discipline and mirred action.
|
||||
* Added a possibility for distributions to ship dispatcher scripts in /usr/lib.
|
||||
* Drop deprecated setting "main.monitor-connection-files" in NetworkManager.conf.
|
||||
This setting has no more effect and was disabled by default for a long time.
|
||||
Instead, after changes load files explicitly with `nmcli connection load` and
|
||||
`nmcli connection reload`.
|
||||
|
||||
=============================================
|
||||
NetworkManager-1.18
|
||||
|
|
|
@ -153,29 +153,7 @@ plugins-=remove-me
|
|||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>monitor-connection-files</varname></term>
|
||||
<listitem><para>Whether the configured settings plugin(s)
|
||||
should set up file monitors and immediately pick up changes
|
||||
made to connection files while NetworkManager is running. This
|
||||
is disabled by default; NetworkManager will only read
|
||||
the connection files at startup, and when explicitly requested
|
||||
via the ReloadConnections D-Bus call. If this key is set to
|
||||
'<literal>true</literal>', then NetworkManager will reload
|
||||
connection files any time they changed.
|
||||
Automatic reloading is not advised because there are race conditions
|
||||
involved and it depends on the way how the editor updates the file.
|
||||
In some situations, NetworkManager might first delete and add the
|
||||
connection anew, instead of updating the existing one. Also, NetworkManager
|
||||
might pick up incomplete settings while the user is still editing the files.
|
||||
</para><para>
|
||||
Note that neither this setting nor restarting the NetworkManager daemon
|
||||
is the advised way to reload connection profiles from disk. Instead, after
|
||||
modifying the files reload them with <command>nmcli connection reload</command>
|
||||
or <command>nmcli connection load "$FILENAME"</command>. Even better,
|
||||
instead of modifying files directly, use NetworkManager tools like
|
||||
<command>nmcli</command>, <command>nmtui</command> or the GUI.
|
||||
</para><para>
|
||||
This setting is deprecated and will have no effect in the future.
|
||||
</para></listitem>
|
||||
<listitem><para>This setting is deprecated and has no effect.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>auth-polkit</varname></term>
|
||||
|
|
|
@ -100,8 +100,6 @@ typedef struct {
|
|||
char *no_auto_default_file;
|
||||
char *intern_config_file;
|
||||
|
||||
gboolean monitor_connection_files;
|
||||
|
||||
char *log_level;
|
||||
char *log_domains;
|
||||
|
||||
|
@ -313,14 +311,6 @@ nm_config_get_data_orig (NMConfig *config)
|
|||
return NM_CONFIG_GET_PRIVATE (config)->config_data_orig;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_config_get_monitor_connection_files (NMConfig *config)
|
||||
{
|
||||
g_return_val_if_fail (config != NULL, FALSE);
|
||||
|
||||
return NM_CONFIG_GET_PRIVATE (config)->monitor_connection_files;
|
||||
}
|
||||
|
||||
const char *
|
||||
nm_config_get_log_level (NMConfig *config)
|
||||
{
|
||||
|
@ -2804,10 +2794,6 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
|
|||
else
|
||||
priv->no_auto_default_file = g_strdup (DEFAULT_NO_AUTO_DEFAULT_FILE);
|
||||
|
||||
priv->monitor_connection_files = nm_config_keyfile_get_boolean (keyfile,
|
||||
NM_CONFIG_KEYFILE_GROUP_MAIN,
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_MONITOR_CONNECTION_FILES,
|
||||
FALSE);
|
||||
priv->log_level = nm_strstrip (g_key_file_get_string (keyfile,
|
||||
NM_CONFIG_KEYFILE_GROUP_LOGGING,
|
||||
NM_CONFIG_KEYFILE_KEY_LOGGING_LEVEL,
|
||||
|
|
|
@ -157,7 +157,6 @@ 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 ()))
|
||||
|
||||
gboolean nm_config_get_monitor_connection_files (NMConfig *config);
|
||||
const char *nm_config_get_log_level (NMConfig *config);
|
||||
const char *nm_config_get_log_domains (NMConfig *config);
|
||||
NMConfigConfigureAndQuitType nm_config_get_configure_and_quit (NMConfig *config);
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
#include "nms-ifcfg-rh-reader.h"
|
||||
#include "nms-ifcfg-rh-writer.h"
|
||||
#include "nms-ifcfg-rh-utils.h"
|
||||
#include "nm-inotify-helper.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
@ -50,34 +49,12 @@ NM_GOBJECT_PROPERTIES_DEFINE_BASE (
|
|||
PROP_UNRECOGNIZED_SPEC,
|
||||
);
|
||||
|
||||
enum {
|
||||
IFCFG_CHANGED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
typedef struct {
|
||||
gulong ih_event_id;
|
||||
|
||||
int file_wd;
|
||||
|
||||
char *keyfile;
|
||||
int keyfile_wd;
|
||||
|
||||
char *routefile;
|
||||
int routefile_wd;
|
||||
|
||||
char *route6file;
|
||||
int route6file_wd;
|
||||
|
||||
char *unmanaged_spec;
|
||||
char *unrecognized_spec;
|
||||
|
||||
gulong devtimeout_link_changed_handler;
|
||||
guint devtimeout_timeout_id;
|
||||
|
||||
NMInotifyHelper *inotify_helper;
|
||||
} NMIfcfgConnectionPrivate;
|
||||
|
||||
struct _NMIfcfgConnection {
|
||||
|
@ -193,76 +170,6 @@ nm_ifcfg_connection_check_devtimeout (NMIfcfgConnection *self)
|
|||
priv->devtimeout_timeout_id = g_timeout_add_seconds (devtimeout, devtimeout_expired, self);
|
||||
}
|
||||
|
||||
static void
|
||||
files_changed_cb (NMInotifyHelper *ih,
|
||||
struct inotify_event *evt,
|
||||
const char *path,
|
||||
gpointer user_data)
|
||||
{
|
||||
NMIfcfgConnection *self = NM_IFCFG_CONNECTION (user_data);
|
||||
NMIfcfgConnectionPrivate *priv = NM_IFCFG_CONNECTION_GET_PRIVATE (self);
|
||||
|
||||
if ( (evt->wd != priv->file_wd)
|
||||
&& (evt->wd != priv->keyfile_wd)
|
||||
&& (evt->wd != priv->routefile_wd)
|
||||
&& (evt->wd != priv->route6file_wd))
|
||||
return;
|
||||
|
||||
/* push the event up to the plugin */
|
||||
g_signal_emit (self, signals[IFCFG_CHANGED], 0);
|
||||
}
|
||||
|
||||
static void
|
||||
path_watch_stop (NMIfcfgConnection *self)
|
||||
{
|
||||
NMIfcfgConnectionPrivate *priv = NM_IFCFG_CONNECTION_GET_PRIVATE (self);
|
||||
|
||||
nm_clear_g_signal_handler (priv->inotify_helper, &priv->ih_event_id);
|
||||
|
||||
nm_inotify_helper_clear_watch (priv->inotify_helper, &priv->file_wd);
|
||||
nm_inotify_helper_clear_watch (priv->inotify_helper, &priv->keyfile_wd);
|
||||
nm_inotify_helper_clear_watch (priv->inotify_helper, &priv->routefile_wd);
|
||||
nm_inotify_helper_clear_watch (priv->inotify_helper, &priv->route6file_wd);
|
||||
|
||||
nm_clear_g_free (&priv->keyfile);
|
||||
nm_clear_g_free (&priv->routefile);
|
||||
nm_clear_g_free (&priv->route6file);
|
||||
}
|
||||
|
||||
static void
|
||||
filename_changed (GObject *object,
|
||||
GParamSpec *pspec,
|
||||
gpointer user_data)
|
||||
{
|
||||
NMIfcfgConnection *self = NM_IFCFG_CONNECTION (object);
|
||||
NMIfcfgConnectionPrivate *priv = NM_IFCFG_CONNECTION_GET_PRIVATE (self);
|
||||
const char *ifcfg_path;
|
||||
|
||||
path_watch_stop (self);
|
||||
|
||||
ifcfg_path = nm_settings_connection_get_filename (NM_SETTINGS_CONNECTION (self));
|
||||
if (!ifcfg_path)
|
||||
return;
|
||||
|
||||
priv->keyfile = utils_get_keys_path (ifcfg_path);
|
||||
priv->routefile = utils_get_route_path (ifcfg_path);
|
||||
priv->route6file = utils_get_route6_path (ifcfg_path);
|
||||
|
||||
if (nm_config_get_monitor_connection_files (nm_config_get ())) {
|
||||
NMInotifyHelper *ih;
|
||||
|
||||
if (!priv->inotify_helper)
|
||||
priv->inotify_helper = g_object_ref (nm_inotify_helper_get ());
|
||||
ih = priv->inotify_helper;
|
||||
|
||||
priv->ih_event_id = g_signal_connect (ih, "event", G_CALLBACK (files_changed_cb), self);
|
||||
priv->file_wd = nm_inotify_helper_add_watch (ih, ifcfg_path);
|
||||
priv->keyfile_wd = nm_inotify_helper_add_watch (ih, priv->keyfile);
|
||||
priv->routefile_wd = nm_inotify_helper_add_watch (ih, priv->routefile);
|
||||
priv->route6file_wd = nm_inotify_helper_add_watch (ih, priv->route6file);
|
||||
}
|
||||
}
|
||||
|
||||
const char *
|
||||
nm_ifcfg_connection_get_unmanaged_spec (NMIfcfgConnection *self)
|
||||
{
|
||||
|
@ -326,18 +233,21 @@ static gboolean
|
|||
delete (NMSettingsConnection *connection,
|
||||
GError **error)
|
||||
{
|
||||
NMIfcfgConnectionPrivate *priv = NM_IFCFG_CONNECTION_GET_PRIVATE ((NMIfcfgConnection *) connection);
|
||||
const char *filename;
|
||||
|
||||
filename = nm_settings_connection_get_filename (connection);
|
||||
if (filename) {
|
||||
gs_free char *keyfile = utils_get_keys_path (filename);
|
||||
gs_free char *routefile = utils_get_route_path (filename);
|
||||
gs_free char *route6file = utils_get_route6_path (filename);
|
||||
|
||||
g_unlink (filename);
|
||||
if (priv->keyfile)
|
||||
g_unlink (priv->keyfile);
|
||||
if (priv->routefile)
|
||||
g_unlink (priv->routefile);
|
||||
if (priv->route6file)
|
||||
g_unlink (priv->route6file);
|
||||
if (keyfile)
|
||||
g_unlink (keyfile);
|
||||
if (routefile)
|
||||
g_unlink (routefile);
|
||||
if (route6file)
|
||||
g_unlink (route6file);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -386,17 +296,8 @@ set_property (GObject *object, guint prop_id,
|
|||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
nm_ifcfg_connection_init (NMIfcfgConnection *connection)
|
||||
nm_ifcfg_connection_init (NMIfcfgConnection *self)
|
||||
{
|
||||
NMIfcfgConnectionPrivate *priv = NM_IFCFG_CONNECTION_GET_PRIVATE (connection);
|
||||
|
||||
priv->file_wd = -1;
|
||||
priv->keyfile_wd = -1;
|
||||
priv->routefile_wd = -1;
|
||||
priv->route6file_wd = -1;
|
||||
|
||||
g_signal_connect (connection, "notify::" NM_SETTINGS_CONNECTION_FILENAME,
|
||||
G_CALLBACK (filename_changed), NULL);
|
||||
}
|
||||
|
||||
NMIfcfgConnection *
|
||||
|
@ -460,13 +361,9 @@ dispose (GObject *object)
|
|||
{
|
||||
NMIfcfgConnectionPrivate *priv = NM_IFCFG_CONNECTION_GET_PRIVATE ((NMIfcfgConnection *) object);
|
||||
|
||||
path_watch_stop (NM_IFCFG_CONNECTION (object));
|
||||
|
||||
nm_clear_g_signal_handler (NM_PLATFORM_GET, &priv->devtimeout_link_changed_handler);
|
||||
nm_clear_g_source (&priv->devtimeout_timeout_id);
|
||||
|
||||
g_clear_object (&priv->inotify_helper);
|
||||
|
||||
g_clear_pointer (&priv->unmanaged_spec, g_free);
|
||||
g_clear_pointer (&priv->unrecognized_spec, g_free);
|
||||
|
||||
|
@ -499,13 +396,4 @@ nm_ifcfg_connection_class_init (NMIfcfgConnectionClass *ifcfg_connection_class)
|
|||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
signals[IFCFG_CHANGED] =
|
||||
g_signal_new ("ifcfg-changed",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -61,10 +61,8 @@ typedef struct {
|
|||
} dbus;
|
||||
|
||||
GHashTable *connections; /* uuid::connection */
|
||||
gboolean initialized;
|
||||
|
||||
GFileMonitor *ifcfg_monitor;
|
||||
gulong ifcfg_monitor_id;
|
||||
bool initialized:1;
|
||||
} SettingsPluginIfcfgPrivate;
|
||||
|
||||
struct _SettingsPluginIfcfg {
|
||||
|
@ -109,26 +107,6 @@ static NMIfcfgConnection *update_connection (SettingsPluginIfcfg *plugin,
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
connection_ifcfg_changed (NMIfcfgConnection *connection, gpointer user_data)
|
||||
{
|
||||
SettingsPluginIfcfg *self = SETTINGS_PLUGIN_IFCFG (user_data);
|
||||
SettingsPluginIfcfgPrivate *priv = SETTINGS_PLUGIN_IFCFG_GET_PRIVATE (self);
|
||||
const char *path;
|
||||
|
||||
path = nm_settings_connection_get_filename (NM_SETTINGS_CONNECTION (connection));
|
||||
g_return_if_fail (path != NULL);
|
||||
|
||||
if (!priv->ifcfg_monitor) {
|
||||
_LOGD ("connection_ifcfg_changed("NM_IFCFG_CONNECTION_LOG_FMTD"): %s", NM_IFCFG_CONNECTION_LOG_ARGD (connection), "ignore event");
|
||||
return;
|
||||
}
|
||||
|
||||
_LOGD ("connection_ifcfg_changed("NM_IFCFG_CONNECTION_LOG_FMTD"): %s", NM_IFCFG_CONNECTION_LOG_ARGD (connection), "reload");
|
||||
|
||||
update_connection (self, NULL, path, connection, TRUE, NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
connection_removed_cb (NMSettingsConnection *obj, gpointer user_data)
|
||||
{
|
||||
|
@ -386,10 +364,6 @@ update_connection (SettingsPluginIfcfg *self,
|
|||
} else if (nm_ifcfg_connection_get_unrecognized_spec (connection_new))
|
||||
_LOGW ("Ignoring connection "NM_IFCFG_CONNECTION_LOG_FMT" of unrecognized type.", NM_IFCFG_CONNECTION_LOG_ARG (connection_new));
|
||||
|
||||
/* watch changes of ifcfg hardlinks */
|
||||
g_signal_connect (G_OBJECT (connection_new), "ifcfg-changed",
|
||||
G_CALLBACK (connection_ifcfg_changed), self);
|
||||
|
||||
if (!source) {
|
||||
/* Only raise the signal if we were called without source, i.e. if we read the connection from file.
|
||||
* Otherwise, we were called by add_connection() which does not expect the signal. */
|
||||
|
@ -406,59 +380,6 @@ update_connection (SettingsPluginIfcfg *self,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ifcfg_dir_changed (GFileMonitor *monitor,
|
||||
GFile *file,
|
||||
GFile *other_file,
|
||||
GFileMonitorEvent event_type,
|
||||
gpointer user_data)
|
||||
{
|
||||
SettingsPluginIfcfg *plugin = SETTINGS_PLUGIN_IFCFG (user_data);
|
||||
char *path, *ifcfg_path;
|
||||
NMIfcfgConnection *connection;
|
||||
|
||||
path = g_file_get_path (file);
|
||||
|
||||
ifcfg_path = utils_detect_ifcfg_path (path, FALSE);
|
||||
_LOGD ("ifcfg_dir_changed(%s) = %d // %s", path, event_type, ifcfg_path ?: "(none)");
|
||||
if (ifcfg_path) {
|
||||
connection = find_by_path (plugin, ifcfg_path);
|
||||
switch (event_type) {
|
||||
case G_FILE_MONITOR_EVENT_DELETED:
|
||||
if (connection)
|
||||
remove_connection (plugin, connection);
|
||||
break;
|
||||
case G_FILE_MONITOR_EVENT_CREATED:
|
||||
case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
|
||||
/* Update or new */
|
||||
update_connection (plugin, NULL, ifcfg_path, connection, TRUE, NULL, NULL);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
g_free (ifcfg_path);
|
||||
}
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
static void
|
||||
setup_ifcfg_monitoring (SettingsPluginIfcfg *plugin)
|
||||
{
|
||||
SettingsPluginIfcfgPrivate *priv = SETTINGS_PLUGIN_IFCFG_GET_PRIVATE (plugin);
|
||||
GFile *file;
|
||||
GFileMonitor *monitor;
|
||||
|
||||
file = g_file_new_for_path (IFCFG_DIR "/");
|
||||
monitor = g_file_monitor_directory (file, G_FILE_MONITOR_NONE, NULL, NULL);
|
||||
g_object_unref (file);
|
||||
|
||||
if (monitor) {
|
||||
priv->ifcfg_monitor_id = g_signal_connect (monitor, "changed",
|
||||
G_CALLBACK (ifcfg_dir_changed), plugin);
|
||||
priv->ifcfg_monitor = monitor;
|
||||
}
|
||||
}
|
||||
|
||||
static GHashTable *
|
||||
_paths_from_connections (GHashTable *connections)
|
||||
{
|
||||
|
@ -578,8 +499,6 @@ get_connections (NMSettingsPlugin *config)
|
|||
NMIfcfgConnection *connection;
|
||||
|
||||
if (!priv->initialized) {
|
||||
if (nm_config_get_monitor_connection_files (nm_config_get ()))
|
||||
setup_ifcfg_monitoring (plugin);
|
||||
read_connections (plugin);
|
||||
priv->initialized = TRUE;
|
||||
}
|
||||
|
@ -1041,14 +960,6 @@ dispose (GObject *object)
|
|||
priv->connections = NULL;
|
||||
}
|
||||
|
||||
if (priv->ifcfg_monitor) {
|
||||
if (priv->ifcfg_monitor_id)
|
||||
g_signal_handler_disconnect (priv->ifcfg_monitor, priv->ifcfg_monitor_id);
|
||||
|
||||
g_file_monitor_cancel (priv->ifcfg_monitor);
|
||||
g_object_unref (priv->ifcfg_monitor);
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (settings_plugin_ifcfg_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,8 +48,6 @@ typedef struct {
|
|||
GHashTable *connections; /* uuid::connection */
|
||||
|
||||
gboolean initialized;
|
||||
GFileMonitor *monitor;
|
||||
gulong monitor_id;
|
||||
|
||||
NMConfig *config;
|
||||
} NMSKeyfilePluginPrivate;
|
||||
|
@ -297,47 +295,6 @@ update_connection (NMSKeyfilePlugin *self,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dir_changed (GFileMonitor *monitor,
|
||||
GFile *file,
|
||||
GFile *other_file,
|
||||
GFileMonitorEvent event_type,
|
||||
gpointer user_data)
|
||||
{
|
||||
NMSettingsPlugin *config = NM_SETTINGS_PLUGIN (user_data);
|
||||
NMSKeyfilePlugin *self = NMS_KEYFILE_PLUGIN (config);
|
||||
NMSKeyfileConnection *connection;
|
||||
char *full_path;
|
||||
gboolean exists;
|
||||
|
||||
full_path = g_file_get_path (file);
|
||||
if (nm_keyfile_utils_ignore_filename (full_path, FALSE)) {
|
||||
g_free (full_path);
|
||||
return;
|
||||
}
|
||||
exists = g_file_test (full_path, G_FILE_TEST_EXISTS);
|
||||
|
||||
_LOGD ("dir_changed(%s) = %d; file %s", full_path, event_type, exists ? "exists" : "does not exist");
|
||||
|
||||
connection = find_by_path (self, full_path);
|
||||
|
||||
switch (event_type) {
|
||||
case G_FILE_MONITOR_EVENT_DELETED:
|
||||
if (!exists && connection)
|
||||
remove_connection (NMS_KEYFILE_PLUGIN (config), connection);
|
||||
break;
|
||||
case G_FILE_MONITOR_EVENT_CREATED:
|
||||
case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
|
||||
if (exists)
|
||||
update_connection (NMS_KEYFILE_PLUGIN (config), NULL, full_path, connection, TRUE, NULL, NULL);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
g_free (full_path);
|
||||
}
|
||||
|
||||
static void
|
||||
config_changed_cb (NMConfig *config,
|
||||
NMConfigData *config_data,
|
||||
|
@ -355,30 +312,6 @@ config_changed_cb (NMConfig *config,
|
|||
_nm_settings_plugin_emit_signal_unmanaged_specs_changed (NM_SETTINGS_PLUGIN (self));
|
||||
}
|
||||
|
||||
static void
|
||||
setup_monitoring (NMSettingsPlugin *config)
|
||||
{
|
||||
NMSKeyfilePluginPrivate *priv = NMS_KEYFILE_PLUGIN_GET_PRIVATE ((NMSKeyfilePlugin *) config);
|
||||
GFile *file;
|
||||
GFileMonitor *monitor;
|
||||
|
||||
if (nm_config_get_monitor_connection_files (priv->config)) {
|
||||
file = g_file_new_for_path (nms_keyfile_utils_get_path ());
|
||||
monitor = g_file_monitor_directory (file, G_FILE_MONITOR_NONE, NULL, NULL);
|
||||
g_object_unref (file);
|
||||
|
||||
if (monitor) {
|
||||
priv->monitor_id = g_signal_connect (monitor, "changed", G_CALLBACK (dir_changed), config);
|
||||
priv->monitor = monitor;
|
||||
}
|
||||
}
|
||||
|
||||
g_signal_connect (G_OBJECT (priv->config),
|
||||
NM_CONFIG_SIGNAL_CONFIG_CHANGED,
|
||||
G_CALLBACK (config_changed_cb),
|
||||
config);
|
||||
}
|
||||
|
||||
static GHashTable *
|
||||
_paths_from_connections (GHashTable *connections)
|
||||
{
|
||||
|
@ -504,7 +437,6 @@ get_connections (NMSettingsPlugin *config)
|
|||
NMSKeyfilePluginPrivate *priv = NMS_KEYFILE_PLUGIN_GET_PRIVATE ((NMSKeyfilePlugin *) config);
|
||||
|
||||
if (!priv->initialized) {
|
||||
setup_monitoring (config);
|
||||
read_connections (config);
|
||||
priv->initialized = TRUE;
|
||||
}
|
||||
|
@ -590,7 +522,8 @@ nms_keyfile_plugin_init (NMSKeyfilePlugin *plugin)
|
|||
static void
|
||||
constructed (GObject *object)
|
||||
{
|
||||
NMSKeyfilePluginPrivate *priv = NMS_KEYFILE_PLUGIN_GET_PRIVATE ((NMSKeyfilePlugin *) object);
|
||||
NMSKeyfilePlugin *self = NMS_KEYFILE_PLUGIN (object);
|
||||
NMSKeyfilePluginPrivate *priv = NMS_KEYFILE_PLUGIN_GET_PRIVATE (self);
|
||||
|
||||
G_OBJECT_CLASS (nms_keyfile_plugin_parent_class)->constructed (object);
|
||||
|
||||
|
@ -599,6 +532,17 @@ constructed (GObject *object)
|
|||
NM_CONFIG_KEYFILE_KEY_KEYFILE_HOSTNAME,
|
||||
NM_CONFIG_GET_VALUE_RAW))
|
||||
_LOGW ("'hostname' option is deprecated and has no effect");
|
||||
|
||||
if (nm_config_data_has_value (nm_config_get_data_orig (priv->config),
|
||||
NM_CONFIG_KEYFILE_GROUP_MAIN,
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_MONITOR_CONNECTION_FILES,
|
||||
NM_CONFIG_GET_VALUE_RAW))
|
||||
_LOGW ("'monitor-connection-files' option is deprecated and has no effect");
|
||||
|
||||
g_signal_connect (G_OBJECT (priv->config),
|
||||
NM_CONFIG_SIGNAL_CONFIG_CHANGED,
|
||||
G_CALLBACK (config_changed_cb),
|
||||
self);
|
||||
}
|
||||
|
||||
NMSKeyfilePlugin *
|
||||
|
@ -612,13 +556,6 @@ dispose (GObject *object)
|
|||
{
|
||||
NMSKeyfilePluginPrivate *priv = NMS_KEYFILE_PLUGIN_GET_PRIVATE ((NMSKeyfilePlugin *) object);
|
||||
|
||||
if (priv->monitor) {
|
||||
nm_clear_g_signal_handler (priv->monitor, &priv->monitor_id);
|
||||
|
||||
g_file_monitor_cancel (priv->monitor);
|
||||
g_clear_object (&priv->monitor);
|
||||
}
|
||||
|
||||
if (priv->connections) {
|
||||
g_hash_table_destroy (priv->connections);
|
||||
priv->connections = NULL;
|
||||
|
|
Loading…
Reference in a new issue