blob: 88f0571c55992a0c939d784fee049f5fca3dce96 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
package network::adsl; # $Id: adsl.pm 219797 2007-05-25 15:39:46Z blino $
use lib qw(/usr/lib/libDrakX); # helps perl_checker
use common;
use run_program;
use network::tools;
use modules;
sub adsl_probe_info {
my ($net) = @_;
my $pppoe_file = "$::prefix/etc/ppp/pppoe.conf";
my $login;
foreach (qw(/etc/ppp/peers/ppp0 /etc/ppp/options /etc/ppp/options.adsl)) {
($login) = map { if_(/^user\s+"([^"]+)"/, $1) } cat_("$::prefix/$_") if !$login && -r "$::prefix/$_";
}
my %pppoe_conf = -f $pppoe_file && getVarsFromSh($pppoe_file);
$login = $pppoe_conf{USER} if !$login || $net->{adsl}{method} eq 'pppoe';
my $passwd = network::tools::passwd_by_login($login);
if (!$net->{adsl}{vpi} && !$net->{adsl}{vci}) {
foreach (cat_("$::prefix/etc/ppp/peers/ppp0")) {
if (/^.*-vpi\s+(\d+)\s+-vci\s+(\d+)/ || /^plugin pppoatm.so (\d+)\.(\d+)$/) {
($net->{adsl}{vpi}, $net->{adsl}{vci}) = ($1, $2);
last;
}
}
}
$pppoe_conf{DNS1} ||= '';
$pppoe_conf{DNS2} ||= '';
add2hash($net->{resolv}, { dnsServer2 => $pppoe_conf{DNS1}, dnsServer3 => $pppoe_conf{DNS2}, DOMAINNAME2 => '' });
add2hash($net->{adsl}, { login => $login, passwd => $passwd });
}
sub adsl_conf_backend {
my ($in, $net) = @_;
require network::connection::xdsl;
my $xdsl = network::connection::xdsl->new(
$net->{adsl}{method} eq "capi" ?
$net->{adsl}{capi_card} :
{ driver => $net->{adsl}{driver}, ethernet_device => $net->{adsl}{ethernet_device} });
$xdsl->{protocol} = $net->{adsl}{method};
$xdsl->{access}{login} = $net->{adsl}{login};
$xdsl->{access}{password} = $net->{adsl}{passwd};
$xdsl->{access}{vpi} = $net->{adsl}{vpi};
$xdsl->{access}{vci} = $net->{adsl}{vci};
$xdsl->install_packages($in);
$xdsl->unload_connection;
$xdsl->write_settings($net);
$xdsl->prepare_connection;
}
1;
|