summaryrefslogtreecommitdiff
path: root/libnm
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-05-30 15:42:44 +0200
committerThomas Haller <thaller@redhat.com>2016-06-01 19:06:34 +0200
commit1d0e0eeffd92f53d6682cd8f4b3e1ba90997e4c5 (patch)
treef0689ea8feef067115bb293a5f42a04a4c70c6b9 /libnm
parent89135853972710ce0f720acba4b3c12910e3cebc (diff)
downloadNetworkManager-1d0e0eeffd92f53d6682cd8f4b3e1ba90997e4c5.tar.gz
manager: add Reload() D-Bus command
Add new Reload D-Bus command to reload NetworkManager configuration. For now, this is like sending SIGHUP to the process. There are several advantages here: - it is guarded via PolicyKit authentication while signals can only be sent by root. - the user can wait for the reload to be complete instead of sending an asynchronous signal. For now, we operation completes after nm_config_reload() returns, but later we could delay the response further until specific parts are fully reloaded. - SIGHUP reloads everything including re-reading configuration from disk while SIGUSR1 reloads just certain parts such as writing out DNS configuration anew. Now, the Reload command has a flags argument which is more granular in selecting parts which are to be reloaded. For example, via signals the user can: 1) send SIGUSR1: this writes out the DNS configuration to resolv.conf and possibly reloads other parts without re-reading configuration and without restarting the DNS plugin. 2) send SIGHUP: this reloads configuration from disk, writes out resolv.conf and restarts the DNS plugin. There is no way, to only restart the DNS plugin without also reloading everything else.
Diffstat (limited to 'libnm')
-rw-r--r--libnm/nm-client.h4
-rw-r--r--libnm/nm-manager.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/libnm/nm-client.h b/libnm/nm-client.h
index bdd7c46310..6bae78fa47 100644
--- a/libnm/nm-client.h
+++ b/libnm/nm-client.h
@@ -94,6 +94,7 @@ G_BEGIN_DECLS
* persistent hostname can be changed
* @NM_CLIENT_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS: modify persistent global
* DNS configuration
+ * @NM_CLIENT_PERMISSION_RELOAD: controls access to Reload.
* @NM_CLIENT_PERMISSION_LAST: a reserved boundary value
*
* #NMClientPermission values indicate various permissions that NetworkManager
@@ -113,8 +114,9 @@ typedef enum {
NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN = 10,
NM_CLIENT_PERMISSION_SETTINGS_MODIFY_HOSTNAME = 11,
NM_CLIENT_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS = 12,
+ NM_CLIENT_PERMISSION_RELOAD = 13,
- NM_CLIENT_PERMISSION_LAST = 12,
+ NM_CLIENT_PERMISSION_LAST = 13,
} NMClientPermission;
/**
diff --git a/libnm/nm-manager.c b/libnm/nm-manager.c
index 66755e1394..6d1270f03c 100644
--- a/libnm/nm-manager.c
+++ b/libnm/nm-manager.c
@@ -214,6 +214,7 @@ init_dbus (NMObject *object)
#define NM_AUTH_PERMISSION_SETTINGS_MODIFY_OWN "org.freedesktop.NetworkManager.settings.modify.own"
#define NM_AUTH_PERMISSION_SETTINGS_MODIFY_HOSTNAME "org.freedesktop.NetworkManager.settings.modify.hostname"
#define NM_AUTH_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS "org.freedesktop.NetworkManager.settings.modify.global-dns"
+#define NM_AUTH_PERMISSION_RELOAD "org.freedesktop.NetworkManager.reload"
static NMClientPermission
nm_permission_to_client (const char *nm)
@@ -242,6 +243,8 @@ nm_permission_to_client (const char *nm)
return NM_CLIENT_PERMISSION_SETTINGS_MODIFY_HOSTNAME;
else if (!strcmp (nm, NM_AUTH_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS))
return NM_CLIENT_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS;
+ else if (!strcmp (nm, NM_AUTH_PERMISSION_RELOAD))
+ return NM_CLIENT_PERMISSION_RELOAD;
return NM_CLIENT_PERMISSION_NONE;
}