diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2016-02-18 18:19:30 +0100 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2016-03-04 14:27:09 +0100 |
commit | 4090716d96180caaeb807033e0c9a3b4a3092f9b (patch) | |
tree | 794a6daf295646528dcc10983c52c983865d950a /src/settings/nm-settings.h | |
parent | 298ab552252a10d3d1212aba56a7bdbdd543cdb4 (diff) | |
download | NetworkManager-4090716d96180caaeb807033e0c9a3b4a3092f9b.tar.gz |
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
Diffstat (limited to 'src/settings/nm-settings.h')
-rw-r--r-- | src/settings/nm-settings.h | 7 |
1 files changed, 7 insertions, 0 deletions
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__ */ |