summaryrefslogtreecommitdiffstats
path: root/perl-install/network
diff options
context:
space:
mode:
authorFrederic Lepied <flepied@mandriva.com>2003-02-28 08:40:31 +0000
committerFrederic Lepied <flepied@mandriva.com>2003-02-28 08:40:31 +0000
commit54c1543b2101be7179c2854edea1f09bd90f93c2 (patch)
tree39ca6a99beb63d5e33041c245e9f9e2afe9867a2 /perl-install/network
parent07728179b4f3294a82f54a6b360cb5c7f1e056fe (diff)
downloaddrakx-backup-do-not-use-54c1543b2101be7179c2854edea1f09bd90f93c2.tar
drakx-backup-do-not-use-54c1543b2101be7179c2854edea1f09bd90f93c2.tar.gz
drakx-backup-do-not-use-54c1543b2101be7179c2854edea1f09bd90f93c2.tar.bz2
drakx-backup-do-not-use-54c1543b2101be7179c2854edea1f09bd90f93c2.tar.xz
drakx-backup-do-not-use-54c1543b2101be7179c2854edea1f09bd90f93c2.zip
corrected HOSTNAME/DHCP_HOSTNAME management.
Diffstat (limited to 'perl-install/network')
-rw-r--r--perl-install/network/network.pm25
1 files changed, 11 insertions, 14 deletions
diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm
index 214330ca5..8bf1149da 100644
--- a/perl-install/network/network.pm
+++ b/perl-install/network/network.pm
@@ -166,14 +166,6 @@ sub write_interface_conf {
my @ip = split '\.', $intf->{IPADDR};
my @mask = split '\.', $intf->{NETMASK};
- if ($netc->{DHCP} && $netc->{HOSTNAME}) {
- $intf->{DHCP_HOSTNAME} = $netc->{HOSTNAME};
- $intf->{NEEDHOSTNAME} = "no";
- } else {
- $intf->{DHCP_HOSTNAME} = "";
- $intf->{NEEDHOSTNAME} = "yes"
- }
-
add2hash($intf, {
BROADCAST => join('.', mapn { int($_[0]) | ((~int($_[1])) & 255) } \@ip, \@mask),
NETWORK => join('.', mapn { int($_[0]) & $_[1] } \@ip, \@mask),
@@ -182,7 +174,7 @@ sub write_interface_conf {
$intf->{BOOTPROTO} =~ s/dhcp.*/dhcp/;
- setVarsInSh($file, $intf, qw(DEVICE BOOTPROTO IPADDR NETMASK NETWORK BROADCAST ONBOOT HWADDR MII_NOT_SUPPORTED), if_($intf->{wireless_eth}, qw(WIRELESS_MODE WIRELESS_ESSID WIRELESS_NWID WIRELESS_FREQ WIRELESS_SENS WIRELESS_RATE WIRELESS_ENC_KEY WIRELESS_RTS WIRELESS_FRAG WIRELESS_IWCONFIG WIRELESS_IWSPY WIRELESS_IWPRIV)), if_($intf->{DHCP_HOSTNAME}, 'DHCP_HOSTNAME'), if_(!$intf->{DHCP_HOSTNAME}, 'NEEDHOSTNAME'));
+ setVarsInSh($file, $intf, qw(DEVICE BOOTPROTO IPADDR NETMASK NETWORK BROADCAST ONBOOT HWADDR MII_NOT_SUPPORTED), if_($intf->{wireless_eth}, qw(WIRELESS_MODE WIRELESS_ESSID WIRELESS_NWID WIRELESS_FREQ WIRELESS_SENS WIRELESS_RATE WIRELESS_ENC_KEY WIRELESS_RTS WIRELESS_FRAG WIRELESS_IWCONFIG WIRELESS_IWSPY WIRELESS_IWPRIV)), if_($intf->{BOOTPROTO} eq "dhcp", qw(DHCP_HOSTNAME NEEDHOSTNAME)));
}
sub add2hosts {
@@ -335,6 +327,7 @@ notation (for example, 1.2.3.4).");
}
my $auto_ip = $intf->{BOOTPROTO} !~ /static/;
my $onboot = $intf->{ONBOOT} !~ /no/;
+ my $needhostname = $intf->{NEEDHOSTNAME} !~ /no/;
my $hotplug = $::isStandalone && !$intf->{MII_NOT_SUPPORTED} or 1;
my $track_network_id = $::isStandalone && $intf->{HWADDR} or detect_devices::isLaptop();
delete $intf->{NETWORK};
@@ -344,11 +337,15 @@ notation (for example, 1.2.3.4).");
$in->ask_from(N("Configuring network device %s", $intf->{DEVICE}),
(N("Configuring network device %s", $intf->{DEVICE}) . ($module ? N(" (driver %s)", $module) : '') . "\n\n") .
$text,
- [ { label => N("IP address"), val => \$intf->{IPADDR}, disabled => sub { $auto_ip } },
- { label => N("Netmask"), val => \$intf->{NETMASK}, disabled => sub { $auto_ip } },
- { label => N("Automatic IP"), val => \$auto_ip, type => "bool", text => N("(bootp/dhcp/zeroconf)") },
- if_($::expert, { label => N("Track network card id (useful for laptops)"), val => \$track_network_id, type => "bool" },
+ [ { label => N("Automatic IP"), val => \$auto_ip, type => "bool", text => N("(bootp/dhcp/zeroconf)") },
+ { label => N("IP address"), val => \$intf->{IPADDR}, disabled => sub { $auto_ip } },
+ { label => N("Netmask"), val => \$intf->{NETMASK}, disabled => sub { $auto_ip } },
+
+ if_($::expert,
+ { label => N("DHCP host name"), val => \$intf->{DHCP_HOSTNAME}, disabled => sub { ! $auto_ip } },
+ { label => N("Track network card id (useful for laptops)"), val => \$track_network_id, type => "bool" },
{ label => N("Network Hotplugging"), val => \$hotplug, type => "bool" },
+ { label => N("Assign host name from DHCP address"), val => \$needhostname, type => "bool", disabled => sub { ! $auto_ip } },
{ label => N("Start at boot"), val => \$onboot, type => "bool" }),
if_($intf->{wireless_eth},
{ label => "WIRELESS_MODE", val => \$intf->{WIRELESS_MODE}, list => [ "Ad-hoc", "Managed", "Master", "Repeater", "Secondary", "Auto" ] },
@@ -391,6 +388,7 @@ notation (for example, 1.2.3.4).");
}
) or return;
$intf->{ONBOOT} = bool2yesno($onboot);
+ $intf->{NEEDHOSTNAME} = bool2yesno($needhostname);
$intf->{MII_NOT_SUPPORTED} = !$hotplug && bool2yesno(!$hotplug) or delete $intf->{MII_NOT_SUPPORTED};
$intf->{HWADDR} = $track_network_id or delete $intf->{HWADDR};
1;
@@ -472,7 +470,6 @@ sub read_all_conf {
if (/ifcfg-(\w+)/ && $1 ne 'lo') {
my $intf = findIntf($intf, $1);
add2hash($intf, { getVarsFromSh("$prefix/etc/sysconfig/network-scripts/$_") });
- $netc->{HOSTNAME} = $intf->{DHCP_HOSTNAME} if ($intf->{BOOTPROTO} == 'dhcp');
}
}
$netcnx->{type} or probe_netcnx_type($prefix, $netc, $intf, $netcnx);