mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-09 05:58:01 +02:00
ifcfg-rh: don't reverse lookup on 'localhost' unless NM_IGNORE_HOSTNAME_LOCALHOST=yes (rh #490184)
This commit is contained in:
parent
aabc52f4a5
commit
8899e1d9cd
1 changed files with 11 additions and 8 deletions
|
|
@ -479,6 +479,7 @@ plugin_get_hostname (SCPluginIfcfg *plugin)
|
||||||
{
|
{
|
||||||
shvarFile *network;
|
shvarFile *network;
|
||||||
char *hostname;
|
char *hostname;
|
||||||
|
gboolean ignore_localhost;
|
||||||
|
|
||||||
network = svNewFile (SC_NETWORK_FILE);
|
network = svNewFile (SC_NETWORK_FILE);
|
||||||
if (!network) {
|
if (!network) {
|
||||||
|
|
@ -487,16 +488,18 @@ plugin_get_hostname (SCPluginIfcfg *plugin)
|
||||||
}
|
}
|
||||||
|
|
||||||
hostname = svGetValue (network, "HOSTNAME", FALSE);
|
hostname = svGetValue (network, "HOSTNAME", FALSE);
|
||||||
svCloseFile (network);
|
ignore_localhost = svTrueValue (network, "NM_IGNORE_HOSTNAME_LOCALHOST", FALSE);
|
||||||
|
if (ignore_localhost) {
|
||||||
/* Ignore a hostname of 'localhost' or 'localhost.localdomain' to preserve
|
/* Ignore a hostname of 'localhost' or 'localhost.localdomain' to preserve
|
||||||
* 'network' service behavior.
|
* 'network' service behavior.
|
||||||
*/
|
*/
|
||||||
if (hostname && (!strcmp (hostname, "localhost") || !strcmp (hostname, "localhost.localdomain"))) {
|
if (hostname && (!strcmp (hostname, "localhost") || !strcmp (hostname, "localhost.localdomain"))) {
|
||||||
g_free (hostname);
|
g_free (hostname);
|
||||||
hostname = NULL;
|
hostname = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
svCloseFile (network);
|
||||||
return hostname;
|
return hostname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue