From 9b8dddbc720899a7872d82e39405997ab6949df4 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 25 Aug 1999 09:47:06 +0000 Subject: no_comment --- perl-install/network.pm | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'perl-install/network.pm') 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); -} -- cgit v1.2.1