summaryrefslogtreecommitdiffstats
path: root/perl-install/network.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>1999-08-25 09:47:06 +0000
committerPascal Rigaux <pixel@mandriva.com>1999-08-25 09:47:06 +0000
commit9b8dddbc720899a7872d82e39405997ab6949df4 (patch)
treee294bf4db32549a4592ce398b694d4a9cd389006 /perl-install/network.pm
parent9062c92ba51a7170424f825c60e5ff5ec46c85dd (diff)
downloaddrakx-backup-do-not-use-9b8dddbc720899a7872d82e39405997ab6949df4.tar
drakx-backup-do-not-use-9b8dddbc720899a7872d82e39405997ab6949df4.tar.gz
drakx-backup-do-not-use-9b8dddbc720899a7872d82e39405997ab6949df4.tar.bz2
drakx-backup-do-not-use-9b8dddbc720899a7872d82e39405997ab6949df4.tar.xz
drakx-backup-do-not-use-9b8dddbc720899a7872d82e39405997ab6949df4.zip
no_comment
Diffstat (limited to 'perl-install/network.pm')
-rw-r--r--perl-install/network.pm33
1 files changed, 20 insertions, 13 deletions
diff --git a/perl-install/network.pm b/perl-install/network.pm
index b97a043ed..bce10e35a 100644
--- a/perl-install/network.pm
+++ b/perl-install/network.pm
@@ -5,7 +5,7 @@ use strict;
use Socket;
-use common qw(:common :file :system);
+use common qw(:common :file :system :functional);
use detect_devices;
use modules;
use log;
@@ -66,13 +66,20 @@ sub write_resolv_conf {
sub write_interface_conf {
my ($file, $intf) = @_;
- add2hash($intf, { ONBOOT => "yes" });
+ my @ip = split '\.', $intf->{IPADDR};
+ my @mask = split '\.', $intf->{NETMASK};
+ add2hash($intf, {
+ BROADCAST => join('.', mapn { int $_[0] | ~int $_[1] & 255 } \@ip, \@mask),
+ NETWORK => join('.', mapn { int $_[0] & $_[1] } \@ip, \@mask),
+ ONBOOT => "yes",
+ });
setVarsInSh($file, $intf, qw(DEVICE BOOTPROTO IPADDR NETMASK NETWORK BROADCAST ONBOOT));
}
sub add2hosts {
- my ($file, $ip, $hostname) = @_;
- my %l = ($ip => $hostname);
+ my ($file, $hostname, @ips) = @_;
+ my %l;
+ $l{$_} = $hostname foreach @ips;
local *F;
if (-e $file) {
@@ -116,17 +123,17 @@ sub addDefaultRoute {
c::addDefaultRoute($netc->{gateway}) if $netc->{gateway} || !$::testing;
}
-sub getAvailableNetDevice {
- my $device = detect_devices::getNet();
+sub dnsServers {
+ my ($netc) = @_;
+ map { $netc->{$_} } qw(dnsServer dnsServer2 dnsServer3);
+}
- unless ($device) {
+sub getNet() {
+ my @l = detect_devices::getNet();
+ unless (@l) {
modules::load_thiskind('net') or return;
- $device = detect_devices::getNet();
+ @l = detect_devices::getNet();
}
- $device;
+ @l;
}
-sub dnsServers {
- my ($netc) = @_;
- map { $netc->{$_} } qw(dnsServer dnsServer2 dnsServer3);
-}