Author: kmachalkova Date: Fri Aug 10 11:48:08 2007 New Revision: 40155 URL: http://svn.opensuse.org/viewcvs/yast?rev=40155&view=rev Log: Allow definition of different hostname for each static IP address Modified: trunk/network/src/lan/address.ycp trunk/network/src/lan/help.ycp Modified: trunk/network/src/lan/address.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/lan/address.ycp?rev=40155&r1=40154&r2=40155&view=diff ============================================================================== --- trunk/network/src/lan/address.ycp (original) +++ trunk/network/src/lan/address.ycp Fri Aug 10 11:48:08 2007 @@ -14,15 +14,17 @@ import "Arch"; import "CWM"; import "CWMTab"; -import "NetHwDetection"; +import "Host"; import "IP"; import "Label"; import "Lan"; import "Netmask"; +import "NetHwDetection"; import "NetworkDevices"; import "Popup"; import "ProductFeatures"; import "Routing"; +import "String"; import "SuSEFirewall4Network"; import "Wizard"; import "NetworkService"; @@ -45,6 +47,8 @@ string fwzone_initial = ""; +string hostname_initial = ""; + boolean force_static_ip = ProductFeatures::GetBooleanFeature ("network", "force_static_ip"); /** @@ -124,6 +128,7 @@ case "static": UI::ChangeWidget(`id(`bootproto), `CurrentButton, `static); UI::ChangeWidget(`id(`ipaddr), `Value, settings["IPADDR"]:""); UI::ChangeWidget(`id(`netmask), `Value, settings["NETMASK"]:""); + UI::ChangeWidget(`id(`hostname), `Value, settings["HOSTNAME"]:""); break; case "dhcp" : UI::ChangeWidget(`id(`bootproto), `CurrentButton, `dynamic); break; @@ -174,6 +179,7 @@ case `static: settings["BOOTPROTO"]="static"; settings["IPADDR"]=(string)UI::QueryWidget(`ipaddr, `Value); settings["NETMASK"]=(string)UI::QueryWidget(`netmask, `Value); + settings["HOSTNAME"]=(string)UI::QueryWidget(`hostname, `Value); break; default : switch ((symbol)UI::QueryWidget(`dyn, `Value)){ case `dhcp: settings["BOOTPROTO"]="dhcp"; @@ -497,7 +503,7 @@ `HSpacing(1), `TextEntry(`id(`netmask), _("&Subnet Mask")), `HSpacing(1), - `TextEntry(`id(`hostname), "&Hostname - Do not use yet!"), + `TextEntry(`id(`hostname), "&Hostname"), `HStretch() ) ) @@ -578,6 +584,13 @@ fwzone_initial = fwzone; + list <string> host_list = Host::hosts[LanItems::ipaddr]:[]; + if ( size( host_list) > 1) + { + y2milestone("More than one hostname for single IP detected, using the first one only"); + } + hostname_initial = String::FirstChunk( host_list[0]:"", " \t"); + settings = $[ // general tab: // "IFNAME": ifname, @@ -593,13 +606,13 @@ "NETMASK": LanItems::netmask, "REMOTEIP": LanItems::remoteip, + "HOSTNAME": hostname_initial, + "IFCFGTYPE": LanItems::type, "IFCFGID": LanItems::device, ]; - - string drvtype = DriverType (settings["IFCFGTYPE"]:""); boolean is_ptp = drvtype == "ctc" || drvtype == "iucv"; @@ -875,9 +888,19 @@ LanItems::bootproto = settings["BOOTPROTO"]:""; if (LanItems::bootproto == "static") // #104494 { + boolean ip_changed = ( LanItems::ipaddr != settings["IPADDR"]:"" ); + if (ip_changed) + remove( Host::hosts, LanItems::ipaddr); + LanItems::ipaddr = settings["IPADDR"]:""; LanItems::netmask = settings["NETMASK"]:""; LanItems::remoteip = settings["REMOTEIP"]:""; + + if (hostname_initial != settings["HOSTNAME"]:"" || ip_changed) + { + y2milestone("%1 %2", hostname_initial, settings["HOSTNAME"]:""); + Host::Update(hostname_initial, settings["HOSTNAME"]:"", [ settings["IPADDR"]:""]); + } } else { Modified: trunk/network/src/lan/help.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/lan/help.ycp?rev=40155&r1=40154&r2=40155&view=diff ============================================================================== --- trunk/network/src/lan/help.ycp (original) +++ trunk/network/src/lan/help.ycp Fri Aug 10 11:48:08 2007 @@ -159,7 +159,8 @@ /* Address dialog help 6/8 */ "netmask": _("<p>For <b>Static Address Setup</b> enter static IP address (e.g., 192.168.100.99) -for your computer and the network mask (usually 255.255.255.0)</p>") +for your computer and the network mask (usually 255.255.255.0). Optionally, you can enter +fully qualified hostname for this IP address. It will be written to <i>/etc/hosts</i>.</p>") + /* Address dialog help 8/8 */ _("<p>Contact your <b>network administrator</b> for more information about @@ -190,7 +191,7 @@ or define your own one.</p>"), "bondslave": -_("<p>Select the slave devices for the bond device. Only the devices which's Device Activation is Never and set as None Address Setup are available.</p>"), +_("<p>Select the slave devices for the bond device. Only the devices whose Device Activation is set to Never and have No Address Setup are available.</p>"), "dhclient_help" : /* DHCP dialog help 1/8 */ -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org