[yast-commit] r40999 - in /trunk/network/src/modules: DNS.ycp Host.ycp
![](https://seccdn.libravatar.org/avatar/d95f774280866d45941b1365718208ff.jpg?s=120&d=mm&r=g)
Author: kmachalkova Date: Thu Sep 20 18:40:02 2007 New Revision: 40999 URL: http://svn.opensuse.org/viewcvs/yast?rev=40999&view=rev Log: Always add '127.0.0.2 host.site host' line to /etc/hosts Modified: trunk/network/src/modules/DNS.ycp trunk/network/src/modules/Host.ycp Modified: trunk/network/src/modules/DNS.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/modules/DNS.ycp?rev=4... ============================================================================== --- trunk/network/src/modules/DNS.ycp (original) +++ trunk/network/src/modules/DNS.ycp Thu Sep 20 18:40:02 2007 @@ -228,27 +228,19 @@ /* build FQ hostname */ string fqhostname = Hostname::MergeFQ(hostname, domain); - NetworkDevices::Read(); - // Take static network addresses. - // Watch out, there may be an unused IPADDR for a DHCP interface, #49055 - list<string> devs = - NetworkDevices::Locate ("BOOTPROTO", "static") + - NetworkDevices::Locate ("BOOTPROTO", ""); // static is the default - list<string> ips = maplist(string dev, devs, { - return NetworkDevices::GetValue(dev, "IPADDR"); - }); - if (NetworkConfig::DHCP["WRITE_HOSTNAME_TO_HOSTS"]:true == false) + //We do not collect static IP addresses here, as hostnames + //are defined for each static IP separately in address dialog + //FaTE #2202 + + if (NetworkConfig::DHCP["WRITE_HOSTNAME_TO_HOSTS"]:true == false) Host::write_hostname=false; else { - /* Update /etc/hosts, but only iff there are no static - IPs defined. Otherwise, hostnames are associated with - static IPs in address dialog - FaTE #2202 */ - if ( ips == [] ) - { - Host::Update(oldhostname, fqhostname, ips); - Host::Write(); - } + //Always add 127.0.0.2 entry to /etc/hosts, otherwise some + //desktop apps may hang, not being able to resolve hostname (#304632) + //empty list [] as third parameter does that + Host::Update(oldhostname, fqhostname, []); + Host::Write(); } oldhostname = fqhostname; // #49634 Modified: trunk/network/src/modules/Host.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/modules/Host.ycp?rev=... ============================================================================== --- trunk/network/src/modules/Host.ycp (original) +++ trunk/network/src/modules/Host.ycp Thu Sep 20 18:40:02 2007 @@ -225,6 +225,18 @@ } y2debug("Hosts: %1", hosts); + /* Add at least one hostname/ip */ + // but do not overload localhost (#46715) + if (write_hostname) { + if (size(ips) < 1 && nick != "localhost") { + y2milestone("Adding dummy 127.0.0.2 %1 entry", newhn); + // TODO #42102 + hosts["127.0.0.2"] = [ newhn + " " + nick ]; + y2milestone("Hosts: %1", hosts); + return true; + } + } + /* Remove old hostname from hosts */ // list oldhnlist = []; foreach (string ip, list<string> hs, hosts, { @@ -248,17 +260,7 @@ hosts["127.0.0.1"] = ["localhost"]; } - /* Add at least one hostname/ip */ - // but do not overload localhost (#46715) - if (write_hostname) - if (size(ips) < 1 && nick != "localhost") { - y2milestone("No IP found, adding dummy 127.0.0.2"); - // TODO #42102 - hosts["127.0.0.2"] = [ newhn + " " + nick ]; - y2milestone("Hosts: %1", hosts); - return true; - } - + /* Add hostname/ip for all ips */ boolean nickadded = false; maplist(string ip, ips, { @@ -266,7 +268,7 @@ /* Only add if not present yet */ // if(haskey(hosts, ip)) return; /* Omit some IP addresses */ - if(ip == "" || ip == nil || ip == "127.0.0.1" || ip == "127.0.0.2") return; + if(ip == "" || ip == nil || ip == "127.0.0.1" ) return; string name = newhn ; /* Add nick for the first one */ -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
kmachalkova@svn.opensuse.org