summaryrefslogtreecommitdiffstats
path: root/perl-install/network/modem.pm
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2004-02-23 08:24:58 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2004-02-23 08:24:58 +0000
commit5e76a83856dc7ce75649fb762b9d2769f8168fa1 (patch)
tree46f8736755b85846ed16fb78be94e2c7c47d6e72 /perl-install/network/modem.pm
parent7db6bc377f0c7da399e4ea3b5e0f018b14a4302b (diff)
downloaddrakx-5e76a83856dc7ce75649fb762b9d2769f8168fa1.tar
drakx-5e76a83856dc7ce75649fb762b9d2769f8168fa1.tar.gz
drakx-5e76a83856dc7ce75649fb762b9d2769f8168fa1.tar.bz2
drakx-5e76a83856dc7ce75649fb762b9d2769f8168fa1.tar.xz
drakx-5e76a83856dc7ce75649fb762b9d2769f8168fa1.zip
split kppp config reading into network::modem::ppp_read_conf() in order to be
shared with manage interface
Diffstat (limited to 'perl-install/network/modem.pm')
-rw-r--r--perl-install/network/modem.pm35
1 files changed, 35 insertions, 0 deletions
diff --git a/perl-install/network/modem.pm b/perl-install/network/modem.pm
index dbeefe318..9b970e4d6 100644
--- a/perl-install/network/modem.pm
+++ b/perl-install/network/modem.pm
@@ -8,6 +8,41 @@ use detect_devices;
use mouse;
use network::tools;
+sub first_modem {
+ my ($netc) = @_;
+ first(grep { $_->{device} =~ m!^/dev! } values %{$netc->{autodetect}{modem}});
+}
+
+
+sub ppp_read_conf {
+ my ($netcnx, $netc) = @_;
+ my $modem = $netcnx->{$netcnx->{type}} ||= {};
+ $modem->{device} ||= first_modem($netc)->{device};
+ my %l = getVarsFromSh("$::prefix/usr/share/config/kppprc");
+ $l{Authentication} = 4 if !exists $l{Authentication};
+ $modem->{$_} ||= $l{$_} foreach qw(Authentication Gateway IPAddr SubnetMask);
+ $modem->{connection} ||= $l{Name};
+ $modem->{domain} ||= $l{Domain};
+ ($modem->{dns1}, $modem->{dns2}) = split(',', $l{DNS});
+
+ foreach (cat_("/etc/sysconfig/network-scripts/chat-ppp0")) {
+ /.*ATDT(\d*)/ and $modem->{phone} ||= $1;
+ }
+ foreach (cat_("/etc/sysconfig/network-scripts/ifcfg-ppp0")) {
+ /NAME=(['"]?)(.*)\1/ and $modem->{login} ||= $2;
+ }
+ $modem->{login} ||= $l{Username};
+ my $secret = network::tools::read_secret_backend();
+ foreach (@$secret) {
+ $modem->{passwd} ||= $_->{passwd} if $_->{login} eq $modem->{login};
+ }
+ #my $secret = network::tools::read_secret_backend();
+ #my @cnx_list = map { $_->{server} } @$secret;
+ $modem->{$_} ||= '' foreach qw(connection phone login passwd auth domain dns1 dns2);
+ $modem->{auto_gateway} ||= $modem->{Gateway} ne '0.0.0.0' ? N("Manual") : N("Automatic");
+ $modem->{auto_ip} ||= $modem->{IPAdddr} ne '0.0.0.0' ? N("Manual") : N("Automatic");
+ $modem->{auto_dns} ||= defined $modem->{dns1} || defined $modem->{dns2} ? N("Manual") : N("Automatic");
+}
#-----modem conf
sub ppp_configure {