Red Hat Bugzilla – Bug 605338
nm doesn't restore 127.0.0.1 entry in /etc/hosts
Last modified: 2011-06-27 14:28:27 EDT
I noticed the following problem with NetworkManager-0.8.1-0.1.git20100510.fc13.x86_64 :
I start nm with hostname = localhost.localdomain, and with /etc/hosts containing "127.0.0.1 localhost.localdomain localhost", I connect to a network, nm changes the 127.0.0.1 entry like that "127.0.0.1 <fqdn> localhost.localdomain localhost". When I disconnect from this network, nm doesn't remove <fqdn> from /etc/hosts.
nm_policy_get_etc_hosts() is called with hostname="localhost.localdomain", the statement (found_localhost && found_host) is evaluated to true, so the function returns without building a new /etc/hosts file.
I've reworked the code significantly for another issue (bgo #619931) in master but that's not going to hit 0.8.1. I guess we can try to fix that in 0.8.1 separately.
NetworkManager-0.8.1-4.git20100817.fc12 has been submitted as an update for Fedora 12.
NetworkManager-0.8.1-4.git20100817.fc13 has been submitted as an update for Fedora 13.
NetworkManager-0.8.1-4.git20100817.fc14 has been submitted as an update for Fedora 14.
NetworkManager-0.8.1-5.git20100818.fc14 has been submitted as an update for Fedora 14.
NetworkManager-0.8.1-4.git20100817.fc13 has been pushed to the Fedora 13 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
su -c 'yum --enablerepo=updates-testing update NetworkManager'. You can provide feedback for this update here: http://admin.fedoraproject.org/updates/NetworkManager-0.8.1-4.git20100817.fc13
NetworkManager-0.8.1-4.git20100817.fc13 has been pushed to the Fedora 13 stable repository. If problems still persist, please make note of it in this bug report.
NetworkManager-0.8.1-5.git20100818.fc14 has been pushed to the Fedora 14 stable repository. If problems still persist, please make note of it in this bug report.
NetworkManager-0.8.1-6.git20100831.fc13 has been submitted as an update for Fedora 13.
NetworkManager-0.8.1-6.git20100831.fc12 has been submitted as an update for Fedora 12.
NetworkManager-0.8.1-6.git20100831.fc12 has been pushed to the Fedora 12 stable repository. If problems still persist, please make note of it in this bug report.
I reopen this bug, as it appears that there's still a problem in the sense that /etc/hosts is not restored when the wired interface is unplugged, and when the hostname is restored back to localhost.localdomain.
/etc/hosts remains unchanged :
# Do not remove the following line, or various programs
# that require network functionality will fail.
192.168.128.103 bonobo.example.com bonobo # Added by NetworkManager
127.0.0.1 localhost.localdomain localhost
::1 bonobo.example.com bonobo localhost6.localdomain6 localhost6
Note that we've removed all code touching /etc/hosts from NM upstream. I believe the issue you're experiencing here was already fixed by:
Which all should be present in NetworkManager-0.8.1-9.git20100831.fc12 and later. What version do you have installed?
yes, I'm running this version with the three patches included. I see two issues in the current code:
- the short hostname added to the loopback entry with patch bbf3f12d7b2c79c49d87d41e6cf7b65ac7782071 should be removed when hostname comes back to localhost.localdomain, with a mechanism just like old_hostname. Else, it becomes part of the variable custom6, and remains in the loopback entry.
- with the /etc/hosts from comment #12, when nm_policy_get_etc_hosts() is called with hostname="localhost.localdomain" and old_hostname="bonobo.example.com", all conditions found_localhost4, found_host4, found_localhost6, found_host6, host4_before, host6_before, no_stale are set to true, and /etc/hosts is not modified. I think that when evaluating the ::1 line, the found_localhost6 should be set conditionally if this line doesn't contain the old_hostname to be removed, ditto for found_localhost4
Created attachment 469702 [details]
drop the short old hostname from local mapping
this patch passes the ./test-policy-hosts tests
This message is a reminder that Fedora 13 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 13. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora
'version' of '13'.
Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version prior to Fedora 13's end of life.
Bug Reporter: Thank you for reporting this issue and we are sorry that
we may not be able to fix it before Fedora 13 is end of life. If you
would still like to see this bug fixed and are able to reproduce it
against a later version of Fedora please change the 'version' of this
bug to the applicable version. If you are unable to change the version,
please add a comment here and someone will do it for you.
Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
The process we are following is described here:
Fedora 13 changed to end-of-life (EOL) status on 2011-06-25. Fedora 13 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.
If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version.
Thank you for reporting this bug and we are sorry it could not be fixed.