summaryrefslogtreecommitdiffstats
path: root/perl-install/network
diff options
context:
space:
mode:
authorArnaud Desmons <adesmons@mandriva.com>2002-12-02 17:07:29 +0000
committerArnaud Desmons <adesmons@mandriva.com>2002-12-02 17:07:29 +0000
commit9a9961b6cf1ad884564dc3dca7e7e8447f2321e0 (patch)
tree7b66a49543bc0ba1266310e425db08d2e60a4f56 /perl-install/network
parent0579c9250c7dfd98c0c47174fe000695921b39fb (diff)
downloaddrakx-9a9961b6cf1ad884564dc3dca7e7e8447f2321e0.tar
drakx-9a9961b6cf1ad884564dc3dca7e7e8447f2321e0.tar.gz
drakx-9a9961b6cf1ad884564dc3dca7e7e8447f2321e0.tar.bz2
drakx-9a9961b6cf1ad884564dc3dca7e7e8447f2321e0.tar.xz
drakx-9a9961b6cf1ad884564dc3dca7e7e8447f2321e0.zip
Some data are now fetched from system instead of drakconnect conf file (adsl, ppp, ifcfg-eth)
Diffstat (limited to 'perl-install/network')
-rw-r--r--perl-install/network/adsl.pm12
-rw-r--r--perl-install/network/modem.pm14
-rw-r--r--perl-install/network/netconnect.pm58
-rw-r--r--perl-install/network/network.pm4
4 files changed, 47 insertions, 41 deletions
diff --git a/perl-install/network/adsl.pm b/perl-install/network/adsl.pm
index 875da17b6..c9e8969b8 100644
--- a/perl-install/network/adsl.pm
+++ b/perl-install/network/adsl.pm
@@ -5,7 +5,7 @@ use run_program;
use network::tools;
use network::ethernet;
use modules;
-
+use Data::Dumper;
use vars qw(@ISA @EXPORT);
use MDK::Common::Globals "network", qw($in $prefix);
@@ -34,7 +34,7 @@ If you don't know, choose 'use pppoe'"), $l) or return;
if ($type eq 'pppoe') {
$in->do_pkgs->install("rp-$type");
$netcnx->{type} = "adsl_$type";
- $netcnx->{"adsl_$type"} = {};
+# $netcnx->{"adsl_$type"} = {};
adsl_conf($netcnx->{"adsl_$type"}, $netc, $intf, $type) or goto conf_adsl_step1;
#-network::configureNetwork($prefix, $netc, $in, $intf, $first_time);
# if ($::isStandalone and $netc->{NET_DEVICE}) {
@@ -83,9 +83,11 @@ If you don't know, choose 'use pppoe'"), $l) or return;
}
sub adsl_ask_info {
- my ($adsl, $netc, $intf) = @_;
+ my ($adsl, $netc, $intf, $adsl_type) = @_;
+ my $pppoe_file = "/etc/ppp/pppoe.conf";
+ my $pppoe_conf = { getVarsFromSh($pppoe_file) } if ($adsl_type =~ /pppoe/ && -f $pppoe_file);
add2hash($netc, { dnsServer2 => '', dnsServer3 => '', DOMAINNAME2 => '' });
- add2hash($adsl, { login => '', passwd => '', passwd2 => '' });
+ add2hash($adsl, { login => "$pppoe_conf->{USER}", passwd => '', passwd2 => '' });
ask_info2($adsl, $netc);
}
@@ -101,7 +103,7 @@ sub adsl_conf {
my ($adsl, $netc, $intf, $adsl_type) = @_;
adsl_conf_step_1:
- adsl_ask_info($adsl, $netc, $intf) or return;
+ adsl_ask_info ($adsl, $netc, $intf, $adsl_type) or return;
adsl_conf_step_2:
$adsl_type =~ /speedtouch|eci/ or conf_network_card($netc, $intf, 'static', '10.0.0.10') or goto adsl_conf_step_1;
adsl_conf_backend($adsl, $netc, $adsl_type);
diff --git a/perl-install/network/modem.pm b/perl-install/network/modem.pm
index a6eabf170..9478acf9f 100644
--- a/perl-install/network/modem.pm
+++ b/perl-install/network/modem.pm
@@ -8,17 +8,19 @@ use mouse;
use network::tools;
use vars qw(@ISA @EXPORT);
use MDK::Common::Globals "network", qw($in $prefix);
+use Data::Dumper;
@ISA = qw(Exporter);
@EXPORT = qw(pppConfig);
sub configure {
- my ($netcnx, $mouse, $netc) = @_;
+ my ($netcnx, $mouse, $netc, $intf) = @_;
$netcnx->{type} = 'modem';
- $netcnx->{$netcnx->{type}} = {};
- $netcnx->{modem}{device} = $netc->{autodetect}{modem};
- modem_step_1:
- pppConfig($netcnx->{$netcnx->{type}}, $mouse, $netc) or return;
+# $netcnx->{$netcnx->{type}} = {};
+# $netcnx->{modem}{device} = $netc->{autodetect}{modem};
+# modem_step_1:
+ $netcnx->{$netcnx->{type}}->{login} = ($netcnx->{$netcnx->{type}}->{auth} eq 'PAP' || $netcnx->{$netcnx->{type}}->{auth} eq 'CHAP') && $intf->{ppp0}{PAPNAME};
+ pppConfig($netcnx->{$netcnx->{type}}, $mouse, $netc, $intf) or return;
write_cnx_script($netc, "modem",
q(
/sbin/route del default
@@ -31,7 +33,7 @@ killall pppd
}
sub pppConfig {
- my ($modem, $mouse, $netc) = @_;
+ my ($modem, $mouse, $netc, $intf) = @_;
$mouse ||= {};
$mouse->{device} ||= readlink "$prefix/dev/mouse";
diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm
index 1e3ab537f..f0ebedfc9 100644
--- a/perl-install/network/netconnect.pm
+++ b/perl-install/network/netconnect.pm
@@ -8,7 +8,7 @@ use modules;
use any;
use mouse;
use network;
-
+use Data::Dumper;
use network::tools;
use MDK::Common::Globals "network", qw($in $prefix $connect_file $disconnect_file $connect_prog);
@@ -215,8 +215,8 @@ If you don't want to use the auto detection, deselect the checkbox.
}
) or goto step_1;
-# load_conf ($netcnx, $netc, $intf);
- $conf{modem} and do { pre_func("modem"); require network::modem; network::modem::configure($netcnx, $mouse, $netc) or goto step_2 };
+ load_conf ($netcnx, $netc, $intf);
+ $conf{modem} and do { pre_func("modem"); require network::modem; network::modem::configure($netcnx, $mouse, $netc, $intf) or goto step_2 };
$conf{winmodem} and do { pre_func("winmodem"); require network::modem; network::modem::winmodemConfigure($netc) or goto step_2 };
$conf{isdn} and do { pre_func("isdn"); require network::isdn; network::isdn::configure($netcnx, $netc) or goto step_2 };
$conf{adsl} and do { pre_func("adsl"); require network::adsl; network::adsl::configure($netcnx, $netc, $intf, $first_time) or goto step_2 };
@@ -496,6 +496,7 @@ sub get_profiles {
map { if_(/drakconnect_conf\.(.*)/, $1) } all("$::prefix/etc/sysconfig/network-scripts");
}
+
sub load_conf {
my ($netcnx, $netc, $intf) = @_;
my $adsl_pptp = {};
@@ -508,21 +509,21 @@ sub load_conf {
if (-e "$prefix/etc/sysconfig/network-scripts/drakconnect_conf") {
foreach (cat_("$prefix/etc/sysconfig/network-scripts/drakconnect_conf")) {
- /^DNSPrimaryIP=(.*)$/ and $netc->{dnsServer} = $1;
- /^DNSSecondaryIP=(.*)$/ and $netc->{dnsServer2} = $1;
- /^DNSThirdIP=(.*)$/ and $netc->{dnsServer3} = $1;
+# /^DNSPrimaryIP=(.*)$/ and $netc->{dnsServer} = $1;
+# /^DNSSecondaryIP=(.*)$/ and $netc->{dnsServer2} = $1;
+# /^DNSThirdIP=(.*)$/ and $netc->{dnsServer3} = $1;
/^InternetAccessType=(.*)$/ and $netcnx->{type} = $1;
/^InternetInterface=(.*)$/ and $netcnx->{NET_INTERFACE} = $1;
/^InternetGateway=(.*)$/ and $netc->{GATEWAY} = $1;
- /^SystemName=(.*)$/ and $system_name = $1;
- /^DomainName=(.*)$/ and $domain_name = $1;
- /^Eth([0-9])Known=true$/ and $intf->{"eth$1"}{DEVICE} = "eth$1";
- /^Eth([0-9])IP=(.*)$/ && $intf->{"eth$1"}{DEVICE} and $intf->{"eth$1"}{IPADDR} = $2;
- /^Eth([0-9])Mask=(.*)\n/ && $intf->{"eth$1"}{DEVICE} and $intf->{"eth$1"}{NETMASK} = $2;
- /^Eth([0-9])BootProto=(.*)\n/ && $intf->{"eth$1"}{DEVICE} and $intf->{"eth$1"}{BOOTPROTO} = $2;
- /^Eth([0-9])OnBoot=(.*)\n/ && $intf->{"eth$1"}{DEVICE} and $intf->{"eth$1"}{ONBOOT} = $2;
- /^Eth([0-9])Hostname=(.*)\n/ && $intf->{"eth$1"}{DEVICE} and $netc->{HOSTNAME} = $2;
- /^Eth([0-9])Driver=(.*)\n/ && $intf->{"eth$1"}{DEVICE} and $intf->{"eth$1"}{driver} = $2;
+# /^SystemName=(.*)$/ and $system_name = $1;
+# /^DomainName=(.*)$/ and $domain_name = $1;
+# /^Eth([0-9])Known=true$/ and $intf->{"eth$1"}{DEVICE} = "eth$1";
+# /^Eth([0-9])IP=(.*)$/ && $intf->{"eth$1"}{DEVICE} and $intf->{"eth$1"}{IPADDR} = $2;
+# /^Eth([0-9])Mask=(.*)\n/ && $intf->{"eth$1"}{DEVICE} and $intf->{"eth$1"}{NETMASK} = $2;
+# /^Eth([0-9])BootProto=(.*)\n/ && $intf->{"eth$1"}{DEVICE} and $intf->{"eth$1"}{BOOTPROTO} = $2;
+# /^Eth([0-9])OnBoot=(.*)\n/ && $intf->{"eth$1"}{DEVICE} and $intf->{"eth$1"}{ONBOOT} = $2;
+# /^Eth([0-9])Hostname=(.*)\n/ && $intf->{"eth$1"}{DEVICE} and $netc->{HOSTNAME} = $2;
+# /^Eth([0-9])Driver=(.*)\n/ && $intf->{"eth$1"}{DEVICE} and $intf->{"eth$1"}{driver} = $2;
/^ISDNDriver=(.*)$/ and $isdn->{driver} = $1;
/^ISDNDeviceType=(.*)$/ and $isdn->{type} = $1;
/^ISDNIrq=(.*)/ and $isdn->{irq} = $1;
@@ -549,18 +550,18 @@ sub load_conf {
/^PPPProviderDomain=(.*)$/ and $modem->{domain} = $1;
/^PPPProviderDNS1=(.*)$/ and $modem->{dns1} = $1;
/^PPPProviderDNS2=(.*)$/ and $modem->{dns2} = $1;
- /^PPPLogin=(.*)$/ and $modem->{login} = $1;
+ #/^PPPLogin=(.*)$/ and $modem->{login} = $1;
/^PPPPassword=(.*)$/ and $modem->{passwd} = $1;
/^PPPAuthentication=(.*)$/ and $modem->{auth} = $1;
if (/^PPPSpecialCommand=(.*)$/) {
$netcnx->{type} eq 'isdn_external' and $netcnx->{$netcnx->{type}}{special_command} = $1;
}
- /^ADSLLogin=(.*)$/ and $adsl_pppoe->{login} = $1;
- /^ADSLPassword=(.*)$/ and $adsl_pppoe->{passwd} = $1;
+# /^ADSLLogin=(.*)$/ and $adsl_pppoe->{login} = $1;
+# /^ADSLPassword=(.*)$/ and $adsl_pppoe->{passwd} = $1;
/^DOMAINNAME2=(.*)$/ and $netc->{DOMAINNAME2} = $1;
}
}
- $system_name && $domain_name and $netc->{HOSTNAME} = join '.', $system_name, $domain_name;
+# $system_name && $domain_name and $netc->{HOSTNAME} = join ('.', $system_name, $domain_name);
$adsl_pptp->{$_} = $adsl_pppoe->{$_} foreach 'login', 'passwd', 'passwd2';
$isdn_external->{$_} = $modem->{$_} foreach 'device', 'connection', 'phone', 'domain', 'dns1', 'dns2', 'login', 'passwd', 'auth';
$netcnx->{adsl_pptp} = $adsl_pptp;
@@ -568,15 +569,16 @@ sub load_conf {
$netcnx->{modem} = $modem;
$netcnx->{modem} = $isdn_external;
$netcnx->{isdn_internal} = $isdn;
- -e "$prefix/etc/sysconfig/network" and put_in_hash($netc, network::read_conf("$prefix/etc/sysconfig/network"));
- foreach (glob_("$prefix/etc/sysconfig/ifcfg-*")) {
- my $l = network::read_interface_conf($_);
- $intf->{$l->{DEVICE}} = $l;
- }
- my $file = "$prefix/etc/resolv.conf";
- if (-e $file) {
- put_in_hash($netc, network::read_resolv_conf($file));
- }
+# -e "$prefix/etc/sysconfig/network" and put_in_hash($netc, network::read_conf("$prefix/etc/sysconfig/network"));
+# foreach (glob_("$prefix/etc/sysconfig/ifcfg-*")) {
+# my $l = network::read_interface_conf($_);
+# $intf->{$l->{DEVICE}} = $l;
+# }
+# my $file = "$prefix/etc/resolv.conf";
+# if (-e $file) {
+# put_in_hash($netc, network::read_resolv_conf($file));
+# }
+ network::read_all_conf($prefix, $netc, $intf);
}
#- ensures the migration from old config files
diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm
index 35882507f..14a4fdaf3 100644
--- a/perl-install/network/network.pm
+++ b/perl-install/network/network.pm
@@ -114,7 +114,7 @@ sub write_resolv_conf {
@new, @old;
};
output($file, @search, @nameserver, (map { "# $_\n" } @unknown), "\n# ppp temp entry\n");
-
+
#-res_init(); # reinit the resolver so DNS changes take affect
1;
} else {
@@ -417,7 +417,7 @@ sub read_all_conf {
add2hash($netc, read_conf("$prefix/etc/sysconfig/network")) if -r "$prefix/etc/sysconfig/network";
add2hash($netc, read_resolv_conf("$prefix/etc/resolv.conf")) if -r "$prefix/etc/resolv.conf";
foreach (all("$prefix/etc/sysconfig/network-scripts")) {
- if (/ifcfg-(\w+)/ && $1 ne 'lo' && $1 !~ /ppp/) {
+ if (/ifcfg-(\w+)/ && $1 ne 'lo') {
my $intf = findIntf($intf, $1);
add2hash($intf, { getVarsFromSh("$prefix/etc/sysconfig/network-scripts/$_") });
}