From 4090716d96180caaeb807033e0c9a3b4a3092f9b Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Thu, 18 Feb 2016 18:19:30 +0100 Subject: core: use hostnamed to set the transient hostname In commit 6dc35e66d45e ("settings: add hostnamed support") we started to use systemd-hostnamed for setting the system static hostname (i.e. the one written to /etc/hostname), but nm-policy.c still called sethostname() to set the transient (dynamic) hostname when this needs to be changed, for example after a reverse lookup of our dynamic IP address. Thus, when using systemd the hostname change failed because process' capabilities are restricted and sethostname() requires CAP_SYS_ADMIN. We should set also the transient hostname through hostnamed when this is available. https://bugzilla.redhat.com/show_bug.cgi?id=1308974 --- src/settings/nm-settings.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/settings/nm-settings.h') diff --git a/src/settings/nm-settings.h b/src/settings/nm-settings.h index 923b164b04..051c209423 100644 --- a/src/settings/nm-settings.h +++ b/src/settings/nm-settings.h @@ -71,6 +71,8 @@ typedef struct { void (*agent_registered) (NMSettings *self, NMSecretAgent *agent); } NMSettingsClass; +typedef void (*NMSettingsSetHostnameCb) (const char *name, gboolean result, gpointer user_data); + GType nm_settings_get_type (void); NMSettings *nm_settings_new (void); @@ -127,4 +129,9 @@ gint nm_settings_sort_connections (gconstpointer a, gconstpointer b); gboolean nm_settings_get_startup_complete (NMSettings *self); +void nm_settings_set_transient_hostname (NMSettings *self, + const char *hostname, + NMSettingsSetHostnameCb cb, + gpointer user_data); + #endif /* __NM_SETTINGS_H__ */ -- cgit v1.2.1