diff options
author | Nicolas Lécureuil <nlecureuil@mandriva.com> | 2011-08-30 13:16:42 +0000 |
---|---|---|
committer | Nicolas Lécureuil <nlecureuil@mandriva.com> | 2011-08-30 13:16:42 +0000 |
commit | c590a4a7c162d1a81dbf02ca2e174384af0385bb (patch) | |
tree | 7e1279550b8e48add99b7b41281d27d249d279f3 /lib/network/connection | |
parent | 39d2ee13572a6dc634c0c454dfc43e0297483279 (diff) | |
download | drakx-net-c590a4a7c162d1a81dbf02ca2e174384af0385bb.tar drakx-net-c590a4a7c162d1a81dbf02ca2e174384af0385bb.tar.gz drakx-net-c590a4a7c162d1a81dbf02ca2e174384af0385bb.tar.bz2 drakx-net-c590a4a7c162d1a81dbf02ca2e174384af0385bb.tar.xz drakx-net-c590a4a7c162d1a81dbf02ca2e174384af0385bb.zip |
Create 2010.1 branch for drakx-net
Diffstat (limited to 'lib/network/connection')
-rw-r--r-- | lib/network/connection/.perl_checker | 1 | ||||
-rw-r--r-- | lib/network/connection/cable.pm | 74 | ||||
-rw-r--r-- | lib/network/connection/cellular.pm | 99 | ||||
-rw-r--r-- | lib/network/connection/cellular_bluetooth.pm | 103 | ||||
-rw-r--r-- | lib/network/connection/cellular_card.pm | 278 | ||||
-rw-r--r-- | lib/network/connection/dvb.pm | 70 | ||||
-rw-r--r-- | lib/network/connection/ethernet.pm | 552 | ||||
-rw-r--r-- | lib/network/connection/isdn.pm | 230 | ||||
-rw-r--r-- | lib/network/connection/isdn/consts.pm | 460 | ||||
-rw-r--r-- | lib/network/connection/pots.pm | 133 | ||||
-rw-r--r-- | lib/network/connection/ppp.pm | 150 | ||||
-rw-r--r-- | lib/network/connection/providers/cellular.pm | 183 | ||||
-rw-r--r-- | lib/network/connection/providers/cellular_extra.pm | 2284 | ||||
-rw-r--r-- | lib/network/connection/providers/xdsl.pm | 1352 | ||||
-rw-r--r-- | lib/network/connection/wireless.pm | 1132 | ||||
-rw-r--r-- | lib/network/connection/xdsl.pm | 412 |
16 files changed, 7513 insertions, 0 deletions
diff --git a/lib/network/connection/.perl_checker b/lib/network/connection/.perl_checker new file mode 100644 index 0000000..80deab8 --- /dev/null +++ b/lib/network/connection/.perl_checker @@ -0,0 +1 @@ +Basedir ../../.. diff --git a/lib/network/connection/cable.pm b/lib/network/connection/cable.pm new file mode 100644 index 0000000..a81ae06 --- /dev/null +++ b/lib/network/connection/cable.pm @@ -0,0 +1,74 @@ +package network::connection::cable; + +use base qw(network::connection::ethernet); + +use strict; +use common; +use modules; +use detect_devices; + +sub get_type_name() { N("Cable") } +sub get_type_description() { N("Cable modem") } +sub _get_type_icon() { 'cablemodem' } +sub get_metric { 20 } + +sub handles_ifcfg { + my ($_class, $_ifcfg) = @_; + 0; +} + +my $bpalogin_file = '/etc/bpalogin.conf'; + +sub guess_protocol { + my ($self) = @_; + $self->{protocol} = 'dhcp'; +} + +sub guess_access_settings { + my ($self) = @_; + $self->{access}{use_bpalogin} = -e $::prefix . $bpalogin_file; + if ($self->{access}{use_bpalogin}) { + foreach (cat_($::prefix . $bpalogin_file)) { + /^username (.*)/ and $self->{access}{login} = $1; + /^password (.*)/ and $self->{access}{password} = $1; + } + } +} + +sub get_access_settings { + my ($self) = @_; + my %auth = ( + 0 => N("None"), + 1 => N("Use BPALogin (needed for Telstra)"), + ); + [ + { label => N("Authentication"), type => "list", val => \$self->{access}{use_bpalogin}, + list => [ sort keys %auth ], format => sub { $auth{$_[0]} } }, + { label => N("Account Login (user name)"), val => \$self->{access}{login}, + disabled => sub { !$self->{access}{use_bpalogin} } }, + { label => N("Account Password"), val => \$self->{access}{password}, hidden => 1, + disabled => sub { !$self->{access}{use_bpalogin} } }, + ]; +} + +sub write_settings { + my ($self, $o_net, $o_modules_conf) = @_; + if ($self->{access}{use_bpalogin}) { + substInFile { + s/username\s+.*\n/username $self->{access}{login}\n/; + s/password\s+.*\n/password $self->{access}{password}\n/; + } $::prefix . $bpalogin_file; + } + services::set_status("bpalogin", $self->{access}{use_bpalogin}); + $self->SUPER::write_settings($o_net, $o_modules_conf); +} + +sub install_packages { + my ($self, $in) = @_; + if ($self->{access}{use_bpalogin}) { + $in->do_pkgs->ensure_is_installed('bpalogin', '/usr/sbin/bpalogin') or return; + } + $self->SUPER::install_packages($in); +} + +1; diff --git a/lib/network/connection/cellular.pm b/lib/network/connection/cellular.pm new file mode 100644 index 0000000..5bb2259 --- /dev/null +++ b/lib/network/connection/cellular.pm @@ -0,0 +1,99 @@ +package network::connection::cellular; + +use base qw(network::connection::ppp); + +use strict; +use common; + +my $cellular_d = "/etc/sysconfig/network-scripts/cellular.d"; + +sub get_providers { + # manually-defined providers + require network::connection::providers::cellular; + # providers imported from mobile-broadband-provider-info + require network::connection::providers::cellular_extra; + # combine custom providers with m.b.p.i. imported ones, + # filtering out CDMA-only providers which we do not support for now + my %providers = ( + %network::connection::providers::cellular::data, + grep_each{!$::b->{cdma} } %network::connection::providers::cellular_extra::data + ); + (\%providers, '|'); +} + +sub get_cellular_settings_file { + my ($self) = @_; + my $network = $self->get_selected_network or return; + $::prefix . $cellular_d . '/' . $network->{name}; +} + +sub load_cellular_settings { + my ($self) = @_; + my $file = $self->get_cellular_settings_file or return; + -f $file && { getVarsFromSh($file) }; +} + +sub network_is_configured { + my ($self, $_network) = @_; + #- only one network is supported, assume it is configured if settings are available + defined($self->load_cellular_settings); +} + +sub write_cellular_settings { + my ($self) = @_; + my $file = $self->get_cellular_settings_file or return; + setVarsInShMode($file, 0600, { map { (uc($_) => $self->{access}{$_}) } qw(login password apn) }); +} + +sub guess_apn_from_chat { + my ($self) = @_; + my $chat = cat_($::prefix . $self->get_chat_file); + my $chat_apn = $chat =~ /\bAT\+CGDCONT=\d+,"IP","([^"]+)"/ && $1; +} + +sub guess_provider_settings { + my ($self) = @_; + my $settings = $self->load_cellular_settings; + my $apn = $settings && $settings->{APN} || $self->guess_apn_from_chat; + if ($apn) { + my @providers_data = $self->get_providers; + $self->{provider_name} ||= find { $providers_data[0]{$_}{apn} eq $apn } keys %{$providers_data[0]}; + return; + } + $self->SUPER::guess_provider_settings; +} + +sub guess_access_settings { + my ($self, $o_provider_only) = @_; + my $settings = !$o_provider_only && $self->load_cellular_settings || {}; + $self->{access}{$_} = $settings->{uc($_)} || $self->{provider}{$_} foreach qw(login password apn); +} + +sub get_access_settings { + my ($self) = @_; + [ + { label => N("Access Point Name"), val => \$self->{access}{apn} }, + @{$self->SUPER::get_access_settings}, + ]; +} + +sub set_ppp_settings { + my ($self) = @_; + $self->{access}{use_chat} = 1; + $self->{access}{dial_number} = !$self->{access}{no_dial} && "*99***$self->{access}{cid}#"; +} + +sub write_settings { + my ($self) = @_; + $self->write_cellular_settings; + $self->set_ppp_settings; + $self->SUPER::write_settings; +} + +sub apply_network_selection { + my ($self) = @_; + $self->set_ppp_settings; + $self->write_ppp_settings; +} + +1; diff --git a/lib/network/connection/cellular_bluetooth.pm b/lib/network/connection/cellular_bluetooth.pm new file mode 100644 index 0000000..5c99b63 --- /dev/null +++ b/lib/network/connection/cellular_bluetooth.pm @@ -0,0 +1,103 @@ +package network::connection::cellular_bluetooth; + +use base qw(network::connection::cellular); + +use strict; +use common; + +my $rfcomm_dev_prefix = "/dev/rfcomm"; + +sub get_type_name { N("Bluetooth") } +sub get_type_description { N("Bluetooth Dial Up Networking") } +sub _get_type_icon { 'bluetooth' } +sub get_devices { + my ($_class, %options) = @_; + ($options{fast_only} ? () : search_services('DUN')); +} + +sub get_metric { 45 } +sub get_interface { "ppp0" } + +sub get_packages { 'bluez', 'ppp' } + +sub get_rfcomm_device { + my ($self) = @_; + $self->{rfcomm_device} ||= find { ! -e ($rfcomm_dev_prefix . $_) } 0 .. 99; +} + +sub get_tty_device { + my ($self) = @_; + $rfcomm_dev_prefix . $self->get_rfcomm_device; +} + +# http://www.hingston.demon.co.uk/mike/nokia6680.html +# http://kapsi.fi/~mcfrisk/linux_gprs.html +# GPRS specific commands http://www.phonestar.com.my/s_at_10.html + +sub search_services { + my ($service_type) = @_; + my (@services); + my $service = {}; + my ($key, $value); + my $push_service = sub { push @services, $service if exists $service->{class} }; + my $use_key = sub { $key = $_[0]; undef $value }; + foreach (run_program::rooted_get_stdout($::prefix, 'sdptool', 'search', $service_type)) { + if (/^Searching for $service_type on (.+) \.\.\.$/) { + $push_service->(); + $service = { addr => $1 }; + } elsif (/^Service Name:\s+(.*)$/) { + $service->{name} = $1; + } elsif (/^Service Provider:\s+(.*)$/) { + $service->{name} = $1; + } elsif (/^\s*Channel:\s*(\d+)$/) { + $service->{channel} = $1; + } elsif (/^Service Class ID List/) { + $use_key->('class'); + } else { + $value = chomp_($_); + } + if ($key && $value) { + $service->{$key} = $value; + $use_key->(undef); + } + } + $push_service->(); + my %names; + foreach (@services) { + $names{$_->{addr}} ||= chomp_(run_program::rooted_get_stdout($::prefix, 'hcitool', 'name', $_->{addr})); + $_->{description} = $names{$_->{addr}}; + } + @services; +} + +sub set_ppp_settings { + my ($self) = @_; + + $self->{access}{cid} = 1; + $self->{access}{at_commands} = [ qq(AT+CGDCONT=$self->{access}{cid},"IP","$self->{access}{apn}") ]; + + $self->SUPER::set_ppp_settings; +} + +sub write_settings { + my ($self) = @_; + + my $dev = $self->get_rfcomm_device; + output("$::prefix/etc/bluetooth/rfcomm.conf", qq( +rfcomm$dev { + bind yes; + device $self->{device}{addr}; + channel $self->{device}{channel}; + comment "Dial-up networking"; +} +)); + + $self->SUPER::write_settings; +} + +sub prepare_connection { + my ($self) = @_; + run_program::rooted_get_stdout($::prefix, 'rfcomm', 'bind', $self->get_rfcomm_device); +} + +1; diff --git a/lib/network/connection/cellular_card.pm b/lib/network/connection/cellular_card.pm new file mode 100644 index 0000000..0fc3fbf --- /dev/null +++ b/lib/network/connection/cellular_card.pm @@ -0,0 +1,278 @@ +package network::connection::cellular_card; + +use base qw(network::connection::cellular); + +use strict; +use common; + +my $wrong_pin_error = N_("Wrong PIN number format: it should be 4 digits."); + +sub get_type_name() { N("GPRS/Edge/3G") } +sub _get_type_icon() { 'cellular' } +sub get_devices() { + require detect_devices; + my @maybe_usbserial_modules = ('usbserial_generic', 'unknown'); + my @serial = grep { $_->{description} =~ /GPRS|EDGE|3G|UMTS|H.DPA|CDMA/i } detect_devices::matching_driver('serial_cs', 'usbserial', @maybe_usbserial_modules); + member($_->{driver}, @maybe_usbserial_modules) and $_->{driver} = 'usbserial' foreach @serial; + #- cdc_acm can not be listed directly in network/cellular, it is already in network/isdn + @serial, detect_devices::probe_category('network/cellular'), detect_devices::matching_driver('cdc_acm'); +} +sub get_metric { 40 } + +sub get_packages { 'comgt', 'ppp' } + +sub handles_ifcfg { + my ($_class, $ifcfg) = @_; + exists $ifcfg->{CELLULAR_CID}; +} + +my @thirdparty_settings = ( + { + name => 'nozomi', + description => 'Option GlobeTrotter 3G/EDGE and FUSION+', + url => 'http://www.pharscape.org/', + kernel_module => 1, + }, + { + name => 'hso', + description => 'Option High Speed Mobile Devices', + url => 'http://www.pharscape.org/', + kernel_module => 1, + tools => { + package => 'hso-rezero', + test_file => '/usr/sbin/rezero', + }, + }, +); + +sub get_thirdparty_settings() { + \@thirdparty_settings; +} + +sub guess_hardware_settings { + my ($self) = @_; + $self->{hardware}{pin} ||= chomp_(cat_("/etc/sysconfig/network-scripts/pin-" . $self->get_interface)); +} + +sub get_interface { + my ($self) = @_; + $self->get_driver eq "hso" ? + "hso0" : + "ppp0"; +} + +sub get_tty_device { + my ($self) = @_; + + my $tty_interface = 0; + my %udev_env = map { if_(/^([^=]*)=(.*)$/, $1 => $2) } chomp_(run_program::get_stdout("udevadm info --query=property --path=$self->{device}{sysfs_device}")); + + if ($udev_env{USB_MODEM_INTERFACE}) { + my $dev_sys_path = $self->{device}->{sysfs_device}; + my $cfg = chomp_(cat_($dev_sys_path . "/bConfigurationValue")); + my $tty_usb = basename(glob_("$dev_sys_path/" . + $self->{device}->{pci_bus} . "-" . + ($self->{device}->{usb_port} + 1) . ":$cfg." . + $udev_env{USB_MODEM_INTERFACE} . "/ttyUSB*")); + if ($tty_usb) { + $tty_usb =~ s/ttyUSB//; + $tty_interface = $tty_usb; + } + } else { + # if no usb interface for tty port given, use first one + my @intfs = glob_("$self->{device}->{sysfs_device}/" . + $self->{device}->{pci_bus} . "-" . + ($self->{device}->{usb_port} + 1) . ":*"); + foreach (@intfs) { + my $tty_usb = basename(glob_("$_/tty*")); + if ($tty_usb) { + $tty_usb =~ s/tty[a-zA-Z]*//; + $tty_interface = $tty_usb; + last; + } + } + } + + $self->{device}{device} ? + "/dev/" . $self->{device}{device} : + $self->get_driver eq "nozomi" ? + "/dev/noz" . $tty_interface : + $self->get_driver eq "cdc_acm" ? + "/dev/ttyACM" . $tty_interface : + $self->get_driver eq "hso" ? + "/dev/ttyHS" . $tty_interface : + "/dev/ttyUSB" . $tty_interface; +} + +sub get_control_device { + my ($self) = @_; + my $tty_device = $self->get_tty_device; + if ($tty_device eq "/dev/ttyUSB0") { + for my $id (2, 1) { + my $usb_control_device = "/dev/ttyUSB" . $id; + return $usb_control_device if -e $usb_control_device; + } + } + $tty_device; +} + +sub network_scan_is_slow() { 1 } +sub check_hardware_is_slow() { 1 } +sub has_unique_network() { 1 } + +sub get_networks { + my ($self) = @_; + my $cmd = 'comgt -d ' . $self->get_control_device; + my ($network, $state) = `$cmd reg` =~ /^Registered on \w+ network: "(.*)",(\d+)$/m; + my ($strength) = `$cmd sig` =~ /^Signal Quality:\s+(\d+),\d+$/; + $self->probed_networks; + $self->{networks} = $network && { + $network => { + name => $network, + signal_strength => $strength * 5, + current => $state == 2, + } + }; +} + +sub get_hardware_settings { + my ($self) = @_; + [ { label => N("PIN number (4 digits). Leave empty if PIN is not required."), val => \$self->{hardware}{pin}, hidden => 1 } ]; +} + +sub check_hardware_settings { + my ($self) = @_; + if ($self->{hardware}{pin} !~ /(^$|^[0-9]{4}$)/) { + $self->{hardware}{error} = translate($wrong_pin_error); + return 0; + } + 1; +} + +sub get_peer_default_options { + my ($self) = @_; + $self->SUPER::get_peer_default_options, + "noccp", # disable CCP to avoid warning messages + "debug"; +} + +sub build_peer { + my ($self) = @_; + $self->SUPER::build_peer; + #- don't run comgt for now, it hangs on ttyUSB0 devices when run from pppd + #- $self->{access}{peer}->{init} = "comgt -d $dev < $pin_file" +} + +sub set_ppp_settings { + my ($self) = @_; + $self->{access}{no_dial} = $self->get_driver eq "hso"; + $self->{access}{cid} = 3; + + $self->{access}{at_commands} = [ + "AT+CPIN?", + # Set +CGEE to 2 + "AT+CMEE=2", + qq(AT+CGDCONT=$self->{access}{cid},"IP","$self->{access}{apn}"), + # Setup +CGEQREG (QoS, don't set it for now) + # qq(AT+CGEQREQ=3,3,64,384,0,0,2,0,"0E0","0E0",3,0,0), + # Attached to network, will return 1 + "AT+CGATT?", + if_($self->get_driver eq "hso", ""), + ]; + + $self->SUPER::set_ppp_settings; +} + +sub write_settings { + my ($self) = @_; + + my $interface = $self->get_interface; + my $pin_file = "/etc/sysconfig/network-scripts/pin-$interface"; + output_with_perm($pin_file, 0600, $self->{hardware}{pin} . "\n"); + + $self->SUPER::write_settings; +} + +sub prepare_device { + my ($self) = @_; + + my $driver = $self->get_driver; + require modules; + my $modules_conf = ref($::o) && $::o->{modules_conf} || modules::any_conf->read; + modules::load_and_configure($modules_conf, $driver, + if_($driver eq 'usbserial', join( + ' ', + "vendor=0x" . sprintf("%04x", $self->{device}{vendor}), + "product=0x" . sprintf("%04x", $self->{device}{id})))); + $modules_conf->write if !ref $::o; + sleep 2 if $driver eq 'usbserial'; +} + +sub check_device { + my ($self) = @_; + + my $dev = $self->get_tty_device; + if (! -e $dev) { + $self->{device}{error} = N("Unable to open device %s", $dev); + return; + } + + 1; +} + +sub check_hardware { + my ($self) = @_; + to_bool(run_program::rooted($::prefix, 'comgt', '>', '/dev/null', '-d', $self->get_control_device, 'PIN')); +} + +sub configure_hardware { + my ($self) = @_; + + my $device_ready = 0; + + require IPC::Open2; + require IO::Select; + require c; + use POSIX qw(:errno_h); + + my $pid = IPC::Open2::open2(my $cmd_out, my $cmd_in, 'comgt', '-d', $self->get_control_device); + common::nonblock($cmd_out); + my $selector = IO::Select->new($cmd_out); + my $already_entered_pin; + + while ($selector->can_read) { + local $_; + my $rv = sysread($cmd_out, $_, 512); + $rv == 0 and $selector->remove($cmd_out); + if (/^\s*\*\*\*SIM ERROR\*\*\*/m) { + $self->{hardware}{error} = N("Please check that your SIM card is inserted."); + last; + } elsif (/^Enter PIN number:/m) { + $self->{hardware}{pin} or last; + if ($already_entered_pin) { + $self->{hardware}{error} = translate($wrong_pin_error); + last; + } + $already_entered_pin = 1; + print $cmd_in $self->{hardware}{pin} . "\n"; + } elsif (/^ERROR entering PIN/m) { + $self->{hardware}{error} = N("You entered a wrong PIN code. +Entering the wrong PIN code multiple times may lock your SIM card!"); + last; + } elsif (/^Waiting for Registration/m) { + #- the card seems to be reset if comgt is killed right here, wait a bit + sleep 1; + #- don't wait the full scan + $device_ready = 1; + last; + } + } + kill 'TERM', $pid; + close($cmd_out); + close($cmd_in); + waitpid($pid, 0); + + $device_ready; +} + +1; diff --git a/lib/network/connection/dvb.pm b/lib/network/connection/dvb.pm new file mode 100644 index 0000000..c5f8ff6 --- /dev/null +++ b/lib/network/connection/dvb.pm @@ -0,0 +1,70 @@ +package network::connection::dvb; + +use base qw(network::connection::ethernet); + +use strict; +use common; +use modules; + +sub get_type_name() { N("DVB") } +sub get_type_description() { N("Satellite (DVB)") } +sub _get_type_icon() { 'dvb' } + +sub get_devices() { + require detect_devices; + detect_devices::probe_category("multimedia/dvb"); +} + +sub get_metric { 15 } + +sub handles_ifcfg { + my ($_class, $ifcfg) = @_; + exists $ifcfg->{DVB_ADAPTER_ID}; +} + +sub get_interface { + my ($self) = @_; + defined $self->{hardware}{adapter_id} && defined $self->{hardware}{network_demux} or return "dvb"; + 'dvb' . $self->{hardware}{adapter_id} . '_' . $self->{hardware}{network_demux}; +} + +sub get_dvb_device { + find { sysopen(undef, $_, c::O_RDWR() | c::O_NONBLOCK()) } glob("/dev/dvb/adapter*/net*"); +} + +sub load_interface_settings { + my ($self) = @_; + $self->guess_hardware_settings; #- so that matching interface settings can be loaded + $self->network::connection::load_interface_settings; + $self->{hardware}{adapter_id} = $self->{ifcfg}{DVB_ADAPTER_ID}; + $self->{hardware}{network_demux} = $self->{ifcfg}{DVB_NETWORK_DEMUX}; + $self->{hardware}{network_pid} = $self->{ifcfg}{DVB_NETWORK_PID}; +} + +sub guess_hardware_settings { + my ($self) = @_; + my $device = get_dvb_device() or return; + ($self->{hardware}{adapter_id}, $self->{hardware}{network_demux}) = $device =~ m,/dev/dvb/adapter(\d+)/net(\d+),; +} + +sub get_hardware_settings { + my ($self) = @_; + [ + { label => N("Adapter card"), val => \$self->{hardware}{adapter_id} }, + { label => N("Net demux"), val => \$self->{hardware}{network_demux} }, + { label => N("PID"), val => \$self->{hardware}{network_pid} }, + ]; +} + +sub build_ifcfg_settings { + my ($self) = @_; + my $settings = { + DVB_ADAPTER_ID => qq("$self->{hardware}{adapter_id}"), + DVB_NETWORK_DEMUX => qq("$self->{hardware}{network_demux}"), + DVB_NETWORK_PID => qq("$self->{hardware}{network_pid}"), + MII_NOT_SUPPORTED => "yes", + }; + $self->SUPER::build_ifcfg_settings($settings); +} + +1; diff --git a/lib/network/connection/ethernet.pm b/lib/network/connection/ethernet.pm new file mode 100644 index 0000000..7b76396 --- /dev/null +++ b/lib/network/connection/ethernet.pm @@ -0,0 +1,552 @@ +package network::connection::ethernet; # $Id: ethernet.pm 147431 2007-03-21 17:06:09Z blino $ + +use base qw(network::connection); + +use strict; +use common; +use network::tools; + +our @dhcp_clients = qw(dhclient dhcpcd pump dhcpxd); + +sub get_type_name() { N("Ethernet") } +sub get_type_description() { N("Wired (Ethernet)") } +sub _get_type_icon() { 'ethernet' } + +sub get_devices() { + #require list_modules; + #- FIXME: try to use list_modules::ethernet_categories() (but remove wireless stuff) + require detect_devices; + my @devices = detect_devices::probe_category('network/main|gigabit|pcmcia|tokenring|usb|firewire'); + my @lan = grep { detect_devices::is_lan_interface($_) && !detect_devices::is_wireless_interface($_) } detect_devices::get_all_net_devices(); + @devices, get_unlisted_devices(\@lan, \@devices); +} + +sub get_unlisted_devices { + my ($interfaces, $listed_devices) = @_; + my @unlisted_interfaces = sort(difference2($interfaces, [ map { device_to_interface($_) } @$listed_devices ])); + map { + my %device = %{interface_to_device($_) || +{ description => $_ }}; + $device{interface} = $_; + $device{description} = N("Virtual interface") if network::tools::is_virtual_interface($_); + \%device; + } @unlisted_interfaces; +} + +sub handles_ifcfg { + my ($_class, $ifcfg) = @_; + require detect_devices; + detect_devices::is_lan_interface($ifcfg->{DEVICE}); +} + +sub is_gigabit { + my ($self) = @_; + require list_modules; + member($self->get_driver, list_modules::category2modules('network/gigabit')); +} + +sub get_metric { + my ($self) = @_; + $self->is_gigabit ? 5 : 10; +} + +sub get_interface { + my ($self) = @_; + $self->{device}{interface} ||= device_to_interface($self->{device}); +} + +sub check_device { + my ($self) = @_; + if (!$self->get_interface) { + $self->{device}{error} = N("Unable to find network interface for selected device (using %s driver).", $self->get_driver); + return 0; + } + return 1; +} + +sub get_protocols() { + my $system_file = '/etc/sysconfig/drakx-net'; + my %global_settings = getVarsFromSh($system_file); + +{ + if_(!text2bool($global_settings{AUTOMATIC_ADDRESS}), static => N("Manual configuration")), + dhcp => N("Automatic IP (BOOTP/DHCP)"), + }; +} + +sub load_interface_settings { + my ($self) = @_; + + $self->network::connection::load_interface_settings; + $self->map_ifcfg2config_settings; +} + +sub map_ifcfg2config_settings { + my ($self) = @_; + $self->{protocol} = $self->{ifcfg}{BOOTPROTO}; + + $self->{address}{needhostname} = $self->get_ifcfg_bool('NEEDHOSTNAME'); + $self->{address}{peerdns} = $self->get_ifcfg_bool('PEERDNS'); + $self->{address}{peeryp} = $self->get_ifcfg_bool('PEERYP'); + $self->{address}{peerntpd} = $self->get_ifcfg_bool('PEERNTPD'); + + $self->{address}{dhcp_client} = $self->{ifcfg}{DHCP_CLIENT}; + $self->{address}{dhcp_hostname} = $self->{ifcfg}{DHCP_HOSTNAME}; + $self->{address}{dhcp_timeout} = $self->{ifcfg}{DHCP_TIMEOUT}; + $self->{address}{ip_address} = $self->{ifcfg}{IPADDR}; + $self->{address}{netmask} = $self->{ifcfg}{NETMASK}; + $self->{address}{gateway} = $self->{ifcfg}{GATEWAY}; + $self->{address}{dns1} = $self->{ifcfg}{DNS1} || $self->{ifcfg}{MS_DNS1}; + $self->{address}{dns2} = $self->{ifcfg}{DNS2} || $self->{ifcfg}{MS_DNS2}; + $self->{address}{domain} = $self->{ifcfg}{DOMAIN}; + + my $blacklist_ifplugd = $self->get_ifcfg_bool('MII_NOT_SUPPORTED'); + $self->{control}{use_ifplugd} = !$blacklist_ifplugd if defined $blacklist_ifplugd; + $self->{control}{ipv6_tunnel} = $self->get_ifcfg_bool('IPV6TO4INIT'); +} + +sub guess_protocol { + my ($self) = @_; + $self->{protocol} ||= 'dhcp'; +} + +sub guess_address_settings { + my ($self) = @_; + $self->{address}{dhcp_client} ||= find { -x "$::prefix/sbin/$_" } @dhcp_clients; + $self->{address}{peerdns} = 1 if !defined $self->{address}{peerdns}; + $self->{address}{peeryp} = 1 if !defined $self->{address}{peeryp}; + $self->supplement_address_settings; +} + +sub supplement_address_settings { + my ($self) = @_; + if ($self->{protocol} eq 'static' && network::network::is_ip($self->{address}{ip_address})) { + require network::network; + $self->{address}{netmask} ||= network::network::netmask($self->{address}{ip_address}); + # Bug #28033: don't guess default gateway and ns in static interfaces if + # user doesn't set one (otherwise we'll mess multi-interface systems) + # + #$self->{address}{gateway} ||= network::network::gateway($self->{address}{ip_address}); + #$self->{address}{dns1} ||= network::network::dns($self->{address}{ip_address}); + } +} + +sub get_address_settings_label { N("IP settings") } + +sub get_address_settings { + my ($self, $o_show_all) = @_; + my $auto_dns = sub { $self->{protocol} eq 'dhcp' && $self->{address}{peerdns} }; + my $not_static = sub { $self->{protocol} ne 'static' }; + my $not_dhcp = sub { $self->{protocol} ne 'dhcp' }; + [ + if_($self->{protocol} eq 'static' || $o_show_all, + { label => N("IP address"), val => \$self->{address}{ip_address}, disabled => $not_static, + focus_out => sub { + $self->supplement_address_settings if $self->can('supplement_address_settings'); + }, + help => N("Please enter the IP configuration for this machine. +Each item should be entered as an IP address in dotted-decimal +notation (for example, 1.2.3.4).") }, + { label => N("Netmask"), val => \$self->{address}{netmask}, disabled => $not_static }, + { label => N("Gateway"), val => \$self->{address}{gateway}, disabled => $not_static }, + ), + if_($self->{protocol} eq 'dhcp' || $o_show_all, + { text => N("Get DNS servers from DHCP"), val => \$self->{address}{peerdns}, type => "bool", disabled => $not_dhcp }, + ), + { label => N("DNS server 1"), val => \$self->{address}{dns1}, disabled => $auto_dns }, + { label => N("DNS server 2"), val => \$self->{address}{dns2}, disabled => $auto_dns }, + { label => N("Search domain"), val => \$self->{address}{domain}, disabled => $auto_dns, advanced => 1, + help => N("By default search domain will be set from the fully-qualified host name") }, + if_($self->{protocol} eq 'dhcp', + { label => N("DHCP client"), val => \$self->{address}{dhcp_client}, list => \@dhcp_clients, advanced => 1 }, + { label => N("DHCP timeout (in seconds)"), val => \$self->{address}{dhcp_timeout}, advanced => 1 }, + { text => N("Get YP servers from DHCP"), val => \$self->{address}{peeryp}, type => "bool", advanced => 1 }, + { text => N("Get NTPD servers from DHCP"), val => \$self->{address}{peerntpd}, type => "bool", advanced => 1 }, + { label => N("DHCP host name"), val => \$self->{address}{dhcp_hostname}, advanced => 1 }, + #- FIXME: install zcip if not checked + if_(0, { text => N("Do not fallback to Zeroconf (169.254.0.0 network)"), type => "bool", val => \$self->{address}{skip_zeroconf}, advanced => 1 }), + ), + ]; +} + +sub check_address_settings { + my ($self, $net) = @_; + + if ($self->{protocol} eq 'static') { + require network::network; + if (!network::network::is_ip($self->{address}{ip_address})) { + $self->{address}{error}{message} = N("IP address should be in format 1.2.3.4"); + $self->{address}{error}{field} = \$self->{address}{ip_address}; + return 0; + } + if (!network::network::is_ip($self->{address}{netmask})) { + $self->{address}{error}{message} = N("Netmask should be in format 255.255.224.0"); + $self->{address}{error}{field} = \$self->{address}{netmask}; + return 0; + } + if (network::network::is_ip_forbidden($self->{address}{ip_address})) { + $self->{address}{error}{message} = N("Warning: IP address %s is usually reserved!", $self->{address}{ip_address}); + $self->{address}{error}{field} = \$self->{address}{ip_address}; + return 0; + } + #- test if IP address is already used + if (my $conflict = find { text2bool($_->{ONBOOT}) && $_->{DEVICE} ne $self->get_interface && $_->{IPADDR} eq $self->{address}{ip_address} } values %{$net->{ifcfg}} ) { + # find out what connection we are conflicting with + my $conflict_device = $conflict->{DEVICE}; + + $self->{address}{error}{message} = N("%s is already used by a connection that starts on boot (%s). To use this address with this connection, first disable all other devices which use it, or configure them not to start at boot", $self->{address}{ip_address}, $conflict_device); + $self->{address}{error}{field} = \$self->{address}{ip_address}; + return 0; + } + } + + return 1; +} + +sub guess_hostname_settings { + my ($self) = @_; + $self->{address}{needhostname} = 0 if !defined $self->{address}{needhostname}; + if (!defined $self->{address}{hostname}) { + require network::network; + my $network = network::network::read_conf($::prefix . $network::network::network_file); + $self->{address}{hostname} = $network->{HOSTNAME}; + } +} + +# FIXME: add in drakroam/netcenter +sub get_hostname_settings { + my ($self) = @_; + my $auto_hostname = sub { $self->{protocol} eq 'dhcp' && $self->{address}{needhostname} }; + # configure the default hostname so the hostname setting should be more obvious to the users + $self->{address}{hostname} = 'localhost.localdomain' unless $self->{address}{hostname}; + [ + if_($self->{protocol} eq 'dhcp', + { text => N("Assign host name from DHCP server (or generate a unique one)"), val => \$self->{address}{needhostname}, type => "bool", + help => N("This will allow the server to attribute a name for this machine. If the server does not provides a valid host name, it will be generated automatically.")}, + ), + { label => N("Host name"), val => \$self->{address}{hostname}, disabled => $auto_hostname, + help => N("You should define a hostname for this machine, which will identify this PC. Note that this hostname will be shared among all network connections. If left blank, 'localhost.localdomain' will be used.")}, + ]; +} + +sub guess_control_settings { + my ($self) = @_; + + $self->network::connection::guess_control_settings($self); + + $self->{control}{onboot} = 1 if !defined $self->{control}{onboot}; + $self->{control}{use_ifplugd} = !is_ifplugd_blacklisted($self->get_driver) + if !defined $self->{control}{use_ifplugd}; +} + +sub get_control_settings { + my ($self) = @_; + [ + @{$self->network::connection::get_control_settings}, + { text => N("Network Hotplugging"), val => \$self->{control}{use_ifplugd}, type => "bool", + #- FIXME: force ifplugd if wireless roaming is enabled + disabled => sub { $self->{control}{force_ifplugd} }, advanced => 1, }, + #- FIXME: $need_network_restart = $ipv6_tunnel ^ text2bool($ethntf->{IPV6TO4INIT}); + { text => N("Enable IPv6 to IPv4 tunnel"), val => \$self->{control}{ipv6_tunnel}, type => "bool", advanced => 1 }, + ]; +} + +sub install_packages { + my ($self, $in) = @_; + if ($self->{protocol} eq 'dhcp') { + install_dhcp_client($in, $self->{address}{dhcp_client}) or return; + } + 1; +} + +sub build_ifcfg_settings { + my ($self, $o_options) = @_; + my $settings = put_in_hash($o_options, { + BOOTPROTO => $self->{protocol}, + IPADDR => $self->{address}{ip_address}, + GATEWAY => $self->{address}{gateway}, + NETMASK => $self->{address}{netmask}, + NEEDHOSTNAME => bool2yesno($self->{address}{needhostname}), + PEERYP => bool2yesno($self->{address}{peeryp}), + PEERDNS => bool2yesno($self->{address}{peerdns}), + RESOLV_MODS => bool2yesno(!$self->{address}{peerdns} && ($self->{address}{dns1} || $self->{address}{dns2})), + PEERNTPD => bool2yesno($self->{address}{peerntpd}), + DHCP_CLIENT => $self->{address}{dhcp_client}, + DHCP_HOSTNAME => $self->{address}{dhcp_hostname}, + DHCP_TIMEOUT => $self->{address}{dhcp_timeout}, + MII_NOT_SUPPORTED => bool2yesno(!$self->{control}{use_ifplugd}), + IPV6INIT => bool2yesno($self->{control}{ipv6_tunnel}), + IPV6TO4INIT => bool2yesno($self->{control}{ipv6_tunnel}), + DNS1 => $self->{address}{dns1}, + DNS2 => $self->{address}{dns2}, + DOMAIN => $self->{address}{domain}, + LINK_DETECTION_DELAY => $self->get_link_detection_delay, + }); + $self->network::connection::build_ifcfg_settings($settings); +} + +sub write_settings { + my ($self, $o_net, $o_modules_conf) = @_; + if ($o_modules_conf) { + $o_modules_conf->set_alias($self->get_interface, $self->get_driver); + if ($self->{device}{sysfs_device}) { + my $modalias = chomp_(cat_($self->{device}{sysfs_device} . "/modalias")); + $o_modules_conf->set_alias($modalias, $self->get_driver) if $modalias; + } + } + $self->SUPER::write_settings($o_net, $o_modules_conf); + # update udev configuration + update_udev_net_config(); +} + +sub get_status_message { + my ($self, $status) = @_; + my $interface = $self->get_interface; + { + link_up => N("Link beat detected on interface %s", $interface), + link_down => N("Link beat lost on interface %s", $interface), + map { ( + "$_->[0]_request" => N("Requesting a network address on interface %s (%s protocol)...", $interface, $_->[1]), + "$_->[0]_success" => N("Got a network address on interface %s (%s protocol)", $interface, $_->[1]), + "$_->[0]_failure" => N("Failed to get a network address on interface %s (%s protocol)", $interface, $_->[1]), + ) } ([ 'dhcp', 'DHCP' ], [ 'zcip', 'ZeroConf' ]), + }->{$status} || $self->network::connection::get_status_message($status); +} + +use c; +use detect_devices; +use common; +use run_program; + +sub install_dhcp_client { + my ($in, $client) = @_; + my %packages = ( + "dhclient" => "dhcp-client", + ); + #- use default dhcp client if none is provided + $client ||= $dhcp_clients[0]; + $client = $packages{$client} if exists $packages{$client}; + $in->do_pkgs->ensure_is_installed($client, undef, 1); +} + +my @hwaddr_fields = qw(pci_domain pci_bus pci_device pci_function); + +sub are_same_HwIDs { + my ($device1, $device2) = @_; + every { $device1->{$_} == $device2->{$_} } @hwaddr_fields; +} + +sub parse_hwaddr { + my ($hw_addr) = @_; + return if !$hw_addr; + my %device; + @device{@hwaddr_fields} = map { hex($_) } ($hw_addr =~ /([0-9a-f]+):([0-9a-f]+):([0-9a-f]+)\.([0-9a-f]+)/); + (every { defined $_ } keys %device) ? \%device : undef; +} + +sub mapIntfToDevice { + my ($interface) = @_; + my $hw_addr = c::getHwIDs($interface); + return {} if $hw_addr =~ /^usb/; + my $device = parse_hwaddr($hw_addr); + $device ? grep { are_same_HwIDs($_, $device) } detect_devices::probeall() : {}; +} + +sub device_matches_interface_HwIDs { + my ($device, $interface) = @_; + my $hw_addr = c::getHwIDs($interface); + $hw_addr =~ /^usb/ and return; + my ($device2) = parse_hwaddr($hw_addr); + return if !$device2; + are_same_HwIDs($device, $device2); +} + +sub get_interface_sysfs_path { + my ($interface) = @_; + $interface = network::tools::get_real_interface($interface); + my $dev_path = "/sys/class/net/$interface/device"; + my $bus = detect_devices::get_sysfs_field_from_link($dev_path, "subsystem"); + if ($bus eq 'ieee1394') { + my $child = first(glob("$dev_path/host_id/*-*")); + $dev_path = $child if $child; + } + $dev_path; +} + +sub get_interface_ids { + my ($interface) = @_; + detect_devices::get_ids_from_sysfs_device(get_interface_sysfs_path($interface)); +} + +sub device_matches_interface { + my ($device, $interface) = @_; + detect_devices::device_matches_sysfs_ids($device, get_interface_ids($interface)); +} + +sub device_to_interface { + my ($device) = @_; + my @all_interfaces = detect_devices::get_net_interfaces(); + my ($real, $other) = partition { network::tools::is_real_interface($_) } @all_interfaces; + find { + device_matches_interface_HwIDs($device, $_) || + device_matches_interface($device, $_); + } @$real, @$other; +} + +sub interface_to_device { + my ($interface) = @_; + my $sysfs_ids = get_interface_ids($interface); + find { detect_devices::device_matches_sysfs_ids($_, $sysfs_ids) } detect_devices::probeall(); +} + +sub interface_to_driver { + my ($interface) = @_; + my $dev_path = get_interface_sysfs_path($interface); + #- FIXME: use $bus and move in get_interface_sysfs_path if possible + my $child = -f "$dev_path/idVendor" && first(glob("$dev_path/*-*:*.*")); + $dev_path = $child if -f "$child/driver/module"; + detect_devices::get_sysfs_field_from_link($dev_path, 'driver/module'); +} + +# return list of [ intf_name, module, device_description ] tuples such as: +# [ "eth0", "3c59x", "3Com Corporation|3c905C-TX [Fast Etherlink]" ] +# +# this function try several method in order to get interface's driver and description in order to support both: +# - hotplug managed devices (USB, firewire) +# - special interfaces (IP aliasing, VLAN) +sub get_eth_cards { + my ($o_modules_conf) = @_; + + detect_devices::probeall_update_cache(); + my @all_cards = detect_devices::get_lan_interfaces(); + + my @devs = detect_devices::pcmcia_probe(); + my $saved_driver; + # compute device description and return (interface, driver, description) tuples: + return map { + my $interface = $_; + my $description; + # 1) get interface's driver through ETHTOOL ioctl: + my ($a, $detected_through_ethtool); + $a = c::getNetDriver($interface); + if ($a) { + $detected_through_ethtool = 1; + } elsif ($o_modules_conf) { + # 2) get interface's driver through module aliases: + $a = $o_modules_conf->get_alias($interface); + } + + # workaround buggy drivers that returns a bogus driver name for the GDRVINFO command of the ETHTOOL ioctl: + my %fixes = ( + "p80211_prism2_cs" => 'prism2_cs', + "p80211_prism2_pci" => 'prism2_pci', + "p80211_prism2_usb" => 'prism2_usb', + "ip1394" => "eth1394", + "DL2K" => "dl2k", + "orinoco" => undef, #- should be orinoco_{cs,nortel,pci,plx,tmd} + "hostap" => undef, #- should be hostap_{cs,pci,plx} + ); + if (exists $fixes{$a}) { + $a = $fixes{$a}; + $a or undef $detected_through_ethtool; + } + + # 3) try to match a PCMCIA device for device description: + if (my $b = find { $_->{device} eq $interface } @devs) { # PCMCIA case + $a = $b->{driver}; + $description = $b->{description}; + } else { + # 4) try to lookup a device by hardware address for device description: + # maybe should have we try sysfs first for robustness? + my @devices = mapIntfToDevice($interface); + ($description) = $devices[0]{description} if @devices; + } + # 5) try to match a device through sysfs for driver & device description: + # (eg: ipw2100 driver for intel centrino do not support ETHTOOL) + if (!$description || !$a) { + my $drv = interface_to_driver($interface); + $a = $drv if $drv && !$detected_through_ethtool; + my $card = interface_to_device($interface); + $description ||= $card->{description} if $card; + } + # 6) try to match a device by driver for device description: + # (eg: madwifi, ndiswrapper, ...) + if (!$description) { + my @cards = grep { $_->{driver} eq ($a || $saved_driver) } detect_devices::probeall(); + $description = $cards[0]{description} if @cards == 1; + } + $a and $saved_driver = $a; # handle multiple cards managed by the same driver + [ $interface, $saved_driver, if_($description, $description) ]; + } @all_cards; +} + +sub get_eth_cards_names { + my (@all_cards) = @_; + map { $_->[0] => join(': ', $_->[0], $_->[2]) } @all_cards; +} + +#- returns (link_type, mac_address) +sub get_eth_card_mac_address { + my ($intf) = @_; + #- don't look for 6 bytes addresses only because of various non-standard MAC addresses + `$::prefix/sbin/ip -o link show $intf 2>/dev/null` =~ m|.*link/(\S+)\s((?:[0-9a-f]{2}:?)+)\s|; +} + +#- write interfaces MAC address in iftab +sub update_iftab() { + #- skip aliases and vlan interfaces + foreach my $intf (grep { network::tools::is_real_interface($_) } detect_devices::get_lan_interfaces()) { + my ($link_type, $mac_address) = get_eth_card_mac_address($intf) or next; + #- do not write zeroed MAC addresses in iftab, it confuses ifrename + $mac_address =~ /^[0:]+$/ and next; + # ifrename supports alsa IEEE1394, EUI64 and IRDA + member($link_type, 'ether', 'ieee1394', 'irda', '[27]') or next; + substInFile { + s/^$intf\s+.*\n//; + s/^.*\s+$mac_address\n//; + $_ .= qq($intf mac $mac_address\n) if eof; + } "$::prefix/etc/iftab"; + } +} + +sub update_udev_net_config() { + my $lib = arch() =~ /x86_64/ ? "lib64" : "lib"; + my $net_name_helper = "/lib/udev/write_net_rules"; + my $udev_net_config = "$::prefix/etc/udev/rules.d/70-persistent-net.rules"; + my @old_config = cat_($udev_net_config); + #- skip aliases and vlan interfaces + foreach my $intf (grep { network::tools::is_real_interface($_) } detect_devices::get_lan_interfaces()) { + (undef, my $mac_address) = get_eth_card_mac_address($intf) or next; + #- do not write zeroed MAC addresses + $mac_address =~ /^[0:]+$/ and next; + #- skip already configured addresses + any { !/^\s*#/ && /"$mac_address"/ } @old_config and next; + my $type = cat_("/sys/class/net/$intf/type") =~ /^\d+$/; + local $ENV{MATCHIFTYPE} = $type if $type; + local $ENV{INTERFACE} = $intf; + local $ENV{MATCHADDR} = $mac_address; + local $ENV{COMMENT} = "Drakx-net rule for $intf ($mac_address)"; + run_program::rooted($::prefix, $net_name_helper, '>', '/dev/null', $mac_address); + } +} + +# automatic net aliases configuration +sub configure_eth_aliases { + my ($modules_conf) = @_; + foreach my $card (get_eth_cards($modules_conf)) { + $modules_conf->set_alias($card->[0], $card->[1]); + } + $::isStandalone and $modules_conf->write; + update_iftab(); + update_udev_net_config(); +} + +sub get_link_detection_delay { + my ($self) = @_; + member($self->get_driver, qw(b44 forcedeth r8169 skge sky2 tg3 via_velocity e1000e)) && 6; +} + +sub is_ifplugd_blacklisted { + my ($module) = @_; + !$module; +} + +1; diff --git a/lib/network/connection/isdn.pm b/lib/network/connection/isdn.pm new file mode 100644 index 0000000..1b8debc --- /dev/null +++ b/lib/network/connection/isdn.pm @@ -0,0 +1,230 @@ +package network::connection::isdn; + +use base qw(network::connection); + +use strict; +use common; + +sub get_type_name { N("ISDN") } +sub _get_type_icon { 'isdn' } + +sub get_devices { + require modules; + #- FIXME: module alias should be written when config is written only + @{detect_backend(modules::any_conf->read)}; +} +sub get_metric { 30 } + +sub get_up_timeout { 20 } + +use network::connection::isdn::consts; +use modules; +use run_program; +use log; +use network::tools; +use services; + +sub apply_config { + my ($in, $isdn) = @_; + + $isdn = find_capi_card($isdn) if $isdn->{driver} eq "capidrv"; + unload_connection($isdn); + install_packages($isdn, $in); + write_settings($isdn); + write_capi_conf($isdn) if $isdn->{driver} eq "capidrv"; + prepare_connection($isdn); +} + +sub write_settings { + my ($isdn) = @_; + + output_with_perm("$::prefix/etc/isdn/profile/link/myisp", 0600, + qq( +I4L_USERNAME="$isdn->{login}" +I4L_SYSNAME="" +I4L_LOCALMSN="$isdn->{phone_in}" +I4L_REMOTE_OUT="$isdn->{phone_out}" +I4L_DIALMODE="$isdn->{dialing_mode}" +I4L_IDLETIME="$isdn->{huptimeout}" +) . if_($isdn->{speed} =~ /128/, 'SLAVE="ippp1" +')); + output "$::prefix/etc/isdn/profile/card/mycard", + qq( +I4L_MODULE="$isdn->{driver}" +I4L_TYPE="$isdn->{type}" +I4L_IRQ="$isdn->{irq}" +I4L_MEMBASE="$isdn->{mem}" +I4L_PORT="$isdn->{io}" +I4L_IO0="$isdn->{io0}" +I4L_IO1="$isdn->{io1}" +I4L_ID="HiSax" +I4L_FIRMWARE="$isdn->{firmware}" +I4L_PROTOCOL="$isdn->{protocol}" +); + + output "$::prefix/etc/ppp/ioptions", + "lock +usepeerdns +defaultroute +"; + + network::tools::write_secret_backend($isdn->{login}, $isdn->{passwd}); + + 1; +} + +sub write_capi_conf { + my ($capi_card) = @_; + my $capi_conf; + my $firmware = $capi_card->{firmware} || '-'; + if ($capi_card->{driver} eq "fcclassic") { + $capi_conf = "fcclassic - - 0x300 5 - -\n# adjust IRQ and IO !! ^^^^^ ^^^\n"; + } elsif ($capi_card->{driver} eq "fcpnp") { + $capi_conf = "fcpnp - - 0x300 5 - -\n# adjust IRQ and IO !! ^^^^^ ^^^\n"; + } else { + $capi_conf = "$capi_card->{driver} $firmware - - - - -\n"; + } + + output("$::prefix/etc/capi.conf", $capi_conf); +} + +sub unload_connection { + my ($isdn) = @_; + require services; + services::stop("isdn4linux"); #- to be stopped before capi is loaded + if ($isdn->{driver} eq "capidrv") { + #- stop capi4linux before new config is written so that it can unload the driver + services::stop("capi4linux"); + } +} + +sub install_packages { + my ($isdn, $in) = @_; + + $in->do_pkgs->install( + 'isdn4k-utils', + $isdn->{driver} eq "capidrv" ? + (if_(!modules::module_is_available($isdn->{driver}), @{$isdn->{packages}}), + if_($isdn->{firmware} && ! -f "$::prefix/usr/lib/isdn/$isdn->{firmware}", "$isdn->{driver}-firmware")) + : + ('isdn4net', if_($isdn->{speed} =~ /128/, 'ibod')) + ); +} + +sub prepare_connection { + my ($isdn) = @_; + if ($isdn->{driver} eq "capidrv") { + services::enable('capi4linux'); + } else { + services::disable('capi4linux'); + } + services::enable('isdn4linux'); +} + +sub read_config { + my ($isdn) = @_; + + my %match = (I4L_USERNAME => 'login', + I4L_LOCALMSN => 'phone_in', + I4L_REMOTE_OUT => 'phone_out', + I4L_DIALMODE => 'dialing_mode', + I4L_IDLETIME => 'huptimeout', + I4L_MODULE => 'driver', + I4L_TYPE => 'type', + I4L_IRQ => 'irq', + I4L_MEMBASE => 'mem', + I4L_PORT => 'io', + I4L_IO0 => 'io0', + I4L_IO1 => 'io1', + I4L_FIRMWARE => 'firmware'); + foreach ('link/myisp', 'card/mycard') { + my %conf = getVarsFromSh("$::prefix/etc/isdn/profile/$_"); + foreach (keys %conf) { + $isdn->{$match{$_}} = $conf{$_} if $match{$_} && $conf{$_}; + } + } + + $isdn->{passwd} = network::tools::passwd_by_login($isdn->{login}); +} + +my $file = "$ENV{SHARE_PATH}/ldetect-lst/isdn.db"; +$file = "$::prefix$file" if !-e $file; + +sub get_info_providers_backend { + my ($isdn, $name) = @_; + $name eq N("Unlisted - edit manually") and return; + foreach (catMaybeCompressed($file)) { + chop; + my ($name_, $phone, $real, $dns1, $dns2) = split '=>'; + if ($name eq $name_) { + @$isdn{qw(user_name phone_out DOMAINNAME2 dnsServer3 dnsServer2)} = + ((split(/\|/, $name_))[2], $phone, $real, $dns1, $dns2); + } + } +} + +sub read_providers_backend() { map { /(.*?)=>/ } catMaybeCompressed($file) } + + +sub detect_backend { + my ($modules_conf) = @_; + my @isdn; + require detect_devices; + each_index { + my $c = $_; + my $isdn = { map { $_ => $c->{$_} } qw(description vendor id driver card_type type) }; + $isdn->{intf_id} = $::i; + $isdn->{$_} = sprintf("%0x", $isdn->{$_}) foreach 'vendor', 'id'; + $isdn->{card_type} = $c->{bus} eq 'USB' ? 'usb' : 'pci'; + $isdn->{description} =~ s/.*\|//; +# $c->{options} !~ /id=HiSax/ && $isdn->{driver} eq "hisax" and $c->{options} .= " id=HiSax"; + if ($c->{options} !~ /protocol=/ && $isdn->{protocol} =~ /\d/) { + $modules_conf->set_options($c->{driver}, $c->{options} . " protocol=" . $isdn->{protocol}); + } + $c->{options} =~ /protocol=(\d)/ and $isdn->{protocol} = $1; + push @isdn, $isdn; + } detect_devices::probe_category('network/isdn'); + \@isdn; +} + +sub get_cards_by_type { + my ($isdn_type) = @_; + grep { $_->{card} eq $isdn_type } @isdndata; +} + + +sub get_cards() { + my %buses = ( + isa => N("ISA / PCMCIA") . "/" . N("I do not know"), + pci => N("PCI"), + usb => N("USB"), + ); + # pmcia alias (we should really split up pcmcia from isa in isdn db): + $buses{pcmcia} = $buses{isa}; + + map { $buses{$_->{card}} . "|" . $_->{description} => $_ } @isdndata; +} + + +sub find_capi_card { + my ($isdn) = @_; + find { + hex($isdn->{vendor}) == $_->{vendor} && hex($isdn->{id}) == $_->{id}; + } @isdn_capi; +} + +sub get_capi_card { + my ($in, $isdn) = @_; + + my $capi_card = find_capi_card($isdn) or return; + + #- check if the capi driver is available + unless (modules::module_is_available($capi_card->{driver}) || ($capi_card->{packages} = $in->do_pkgs->check_kernel_module_packages($capi_card->{driver}))) { + log::explanations("a capi driver ($capi_card->{driver}) exists to replace $isdn->{driver}, but it is not installed and no packages provide it"); + return; + } + + $capi_card; +} + +1; diff --git a/lib/network/connection/isdn/consts.pm b/lib/network/connection/isdn/consts.pm new file mode 100644 index 0000000..a53ddbe --- /dev/null +++ b/lib/network/connection/isdn/consts.pm @@ -0,0 +1,460 @@ +package network::connection::isdn::consts; # $Id: consts.pm 54070 2006-08-07 17:34:38Z blino $ +use vars qw(@ISA @EXPORT); +@ISA = qw(Exporter); +@EXPORT = qw(@isdndata @isdn_capi); + +our @isdndata = + ( + { description => "Teles|16.0", #1 irq, mem, io + driver => 'hisax', + type => '1', + irq => '5', + mem => '0xd000', + io => '0xd80', + card => 'isa', + }, + { description => "Teles|8.0", #2 irq, mem + driver => 'hisax', + type => '2', + irq => '9', + mem => '0xd800', + card => 'isa', + }, + { description => "Teles|16.3 (ISA non PnP)", #3 irq, io + driver => 'hisax', + type => '3', + irq => '9', + io => '0xd80', + card => 'isa', + }, + { description => "Teles|16.3c (ISA PnP)", #14 irq, io + driver => 'hisax', + type => '14', + irq => '9', + io => '0xd80', + card => 'isa', + }, + { description => "Creatix/Teles|Generic (ISA PnP)", #4 irq, io0 (ISAC), io1 (HSCX) + driver => 'hisax', + type => '4', + irq => '5', + io0 => '0x0000', + io1 => '0x0000', + card => 'isa', + }, + { description => "Teles|generic", #21 no parameter + driver => 'hisax', + type => '21', + card => 'pci', + }, + { description => "Teles|16.3 (PCMCIA)", #8 irq, io + driver => 'hisax', + type => '8', + irq => '', + io => '0x', + card => 'isa', + }, + { description => "Teles|S0Box", #25 irq, io (of the used lpt port) + driver => 'hisax', + type => '25', + irq => '7', + io => '0x378', + card => 'isa', + }, + { description => "ELSA|PCC/PCF cards", #6 io or nothing for autodetect (the io is required only if you have n>1 ELSA|card) + driver => 'hisax', + type => '6', + io => "", + card => 'isa', + }, + { description => "ELSA|Quickstep 1000", #7 irq, io (from isapnp setup) + driver => 'hisax', + type => '7', + irq => '5', + io => '0x300', + card => 'isa', + }, + { description => "ELSA|Quickstep 1000", #18 no parameter + driver => 'hisax', + type => '18', + card => 'pci', + }, + { description => "ELSA|Quickstep 3000", #18 no parameter + driver => 'hisax', + type => '18', + card => 'pci', + }, + { description => "ELSA|generic (PCMCIA)", #10 irq, io (set with card manager) + driver => 'hisax', + type => '10', + irq => '', + io => '0x', + card => 'isa', + }, + { description => "ELSA|MicroLink (PCMCIA)", #10 irq, io (set with card manager) + driver => 'elsa_cs', + card => 'isa', + }, + { description => "ITK|ix1-micro Rev.2", #9 irq, io + driver => 'hisax', + type => '9', + irq => '9', + io => '0xd80', + card => 'isa', + }, + { description => "Eicon.Diehl|Diva (ISA PnP)", #11 irq, io + driver => 'hisax', + type => '11', + irq => '9', + io => '0x180', + card => 'isa', + }, + { description => "Eicon.Diehl|Diva 20", #11 no parameter + driver => 'hisax', + type => '11', + card => 'pci', + }, + { description => "Eicon.Diehl|Diva 20PRO", #11 no parameter + driver => 'hisax', + type => '11', + card => 'pci', + }, + { description => "Eicon.Diehl|Diva 20_U", #11 no parameter + driver => 'hisax', + type => '11', + card => 'pci', + }, + { description => "Eicon.Diehl|Diva 20PRO_U", #11 no parameter + driver => 'hisax', + type => '11', + card => 'pci', + }, + { description => "ASUS|COM ISDNLink", #12 irq, io (from isapnp setup) + driver => 'hisax', + type => '12', + irq => '5', + io => '0x200', + card => 'isa', + }, + { description => "ASUS|COM ISDNLink", + driver => 'hisax', + type => '35', + card => 'pci', + }, + { description => "DynaLink|Any", + driver => 'hisax', + type => '12', + card => 'pci', + }, + { description => "DynaLink|IS64PH, ASUSCOM", #36 + driver => 'hisax', + type => '36', + card => 'pci', + }, + { description => "HFC|2BS0 based cards", #13 irq, io + driver => 'hisax', + type => '13', + irq => '9', + io => '0xd80', + card => 'isa', + }, + { description => "HFC|2BDS0", #35 none + driver => 'hisax', + type => '35', + card => 'pci', + }, + { description => "HFC|2BDS0 S+, SP (PCMCIA)", #37 irq,io (pcmcia must be set with cardmgr) + driver => 'hisax', + type => '37', + card => 'isa', + }, + { description => "Sedlbauer|Speed Card", #15 irq, io + driver => 'hisax', + type => '15', + irq => '9', + io => '0xd80', + card => 'isa', + }, + { description => "Sedlbauer|PC/104", #15 irq, io + driver => 'hisax', + type => '15', + irq => '9', + io => '0xd80', + card => 'isa', + }, + { description => "Sedlbauer|Speed Card", #15 no parameter + driver => 'hisax', + type => '15', + card => 'pci', + }, + { description => "Sedlbauer|Speed Star (PCMCIA)", #22 irq, io (set with card manager) + driver => 'sedlbauer_cs', + card => 'isa', + }, + { description => "Sedlbauer|Speed Fax+ (ISA Pnp)", #28 irq, io (from isapnp setup) + driver => 'hisax', + type => '28', + irq => '9', + io => '0xd80', + card => 'isa', + firmware => '/usr/lib/isdn/ISAR.BIN', + }, + { description => "Sedlbauer|Speed Fax+", #28 no parameter + driver => 'hisax', + type => '28', + card => 'pci', + firmware => '/usr/lib/isdn/ISAR.BIN', + }, + { description => "USR|Sportster internal", #16 irq, io + driver => 'hisax', + type => '16', + irq => '9', + io => '0xd80', + card => 'isa', + }, + { description => "Generic|MIC card", #17 irq, io + driver => 'hisax', + type => '17', + irq => '9', + io => '0xd80', + card => 'isa', + }, + { description => "Compaq|ISDN S0 card", #19 irq, io0, io1, io (from isapnp setup io=IO2) + driver => 'hisax', + type => '19', + irq => '5', + io => '0x0000', + io0 => '0x0000', + io1 => '0x0000', + card => 'isa', + }, + { description => "Generic|NETjet card", #20 no parameter + driver => 'hisax', + type => '20', + card => 'pci', + }, + { description => "Dr. Neuhaus|Niccy (ISA PnP)", #24 irq, io0, io1 (from isapnp setup) + driver => 'hisax', + type => '24', + irq => '5', + io0 => '0x0000', + io1 => '0x0000', + card => 'isa', + }, + { description => "Dr. Neuhaus|Niccy", ##24 no parameter + driver => 'hisax', + type => '24', + card => 'pci', + }, + { description => "AVM|A1 (Fritz) (ISA non PnP)", #5 irq, io + driver => 'hisax', + type => '5', + irq => '10', + io => '0x300', + card => 'isa', + }, + { description => "AVM|ISA Pnp generic", #27 irq, io (from isapnp setup) + driver => 'hisax', + type => '27', + irq => '5', + io => '0x300', + card => 'isa', + }, + { description => "AVM|A1 (Fritz) (PCMCIA)", #26 irq, io (set with card manager) + driver => 'hisax', + type => '26', + irq => '', + card => 'isa', + }, + { description => "AVM|PCI (Fritz!)", #27 no parameter + driver => 'hisax', + type => '27', + card => 'pci', + }, + { description => "AVM|B1", + driver => 'b1pci', + card => 'pci', + }, + { description => "Siemens|I-Surf 1.0 (ISA Pnp)", #29 irq, io, memory (from isapnp setup) + driver => 'hisax', + type => '29', + irq => '9', + io => '0xd80', + mem => '0xd000', + card => 'isa', + }, + { description => "ACER|P10 (ISA Pnp)", #30 irq, io (from isapnp setup) + driver => 'hisax', + type => '30', + irq => '5', + io => '0x300', + card => 'isa', + }, + { description => "HST|Saphir (ISA Pnp)", #31 irq, io + driver => 'hisax', + type => '31', + irq => '5', + io => '0x300', + card => 'isa', + }, + { description => "Telekom|A4T", #32 none + driver => 'hisax', + type => '32', + card => 'pci', + }, + { description => "Scitel|Quadro", #33 subcontroller (4*S0, subctrl 1...4) + driver => 'hisax', + type => '33', + card => 'pci', + }, + { description => "Gazel|ISDN cards", #34 irq,io + driver => 'hisax', + type => '34', + irq => '5', + io => '0x300', + card => 'isa', + }, + { description => "Gazel|Gazel ISDN cards", #34 none + driver => 'hisax', + type => '34', + card => 'pci', + }, + { description => "Winbond|W6692 and Winbond based cards", #36 none + driver => 'hisax', + type => '36', + card => 'pci', + }, + { description => "BeWAN|R834", + driver => 'hisax_st5481', + type => '99', + card => 'usb', + }, + { description => "Gazel|128", + driver => 'hisax_st5481', + type => '99', + card => 'usb', + }, + ); + +#- cards than can be used with capi drivers +our @isdn_capi = + ( + { + vendor => 0x1131, + id => 0x5402, + description => 'AVM Audiovisuelles|Fritz DSL ISDN/DSL Adapter', + bus => 'PCI', + driver => 'fcdsl', + firmware => 'fdslbase.bin' + }, + { + vendor => 0x1244, + id => 0x0a00, + description => 'AVM Audiovisuelles|A1 ISDN Adapter [Fritz] CAPI', + bus => 'PCI', + driver => 'fcpci' + }, + { + vendor => 0x1244, + id => 0x0e00, + description => 'AVM Audiovisuelles|A1 ISDN Adapter [Fritz] CAPI', + bus => 'PCI', + driver => 'fcpci' + }, + { + vendor => 0x1244, + id => 0x0f00, + description => 'AVM Audiovisuelles|Fritz DSL ISDN/DSL Adapter', + bus => 'PCI', + driver => 'fcdsl', + firmware => 'fdslbase.bin' + }, + { + vendor => 0x1244, + id => 0x2700, + description => 'AVM Audiovisuelles|Fritz!Card DSL SL', + bus => 'PCI', + driver => 'fcdslsl', + firmware => 'fdssbase.bin' + }, + { + vendor => 0x1244, + id => 0x2900, + description => 'AVM Audiovisuelles|Fritz DSL Ver. 2.0', + bus => 'PCI', + driver => 'fcdsl2', + firmware => 'fds2base.bin' + }, + { + vendor => 0x057c, + id => 0x0c00, + description => 'AVM GmbH|FritzCard USB ISDN TA', + bus => 'USB', + driver => 'fcusb' + }, + { + vendor => 0x057c, + id => 0x1000, + description => 'AVM GmbH|FritzCard USB 2 Ver. 2.0 ISDN TA', + bus => 'USB', + driver => 'fcusb2', + firmware => 'fus2base.frm' + }, + { + vendor => 0x057c, + id => 0x1900, + description => 'AVM GmbH|FritzCard USB 2 Ver. 3.0 ISDN TA', + bus => 'USB', + driver => 'fcusb2', + firmware => 'fus3base.frm' + }, + { + vendor => 0x057c, + id => 0x2000, + description => 'AVM GmbH|Fritz X USB ISDN TA', + bus => 'USB', + driver => 'fxusb' + }, + { + vendor => 0x057c, + id => 0x2300, + description => 'AVM GmbH|FtitzCard USB DSL ISDN TA/ DSL Modem', + bus => 'USB', + driver => 'fcdslusb', + firmware => 'fdsubase.frm' + }, + { + vendor => 0x057c, + id => 0x2800, + description => 'AVM GmbH|Fritz X USB OEM ISDN TA', + bus => 'USB', + driver => 'fxusb_CZ' + }, + { + vendor => 0x057c, + id => 0x3000, + description => 'AVM GmbH|FtitzCard USB DSL SL USB', + bus => 'USB', + driver => 'fcdslusba', + firmware => 'fdlabase.frm' + }, + { + vendor => 0x057c, + id => 0x3500, + description => 'AVM GmbH|FtitzCard USB DSL SL USB Analog', + bus => 'USB', + driver => 'fcdslslusb', + firmware => 'fdlubase.frm', + }, + { + vendor => 0x057c, + id => 0x3600, + description => 'AVM FRITZ!Card DSL USB v2.0', + bus => 'USB', + driver => 'fcdslusb2', + firmware => 'fds2base.frm', + }, + ); + + +1; diff --git a/lib/network/connection/pots.pm b/lib/network/connection/pots.pm new file mode 100644 index 0000000..22299f6 --- /dev/null +++ b/lib/network/connection/pots.pm @@ -0,0 +1,133 @@ +package network::connection::pots; + +use base qw(network::connection::ppp); + +use strict; +use common; + +sub get_type_name { + #-PO: POTS means "Plain old telephone service" + N("POTS"); +} +sub get_type_description { + #-PO: POTS means "Plain old telephone service" + #-PO: remove it if it doesn't have an equivalent in your language + #-PO: for example, in French, it can be translated as "RTC" + N("Analog telephone modem (POTS)"); +} +sub _get_type_icon { 'potsmodem' } +sub get_metric { 50 } + +sub handles_ifcfg { + my ($_class, $ifcfg) = @_; + $ifcfg->{DEVICE} =~ /^ppp/ && exists $ifcfg->{MODEMPORT}; +} + +sub get_devices { + require detect_devices; + require modules; + #- FIXME: module alias should be written when config is written only + #detect_devices::getModem(modules::any_conf->read); + (); +} + +my @thirdparty_settings = ( + { + matching => qr/^Hcf:/, + description => 'HCF 56k Modem', + url => 'http://www.linuxant.com/drivers/hcf/', + name => 'hcfpcimodem', + kernel_module => { + test_file => 'hcfpciengine', + }, + tools => { + test_file => '/usr/sbin/hcfpciconfig', + }, + device => '/dev/ttySHCF0', + post => '/usr/sbin/hcfpciconfig --auto', + restart_service => 'hcfpci', + }, + + { + matching => qr/^Hsf:/, + description => 'HSF 56k Modem', + url => 'http://www.linuxant.com/drivers/hsf/', + name => 'hsfmodem', + kernel_module => { + test_file => 'hsfengine', + }, + tools => { + test_file => '/usr/sbin/hsfconfig', + }, + device => '/dev/ttySHSF0', + post => '/usr/sbin/hsfconfig --auto', + restart_service => 'hsf', + }, + + { + matching => qr/^LT:/, + description => 'LT WinModem', + url => 'http://www.heby.de/ltmodem/', + name => 'ltmodem', + kernel_module => 1, + tools => { + test_file => '/etc/devfs/conf.d/ltmodem.conf', + }, + device => '/dev/ttyS14', + links => [ + 'http://linmodems.technion.ac.il/Ltmodem.html', + 'http://linmodems.technion.ac.il/packages/ltmodem/', + ], + }, + + { + matching => [ list_modules::category2modules('network/slmodem') ], + description => 'Smartlink WinModem', + url => 'http://linmodems.technion.ac.il/resources.html#smartlink', + name => 'slmodem', + kernel_module => 1, + tools => { + test_file => '/usr/sbin/slmodemd', + }, + device => '/dev/ttySL0', + post => sub { + my ($driver) = @_; + addVarsInSh("$::prefix/etc/sysconfig/slmodemd", { SLMODEMD_MODULE => $driver }); + }, + restart_service => "slmodemd", + }, + + { + name => 'sm56', + description => 'Motorola SM56 WinModem', + url => 'http://www.motorola.com/softmodem/driver.htm#linux', + kernel_module => { + package => 'sm56', + }, + no_distro_package => 1, + device => '/dev/sm56', + }, +); + +sub get_thirdparty_settings { \@thirdparty_settings } + +sub get_providers { + my $db_path = "/usr/share/apps/kppp/Provider"; + #$in->do_pkgs->ensure_is_installed('kdenetwork-kppp-provider', $db_path); + my $separator = "|"; + my %providers; + foreach (all($::prefix . $db_path)) { + s!_! !g; + my $country = $_; + my $t_country = translate($country); + my $country_root = $::prefix . $db_path . '/' . $country; + foreach (grep { $_ ne '.directory' } all($country_root)) { + my $path = $country_root . $_; + s/%([0-9]{3})/chr(int($1))/eg; + $providers{$t_country . $separator . $_} = { path => $path }; + } + } + (\%providers, $separator); +} + +1; diff --git a/lib/network/connection/ppp.pm b/lib/network/connection/ppp.pm new file mode 100644 index 0000000..37fabb3 --- /dev/null +++ b/lib/network/connection/ppp.pm @@ -0,0 +1,150 @@ +package network::connection::ppp; + +use strict; +use common; + +use base qw(network::connection); + +my %authentication_methods = ( + script => N_("Script-based"), + pap => N_("PAP"), + terminal_ => N_("Terminal-based"), + chap => N_("CHAP"), + pap_chap => N_("PAP/CHAP"), +); + +my @kppp_authentication_methods = qw(script pap terminal chap pap_chap); +my @secrets_files = qw(pap-secrets chap-secrets); + +sub get_access_settings { + my ($self) = @_; + [ + { label => N("Account Login (user name)"), val => \$self->{access}{login} }, + { label => N("Account Password"), val => \$self->{access}{password}, hidden => 1 }, + ]; +} + +sub get_secret { + my ($_self, $login) = @_; + foreach (@secrets_files) { + my $file = "$::prefix/etc/ppp/$_"; + foreach (cat_($file)) { + my ($l, undef, $password) = split(' '); + if ($l && $password) { + s/^(['"]?)(.*)\1$/$2/ foreach $l, $password; + return $password if $l eq $login; + } + } + } +} + +sub write_secrets { + my ($self) = @_; + foreach (@secrets_files) { + my $file = "$::prefix/etc/ppp/$_"; + substInFile { + s/^'$self->{access}{login}'.*\n//; + $_ .= "\n'$self->{access}{login}' * '$self->{access}{password}' * \n" if eof; + } $file; + chmod 0600, $file; + } +} + +sub get_options { + #- options: PAPNAME PEERDNS +} + +sub get_tty_device { "/dev/modem" } + +sub get_up_timeout { 20 } + +sub build_ifcfg_settings { + my ($self) = @_; + my $modemport = $self->get_tty_device; + my $settings = put_in_hash($self->{settings}, { + if_($modemport, MODEMPORT => $modemport), + LINESPEED => "115200", + PERSIST => "yes", + DEFROUTE => "yes", + #- FIXME: move in network::connection::cellular or network::connection::cellular_card + if_($self->get_interface !~ /^hso/, DEBUG => "yes"), + if_($self->{access}{cid}, CELLULAR_CID => $self->{access}{cid}), + }); + $self->SUPER::build_ifcfg_settings($settings); +} + +sub build_chat { + my ($self) = @_; + #- optional: + #- auth_method: key of %authentication_methods + #- dial_number + #- login + #- password + #- at_commands: array ref of AT commands + (map { "ABORT $_" } "BUSY", "ERROR", "'NO CARRIER'", "'NO DIALTONE'", "'Invalid Login'", "'Login incorrect'", "VOICE", "'NO ANSWER'", "DELAYED", "'SIM PIN'"), + qq('' ATZ), + if_(ref $self->{access}{at_commands}, map { qq(OK-AT-OK '$_') } @{$self->{access}{at_commands}}), + if_($self->{access}{dial_number}, + qq(OK 'ATDT$self->{access}{dial_number}'), + qq(TIMEOUT 120), + qq(CONNECT ''), + if_(member($self->{access}{auth_method}, qw(script terminal)), + qq('ogin:--ogin:' '$self->{access}{login}'), + qq('ord:' '$self->{access}{password}')), + qq(TIMEOUT 5), + qq('~--' ''), + ); +} + +sub get_chat_file { + my ($self) = @_; + "/etc/sysconfig/network-scripts/chat-" . $self->get_interface; +} + +sub write_chat { + my ($self) = @_; + output_with_perm($::prefix . $self->get_chat_file, 0755, join("\n", $self->build_chat, '')); +} + +sub get_peer_default_options { + my ($_self) = @_; + qw(noauth defaultroute usepeerdns); +} + +sub build_peer { + my ($self) = @_; + #- options: + #- init + #- connect + #- pty + #- plugin + if ($self->{access}{use_chat}) { + my $chat_file = $self->get_chat_file; + $self->{access}{peer}{connect} ||= qq("/usr/sbin/chat -v -f $chat_file"); + } + $self->get_peer_default_options, + (map { if_($self->{access}{peer}{$_}, $_ . " " . $self->{access}{peer}{$_}) } qw(init connect pty plugin)), + if_($self->{access}{login}, qq(user "$self->{access}{login}")); +} + +sub write_peer { + my ($self) = @_; + my $interface = $self->get_interface; + my $peer_file = "/etc/ppp/peers/$interface"; + output_with_perm($::prefix . $peer_file, 0755, join("\n", $self->build_peer, '')); +} + +sub write_ppp_settings { + my ($self) = @_; + $self->write_secrets if $self->{access}{login}; + $self->write_chat if $self->{access}{use_chat}; + $self->write_peer; +} + +sub write_settings { + my ($self) = @_; + $self->write_ppp_settings; + $self->network::connection::write_settings; +} + +1; diff --git a/lib/network/connection/providers/cellular.pm b/lib/network/connection/providers/cellular.pm new file mode 100644 index 0000000..79f757c --- /dev/null +++ b/lib/network/connection/providers/cellular.pm @@ -0,0 +1,183 @@ +package network::connection::providers::cellular; + +use common; +use utf8; + +# http://www.reqwireless.com/apns.html +# http://wiki.mig33.com/mig33/show/apn +# http://www.unlocks.co.uk/gprs_settings.php +# http://www.opera.com/products/smartphone/docs/connect/ +# http://www.taniwha.org.uk/gprs.html +# https://rip.psg.com/~randy/gprs-ppp.html +# http://computer.cocus.co.il/Setup/V3X/MPT/Addons/GPRSope.inf + +our %data = ( + N("Brazil") . "|Vivo" => { + apn => "zap.vivo.com.br", + login => "vivo", + password => "vivo", + }, + N("Estonia") . "|Bravocom" => { + apn => "internet", + }, + N("Estonia") . "|Elisa" => { + apn => "internet", + }, + N("Estonia") . "|EMT" => { + apn => "internet.emt.ee", + }, + N("Estonia") . "|Simpel/POP!" => { + apn => "internet2.emt.ee", + }, + N("Estonia") . "|Tele2" => { + apn => "internet.tele2.ee", + }, + N("Estonia") . "|TeleYks" => { + apn => "internet", + }, + N("Estonia") . "|Zorro" => { + apn => "internet", + }, + # http://www.cubio.fi/fi/cubio_gsm/mms_ja_gprs_asetukset + N("Finland") . "|Cubio" => { + apn => "internet.cubio.net", + }, + # http://www.dnaoy.fi/Yksityisille/Matkaviestinta/Asiakaspalvelu/Documents/Ohjeet/asetukset_yleiset_wxp.pdf + N("Finland") . "|DNA" => { + apn => "internet", + }, + # http://matkaviestinta.elisa.fi/public/elisa.do?id=hen_liit_palvelut_gprs,ds_muut_0054.htm + # http://tuki.elisa.fi/asiakastuki/elisa.do?id=hen_as_matkaviest_ohjeet,as_help_page_0025.htm + # Official pages have inconsistent information on whether login and + # password are used. Presumably they are ignored, but we set them just to + # be sure. + N("Finland") . "|Elisa" => { + apn => "internet", + login => "rlnet", + password => "internet", + }, + # http://koti.mbnet.fi/simopot/asetukset/index.php?operaattori=globetel + N("Finland") . "|Globetel" => { + apn => "internet", + }, + # http://www.kolumbus.com/asiakaspalvelu_asetukset.html + # Redirects to Elisa automatic setup, presumably same settings apply. + N("Finland") . "|Kolumbus" => { + apn => "internet", + login => "rlnet", + password => "internet", + }, + # http://saunalahti.fi/tuki/gsm/vo/ohjeemail.php + N("Finland") . "|Saunalahti" => { + apn => "internet.saunalahti", + }, + # http://koti.mbnet.fi/simopot/asetukset/index.php?operaattori=sonera + N("Finland") . "|Sonera" => { + apn => "internet", + }, + # http://tdc.fi/publish.php?dogtag=songfi_at_ojl_int + N("Finland") . "|Song" => { + apn => "internet.song.fi", + login => "song@internet", + password => "songnet", + }, + # http://www.tele.fi/Asiakaspalvelu/Ohjeet/K%E4nnyk%E4ll%E4+nettiin+ja+tiedonsiirto/Asetukset/ + N("Finland") . "|Tele Finland" => { + apn => "internet", + }, + # http://www.gsm.aland.fi/tjanster/wap/wap.htm + N("Finland") . "|Ålands Mobiltelefon" => { + apn => "internet", + }, + N("France") . "|BouygTel" => { + apn => "ebouygtel.com", + }, + N("France") . "|BouygTel Pro" => { + apn => "a2bouygtel.com", + login => "a2b", + password => "acces", + }, + N("France") . "|BouygTel Pro GPRS" => { + apn => "b2bouygtel.com", + login => "B2B", + password => "NET", + }, + N("France") . "|Orange Web" => { + apn => "orange.fr", + login => "orange", + password => "orange", + }, + # http://www.actua-mobiles.com/p800/viewtopic.php?p=12184#12184 + # http://www.planete-se.net/index.php?showtopic=18184&st=0&p=186768&#entry186768 + N("France") . "|Orange WAP" => { + apn => "orange", + login => "orange", + password => "orange", + }, + N("France") . "|Orange Entreprises" => { + apn => "internet-entreprise", + login => "orange", + password => "orange", + }, + N("France") . "|SFR EeePC (Clé Internet 3G+)" => { + apn => "slsfr", + }, + N("France") . "|SFR WAP (Illimythics / Pass Surf)" => { + apn => "wapsfr", + }, + N("France") . "|SFR Web (Clé Internet / Data)" => { + apn => "websfr", + }, + N("Germany") . "|Vodafone Live! WAP" => { + apn => "wap.vodafone.de", + }, + N("Germany") . "|Vodafone Web" => { + apn => "web.vodafone.de", + }, + N("Italy") . "|TIM" => { + apn => "ibox.tim.it", + login => "tim", + password => "tim", + }, + N("Italy") . "|Vodafone" => { + apn => "web.omnitel.it", + login => "vodafone", + password => "vodafone", + }, + N("Italy") . "|Wind" => { + apn => "internet.wind.it", + login => "wind", + password => "wind", + }, + N("Italy") . "|Tre" => { + apn => "tre.it", + login => "tre", + password => "tre", + }, + N("Poland") . "|Era GSM" => { + apn => "erainternet", + login => "erainternet", + password => "erainternet", + }, + N("Poland") . "|Orange" => { + apn => "internet", + login => "internet", + password => "internet", + }, + N("Poland") . "|Play" => { + apn => "INTERNET", + }, + N("Poland") . "|Plus GSM" => { + apn => "internet", + }, + N("United Kingdom") . "|O2" => { + apn => "mobile.o2.co.uk", + login => "mobileweb", + password => "password", + }, + N("United States") . "|Cingular" => { + apn => "isp.cingular", + }, +); + +1; diff --git a/lib/network/connection/providers/cellular_extra.pm b/lib/network/connection/providers/cellular_extra.pm new file mode 100644 index 0000000..4039afa --- /dev/null +++ b/lib/network/connection/providers/cellular_extra.pm @@ -0,0 +1,2284 @@ +package network::connection::providers::cellular_extra; + +use common; +use utf8; + +# this list was imported from mobile-broadband-provider-info +# (http://svn.gnome.org/svn/mobile-broadband-provider-info/trunk) and converted +# to perl data using some black magick + +our %data = ( + N("United Arab Emirates") . "|Etisalat" => { + apn => "mnet", + login => "mnet", + password => "mnet", + dns => "194.170.1.6", + dns => "194.170.1.7", + }, + N("United Arab Emirates") . "|Etisalat 3G" => { + apn => "etisalat.ae", + login => "etisalat.ae", + password => "etisalat.ae", + }, + N("Albania") . "|Vodafone" => { + apn => "Twa", + }, + N("Angola") . "|Movinet" => { + cdma => 1, + login => "uname", + }, + N("Argentina") . "|Personal" => { + apn => "gprs.personal.com", + login => "gprs", + password => "adgj", + dns => "172.25.7.6", + dns => "172.25.7.7", + }, + N("Argentina") . "|CTI" => { + apn => "internet.ctimovil.com.ar", + login => "ctigprs", + dns => "170.51.255.100", + dns => "170.51.242.18", + }, + N("Argentina") . "|Movistar" => { + apn => "internet.gprs.unifon.com.ar", + login => "wap", + password => "wap", + }, + N("Angola") . "|Unitel" => { + apn => "internet.unitel.co.ao", + }, + N("Austria") . "|Max Max Online Mobil" => { + apn => "gprsinternet", + login => "GPRS", + dns => "213.162.64.1", + dns => "213.162.64.2", + }, + N("Austria") . "|Max Online" => { + apn => "gprsinternet", + login => "GPRS", + dns => "213.162.64.1", + dns => "213.162.64.2", + }, + N("Austria") . "|Max Online (Business)" => { + apn => "business.gprsinternet", + login => "GPRS", + dns => "213.162.64.1", + dns => "213.162.64.2", + }, + N("Austria") . "|Max Online (Metro)" => { + apn => "gprsmetro", + login => "GPRS", + dns => "213.162.64.1", + dns => "213.162.64.2", + }, + N("Austria") . "|Mobilkom/A1" => { + apn => "a1.net", + login => "ppp@a1plus.at", + password => "ppp", + dns => "194.48.139.254", + dns => "194.48.124.202", + }, + N("Austria") . "|Orange" => { + apn => "web.one.at", + login => "web", + password => "web", + dns => "194.24.128.100", + dns => "194.24.128.102", + }, + N("Austria") . "|Tele.ring" => { + apn => "web", + login => "web@telering.at", + password => "web", + dns => "212.95.31.167 ", + dns => "212.95.31.168", + }, + N("Austria") . "|Telering" => { + apn => "web", + login => "web@telering.at", + password => "web", + dns => "212.95.31.167 ", + dns => "212.95.31.168", + }, + N("Austria") . "|Drei" => { + apn => "drei.at", + }, + N("Austria") . "|Yesss" => { + apn => "web.yesss.at", + }, + N("Australia") . "|Exetel" => { + apn => "exetel1", + }, + N("Australia") . "|Optus" => { + apn => "internet", + dns => "202.139.83.3", + dns => "192.65.91.129", + }, + N("Australia") . "|Optus 3G" => { + apn => "CONNECT", + dns => "202.139.83.3", + dns => "192.65.91.129", + }, + N("Australia") . "|Telstra" => { + apn => "telstra.wap", + dns => "139.130.4.4", + dns => "203.50.2.71", + }, + N("Australia") . "|Telstra (3G data pack)" => { + apn => "telstra.datapack", + password => "Telstra", + dns => "139.130.4.4", + dns => "203.50.2.71", + }, + N("Australia") . "|Telstra (UMTS/HSDPA)" => { + apn => "telstra.internet", + dns => "139.130.4.4", + dns => "203.50.170.2", + }, + N("Australia") . "|Telstra (3G PC pack - pay by time)" => { + apn => "telstra.pcpack", + password => "Telstra", + dns => "139.130.4.4", + dns => "203.50.2.71", + }, + N("Australia") . "|Telstra (Next G card)" => { + dns => "139.130.4.4", + dns => "203.50.2.71", + }, + N("Australia") . "|Three" => { + apn => "3netaccess", + login => "a", + password => "a", + dns => "202.124.68.130", + dns => "202.124.76.66", + }, + N("Australia") . "|Three Prepaid" => { + apn => "3services", + login => "a", + password => "a", + dns => "202.124.68.130", + dns => "202.124.76.66", + }, + N("Australia") . "|Virgin Mobile" => { + apn => "VirginInternet", + login => "guest", + password => "guest", + dns => "61.88.88.88", + }, + N("Australia") . "|Vodafone" => { + apn => "vfinternet.au", + dns => "192.189.54.33", + dns => "210.80.58.3", + }, + N("Azerbaijan") . "|Azercell" => { + apn => "internet", + }, + N("Azerbaijan") . "|Bakcell" => { + apn => "mms", + }, + N("Bosnia and Herzegovina") . "|BH GSM" => { + apn => "mms.bhmobile.ba", + }, + N("Bahamas") . "|Batelco" => { + apn => "internet.btcbahamas.com", + }, + N("Bangladesh") . "|AKTel" => { + apn => "atmmms", + dns => "192.168.023.007", + }, + N("Bangladesh") . "|Banglalink" => { + apn => "blweb", + }, + N("Bangladesh") . "|Grameen Phone" => { + apn => "gpinternet", + dns => "202.56.4.120", + dns => "202.56.4.121", + }, + N("Barbados") . "|Digicel" => { + apn => "isp.digicelbarbados.com", + }, + N("Belgium") . "|Mobistar (business)" => { + apn => "web.pro.be", + login => "mobistar", + password => "mobistar", + dns => "212.65.63.10", + dns => "212.65.63.145", + }, + N("Belgium") . "|Orange" => { + apn => "orangeinternet", + }, + N("Belgium") . "|Proximus Inter" => { + apn => "internet.proximus.be", + dns => "195.238.2.21", + dns => "195.238.2.22", + }, + N("Belgium") . "|Proximus Intra" => { + apn => "intraprox.be", + dns => "195.238.2.21", + dns => "195.238.2.22", + }, + N("Belgium") . "|Base" => { + apn => "gprs.base.be", + login => "base", + password => "base", + }, + N("Belgium") . "|Mobistar (personal)" => { + apn => "internet.be", + login => "mobistar", + password => "mobistar", + dns => "212.65.63.10", + dns => "212.65.63.145", + }, + N("Bulgaria") . "|GloBul" => { + apn => "internet.globul.bg", + login => "globul", + dns => "192.168.88.11", + }, + N("Bulgaria") . "|M-Tel" => { + apn => "inet-gprs.mtel.bg", + login => "mtel", + password => "mtel", + dns => "213.226.7.34", + dns => "213.226.7.35", + }, + N("Bulgaria") . "|GloBul" => { + apn => "internet.globul.bg", + login => "globul", + password => "[none]", + dns => "192.168.88.11", + }, + N("Brazil") . "|Claro" => { + apn => "claro.com.br", + login => "claro", + password => "claro", + }, + N("Brazil") . "|Oi" => { + apn => "gprs.oi.com.br", + password => "oioioi", + }, + N("Brazil") . "|TIM" => { + apn => "tim.br", + login => "tim", + password => "tim", + dns => "10.223.246.102", + dns => "10.223.246.103", + }, + N("Brazil") . "|Oi (WAP)" => { + apn => "wapgprs.oi.com.br", + login => "oiwap", + password => "oioioi", + }, + N("Brazil") . "|Velox" => { + apn => "wap.telcel.com", + login => "iesgprs", + password => "iesgprs2002", + dns => "66.36.250.14", + }, + N("Brazil") . "|Vivo" => { + apn => "zap.vivo.com.br", + login => "vivo", + password => "vivo", + }, + N("Belarus") . "|VELCOM" => { + apn => "wap.velcom.by", + login => "wap", + password => "wap", + }, + N("Belarus") . "|VELCOM (Simple GPRS)" => { + apn => "web.velcom.by", + login => "web", + password => "web", + dns => "212.98.162.154", + dns => "193.232.248.2", + }, + N("Belarus") . "|VELCOM (Web Plus)" => { + apn => "plus.velcom.by", + login => "plus", + password => "plus", + }, + N("Belarus") . "|VELCOM (Privet)" => { + apn => "privet.velcom.by", + login => "privet", + password => "privet", + }, + N("Belarus") . "|MTS" => { + apn => "internet.mts.by", + login => "mts", + password => "mts", + }, + N("Botswana") . "|Mascom Wireless" => { + apn => "internet.mascom", + }, + N("Canada") . "|Microcell Fido" => { + apn => "internet.fido.ca", + login => "fido", + password => "fido", + dns => "204.92.15.211", + dns => "207.181.101.4", + }, + N("Canada") . "|Rogers AT&T" => { + apn => "internet.com", + login => "wapuser1", + password => "wap", + dns => "207.181.101.4", + dns => "207.181.101.5", + }, + N("Congo (Kinshasa)") . "|Vodafone" => { + apn => "vodanet", + login => "vodalive", + dns => "172.24.97.1", + }, + N("Congo (Brazzaville)") . "|Vodafone" => { + apn => "vodanet", + login => "vodalive", + dns => "172.24.97.1", + }, + N("Switzerland") . "|Orange" => { + apn => "mobileoffice3g", + dns => "213.55.128.1 ", + dns => "213.55.128.2", + }, + N("Switzerland") . "|Sunrise" => { + apn => "internet", + login => "internet", + password => "internet", + dns => "212.35.35.35", + dns => "212.35.35.5", + }, + N("Switzerland") . "|Swisscom" => { + apn => "gprs.swisscom.ch", + login => "gprs", + password => "gprs", + dns => "164.128.36.34", + dns => "164.128.76.39", + }, + N("Cote d'Ivoire") . "|internet" => { + apn => "172.16.100.5", + }, + N("Chile") . "|Claro Chile" => { + apn => "bam.clarochile.cl", + login => "clarochile", + password => "clarochile", + }, + N("Chile") . "|Claro Chile - Prepago" => { + apn => "bap.clarochile.cl", + login => "clarochile", + password => "clarochile", + }, + N("Chile") . "|Claro Chile - WAP" => { + apn => "wap.clarochile.cl", + login => "clarochile", + password => "clarochile", + }, + N("Chile") . "|Entel PCS" => { + apn => "imovil.entelpcs.cl", + login => "entelpcs", + password => "entelpcs", + }, + N("Chile") . "|Entel PCS - WAP" => { + apn => "bam.entelpcs.cl", + login => "entelpcs", + password => "entelpcs", + }, + N("Chile") . "|Movistar" => { + apn => "web.tmovil.cl", + login => "web", + password => "web", + }, + N("Chile") . "|Movistar - WAP" => { + apn => "wap.tmovil.cl", + login => "wap", + password => "wap", + }, + N("Cameroon") . "|Orange" => { + apn => "orangecmgprs", + login => "orange", + password => "orange", + }, + N("Cameroon") . "|MTN" => { + apn => "INTERNET", + dns => "-", + }, + N("China") . "|China Mobile" => { + apn => "cmnet", + dns => "211.136.20.203 ", + dns => "211.136.20.203", + }, + N("China") . "|China Unicom" => { + apn => "none", + dns => "211.136.20.203 ", + dns => "211.136.20.203", + }, + N("Costa Rica") . "|IceCelular" => { + apn => "icecelular", + dns => "208.133.206.44 ", + dns => "208.133.206.44", + }, + N("Colombia") . "|Comcel" => { + apn => "internet.comcel.com.co", + login => "COMCELWEB", + password => "COMCELWEB", + }, + N("Colombia") . "|Tigo" => { + apn => "web.colombiamovil.com.co", + }, + N("Colombia") . "|Movistar" => { + apn => "internet.movistar.com.co", + login => "movistar", + password => "movistar", + }, + N("Czech Republic") . "|Cesky Mobil (postpaid)" => { + apn => "internet", + dns => "212.67.64.2", + dns => "217.77.161.131", + }, + N("Czech Republic") . "|Cesky Mobil (prepaid)" => { + apn => "Cinternet", + dns => "212.67.64.2", + dns => "217.77.161.131", + }, + N("Czech Republic") . "|EuroTel (Go)" => { + apn => "gointernet", + dns => "160.218.10.200 ", + dns => "160.218.43.200", + }, + N("Czech Republic") . "|Oscar (Post p.)" => { + apn => "internet", + login => "wap", + password => "wap", + dns => "217.77.161.130", + dns => "217.77.161.131", + }, + N("Czech Republic") . "|Oscar (Pre p.)" => { + apn => "internet", + dns => "217.77.161.130", + dns => "217.77.161.131", + }, + N("Czech Republic") . "|Paegas Internet" => { + apn => "internet.click.cz", + dns => "62.141.0.1", + dns => "62.141.0.2", + }, + N("Czech Republic") . "|Paegas Profil" => { + apn => "profil.click.cz", + dns => "62.141.0.1", + dns => "62.141.0.2", + }, + N("Czech Republic") . "|Radiomibil" => { + apn => "internet.click.cz", + }, + N("Czech Republic") . "|T-Mobil" => { + apn => "internet.t-mobile.cz", + dns => "62.141.0.1", + dns => "213.162.65.1", + }, + N("Czech Republic") . "|Eurotel (contract)" => { + apn => "internet", + dns => "160.218.10.200", + dns => "160.218.43.200", + }, + N("Czech Republic") . "|Eurotel (contract - open)" => { + apn => "internet.open", + dns => "160.218.10.200 ", + dns => "160.218.43.200", + }, + N("Czech Republic") . "|Vodafone (contract)" => { + apn => "internet", + dns => "217.77.161.130", + dns => "217.77.161.131", + }, + N("Czech Republic") . "|Telefonica (contract)" => { + apn => "internet", + dns => "160.218.10.200", + dns => "160.218.43.200", + }, + N("Czech Republic") . "|Vodafone (pre-pay)" => { + apn => "ointernet", + dns => "217.77.161.130", + dns => "217.77.161.131", + }, + N("Czech Republic") . "|Telefonica (Go)" => { + apn => "gointernet", + dns => "160.218.10.201", + dns => "194.228.2.1", + }, + N("Germany") . "|AldiTalk/MedionMobile" => { + apn => "internet.eplus.de", + login => "eplus", + password => "gprs", + dns => "212.23.97.2", + dns => "212.23.97.3", + }, + N("Germany") . "|E-Plus (pre-pay)" => { + apn => "internet.eplus.de", + login => "eplus", + password => "gprs", + dns => "212.23.97.2", + dns => "212.23.97.3", + }, + N("Germany") . "|E-Plus (contract)" => { + apn => "internet.eplus.de", + login => "eplus", + password => "gprs", + dns => "212.23.97.2", + dns => "212.23.97.3", + }, + N("Germany") . "|o2 (pay-by-MB)" => { + apn => "internet", + dns => "195.182.110.132 ", + dns => "62.134.11.4", + }, + N("Germany") . "|o2 (pay-by-time)" => { + apn => "surfo2", + dns => "195.182.110.132 ", + dns => "62.134.11.4", + }, + N("Germany") . "|o2 Viag Interkom" => { + apn => "internet", + dns => "195.182.110.132", + dns => "62.134.11.4", + }, + N("Germany") . "|T-mobile (D1)" => { + apn => "internet.t-d1.de", + password => "t-d1", + dns => "193.254.160.1 ", + dns => "193.254.160.130", + }, + N("Germany") . "|Vodafone (D2)" => { + apn => "web.vodafone.de", + login => "vodafone", + password => "vodafone", + dns => "139.7.30.125", + dns => "139.7.30.126", + }, + N("Germany") . "|Vodafone (D2) WebSessions" => { + apn => "event.vodafone.de", + login => "vodafone", + password => "vodafone", + dns => "139.7.30.125", + dns => "139.7.30.126", + }, + N("Germany") . "|FONIC" => { + apn => "pinternet.interkom.de", + }, + N("Denmark") . "|3 (Bredbånd)" => { + apn => "bredband.tre.dk", + }, + N("Denmark") . "|3 (Bredbånd Premium Kontant)" => { + apn => "net.tre.dk", + }, + N("Denmark") . "|3 (Mobil Abonnement)" => { + apn => "data.tre.dk", + }, + N("Denmark") . "|OiSTER" => { + apn => "bredband.oister.dk", + }, + N("Denmark") . "|ice.net (Nordisk Mobiltelefon)" => { + cdma => 1, + login => "cdma", + password => "cdma", + }, + N("Denmark") . "|Sonofon" => { + apn => "internet", + dns => "212.88.64.199", + dns => "212.88.64.14", + }, + N("Denmark") . "|TDC" => { + apn => "internet", + dns => "194.239.134.83", + dns => "193.162.153.164", + }, + N("Denmark") . "|Fullrate" => { + apn => "internet", + login => "Fullrate", + password => "Fullrate", + }, + N("Denmark") . "|Telia" => { + apn => "www.internet.mtelia.dk", + }, + N("Denmark") . "|BiBoB" => { + apn => "internet.bibob.dk", + }, + N("Dominican Republic") . "|Orange" => { + apn => "orangenet.com.do", + }, + N("Ecuador") . "|Porta 3G" => { + apn => "internet.porta.com.ec", + }, + N("Estonia") . "|EMT" => { + apn => "internet.emt.ee", + dns => "217.71.32.116", + dns => "217.71.32.115", + }, + N("Estonia") . "|Nordea" => { + apn => "internet.emt.ee", + }, + N("Estonia") . "|Radiolinja" => { + apn => "internet", + dns => "194.204.0.1", + }, + N("Estonia") . "|RLE" => { + apn => "internet", + }, + N("Estonia") . "|Tele2" => { + apn => "internet.tele2.ee", + login => "wap", + password => "wap", + }, + N("Egypt") . "|Click Vodafone" => { + apn => "internet.vodafone.net", + login => "internet", + password => "internet", + }, + N("Egypt") . "|Etisalat" => { + apn => "etisalat", + }, + N("Egypt") . "|MobiNil" => { + apn => "mobinilweb", + dns => "80.75.166.250", + dns => "163.121.163.201", + }, + N("Spain") . "|Amena" => { + apn => "internet", + login => "CLIENTE", + password => "AMENA", + dns => "213.143.32.20 ", + dns => "213.143.33.8", + }, + N("Spain") . "|Orange" => { + apn => "internet", + login => "CLIENTE", + password => "AMENA", + dns => "213.143.32.20 ", + dns => "213.143.33.8", + }, + N("Spain") . "|Simyo" => { + apn => "gprs-service.com", + }, + N("Spain") . "|Telefonica" => { + apn => "movistar.es", + login => "movistar", + password => "movistar", + dns => "194.179.1.100", + dns => "194.179.1.101", + }, + N("Spain") . "|Vodafone (Airtel)" => { + apn => "airtelnet.es", + login => "vodafone", + password => "vodafone", + dns => "212.73.32.3", + dns => "212.73.32.67", + }, + N("Spain") . "|Vodafone" => { + apn => "airtelnet.es", + login => "vodafone", + password => "vodafone", + dns => "196.207.32.69", + dns => "196.43.45.190", + }, + N("Spain") . "|Yoigo" => { + apn => "Internet", + }, + N("Spain") . "|Jazztel" => { + apn => "jazzinternet", + }, + N("Finland") . "|Dna" => { + apn => "internet", + dns => "217.78.192.22 ", + dns => "217.78.192.78", + }, + N("Finland") . "|Elisa" => { + apn => "internet", + }, + N("Finland") . "|Saunalahti" => { + apn => "internet.saunalahti", + }, + N("Finland") . "|Sonera" => { + apn => "internet", + dns => "192.89.123.230", + dns => "192.89.123.231", + }, + N("Finland") . "|Sonera prointernet" => { + apn => "prointernet", + dns => "192.89.123.230", + dns => "192.89.123.231", + }, + N("Fiji") . "|Vodafone" => { + apn => "vfinternet.fj", + }, + N("France") . "|Bouygues Telecom (B2Bouygtel)" => { + apn => "b2bouygtel.com", + dns => "62.201.129.99", + }, + N("France") . "|Bouygues Telecom" => { + apn => "ebouygtel.com", + dns => "62.201.129.99", + dns => "62.201.159.99", + }, + N("France") . "|France Telecom" => { + apn => "orange.fr.mnc001.mcc208.gprs", + login => "gprs", + }, + N("France") . "|Orange (contract)" => { + apn => "orange.fr", + login => "orange", + password => "orange", + dns => "194.51.3.56", + dns => "194.51.3.76", + }, + N("France") . "|Orange (business contract)" => { + apn => "internet-entreprise", + login => "orange", + password => "orange", + }, + N("France") . "|Orange (no contact)" => { + apn => "orange", + login => "orange", + password => "orange", + dns => "194.51.3.56 ", + dns => "194.51.3.76", + }, + N("France") . "|Orange MIB" => { + apn => "orange-mib", + login => "mportail", + password => "mib", + dns => "172.17.0.2 ", + dns => "172.17.0.4", + }, + N("France") . "|Orange Mobicarte" => { + apn => "orange", + login => "orange", + password => "orange", + }, + N("France") . "|Orange Internet Everywhere 3G" => { + apn => "orange.ie", + }, + N("France") . "|SFR" => { + apn => "websfr", + dns => "172.20.2.10", + dns => "172.20.2.39", + }, + N("France") . "|Transatel Telecom" => { + apn => "netgprs.com", + }, + N("France") . "|TEN" => { + apn => "ao.fr", + login => "orange", + password => "orange", + }, + N("France") . "|TEN (pay-by-MB)" => { + apn => "ofnew.fr", + login => "orange", + password => "orange", + }, + N("France") . "|Orange (business)" => { + apn => "internet-entreprise", + login => "orange", + password => "orange", + dns => "194.51.3.56", + dns => "194.51.3.76", + }, + N("France") . "|Orange (contract)" => { + apn => "orange.fr", + login => "orange", + password => "orange", + dns => "194.51.3.56", + dns => "194.51.3.76", + }, + N("United Kingdom") . "|airtel vodaphone" => { + apn => "airtel-ci-gprs.com", + }, + N("United Kingdom") . "|Jersey Telecom" => { + apn => "pepper", + login => "abc", + password => "abc", + dns => "212.9.0.135", + dns => "212.9.0.136", + }, + N("United Kingdom") . "|o2 (contract)" => { + apn => "mobile.o2.co.uk", + login => "o2web", + password => "password", + dns => "193.113.200.200", + dns => "193.113.200.201", + }, + N("United Kingdom") . "|o2 (pre-pay)" => { + apn => "payandgo.o2.co.uk", + login => "payandgo", + password => "payandgo", + }, + N("United Kingdom") . "|Orange (contract)" => { + apn => "orangeinternet", + login => "orange", + password => "orange", + dns => "193.35.133.10 ", + dns => "193.35.134.10", + }, + N("United Kingdom") . "|Orange JustTalk" => { + apn => "orangeinternet", + dns => "193.35.133.10", + dns => "193.35.134.10", + }, + N("United Kingdom") . "|T-Mobile" => { + apn => "general.t-mobile.uk", + login => "User", + password => "mms", + dns => "149.254.201.126", + dns => "149.254.192.126", + }, + N("United Kingdom") . "|Virgin Mobile" => { + apn => "vdata", + dns => "196.7.0.138", + dns => "196.7.142.132", + }, + N("United Kingdom") . "|Vodafone (contract)" => { + apn => "internet", + login => "web", + password => "web", + dns => "10.206.65.68", + dns => "10.203.65.68", + }, + N("United Kingdom") . "|Vodafone (pre-pay)" => { + apn => "pp.vodafone.co.uk", + login => "wap", + password => "wap", + dns => "172.29.1.11 ", + dns => "172.29.1.11", + }, + N("United Kingdom") . "|Vodafone (TopUp and Go)" => { + apn => "pp.internet", + }, + N("United Kingdom") . "|o2 (contract-faster)" => { + apn => "mobile.o2.co.uk", + login => "faster", + password => "password", + dns => "193.113.200.200", + dns => "193.113.200.201", + }, + N("United Kingdom") . "|3" => { + apn => "3internet", + }, + N("United Kingdom") . "|3 (handsets)" => { + apn => "three.co.uk", + }, + N("United Kingdom") . "|Orange (Pay and Go)" => { + apn => "orangewap", + login => "Multimedia", + password => "Orange", + dns => "158.43.192.1", + dns => "158.43.128.1", + }, + N("United Kingdom") . "|Orange (Pay Monthly)" => { + apn => "orangeinternet", + login => "orange", + password => "multimedia", + dns => "158.43.192.1", + dns => "158.43.128.1", + }, + N("Georgia") . "|Geocell" => { + apn => "Internet", + dns => "212.72.130.20", + dns => "212.72.152.001", + }, + N("Ghana") . "|Areeba" => { + apn => "internet.areeba.com.gh", + dns => "196.201.34.5", + dns => "213.137.131.3", + }, + N("Ghana") . "|ONETouch" => { + apn => "browse", + }, + N("Ghana") . "|Tigo" => { + apn => "web.tigo.com.gh", + login => "web", + password => 1, + }, + N("Ghana") . "|Zain" => { + apn => "internet", + }, + N("Greece") . "|Cosmote" => { + apn => "3g-internet", + dns => "195.167.65.194", + }, + N("Greece") . "|Telestet" => { + apn => "gnet.b-online.gr", + password => "24680", + dns => "212.152.79.19", + dns => "212.152.79.20", + }, + N("Greece") . "|Vodafone" => { + apn => "internet", + }, + N("Greece") . "|TIM" => { + apn => "gint.b-online.gr", + login => "web", + password => "web", + }, + N("Guatemala") . "|Comcel" => { + apn => "Wap.tigo.gt", + login => "Wap", + password => "Wap", + }, + N("Guatemala") . "|PCS Digital" => { + apn => "ideasalo", + }, + N("Guyana") . "|GT&T Cellink Plus" => { + apn => "wap.cellinkgy.com", + login => "test", + password => "test", + }, + N("Hong Kong") . "|CSL" => { + apn => "internet", + dns => "202.84.255.1", + dns => "203.116.254.150", + }, + N("Hong Kong") . "|New World" => { + apn => "internet", + }, + N("Hong Kong") . "|People" => { + apn => "internet", + }, + N("Hong Kong") . "|SmarTone" => { + apn => "internet", + dns => "202.140.96.51", + dns => "202.140.96.52", + }, + N("Hong Kong") . "|Sunday" => { + apn => "internet", + }, + N("Hong Kong") . "|Orange" => { + apn => "web.orangehk.com", + }, + N("Hong Kong") . "|Three" => { + apn => "mobile.three.com.hk", + }, + N("Honduras") . "|Tigo" => { + apn => "internet.tigo.hn", + }, + N("Croatia") . "|HTmobile" => { + apn => "www.htgprs.hr", + dns => "10.12.0.1", + }, + N("Croatia") . "|VIPNET" => { + apn => "gprs5.vipnet.hr", + login => "38591", + password => "38591", + dns => "195.29.159.15", + }, + N("Croatia") . "|VIPNET" => { + apn => "gprs0.vipnet.hr", + login => "38591", + password => "38591", + dns => "195.29.159.15", + }, + N("Croatia") . "|VIPNET" => { + apn => "3g.vip.hr", + login => "38591", + password => "38591", + dns => "212.91.97.3 ", + dns => "212.91.97.4", + }, + N("Hungary") . "|Pannon (átalánydíjas)" => { + apn => "netx", + dns => "193.225.155.254 ", + dns => "194.149.0.157", + }, + N("Hungary") . "|Pannon (normál)" => { + apn => "net", + dns => "193.225.153.17", + dns => "195.56.172.113", + }, + N("Hungary") . "|T-Mobile" => { + apn => "internet", + dns => "212.51.115.1 ", + dns => "194.176.224.6", + }, + N("Hungary") . "|Pannon (tömörített)" => { + apn => "snet", + dns => "193.225.153.17", + dns => "194.149.0.157", + }, + N("Hungary") . "|T-Mobile (mms)" => { + apn => "mms-westel", + login => "mms", + dns => "212.51.115.1", + dns => "194.176.224.3", + }, + N("Hungary") . "|Vodafone (előf. norm.)" => { + apn => "standardnet.vodafone.net", + login => "vodawap", + password => "vodawap", + dns => "80.244.97.30", + dns => "80.244.96.1", + }, + N("Hungary") . "|Vodafone (előf. töm.)" => { + apn => "internet.vodafone.net", + login => "vodawap", + password => "vodawap", + dns => "80.244.97.30", + dns => "80.244.96.1", + }, + N("Hungary") . "|Vodafone (felt. norm.)" => { + apn => "vitamax.snet.vodafone.net", + dns => "80.244.97.30", + dns => "80.244.96.1", + }, + N("Hungary") . "|Vodafone (felt. töm.)" => { + apn => "vitamax.internet.vodafone.net", + dns => "80.244.97.30", + dns => "80.244.96.1", + }, + N("Indonesia") . "|AXIS" => { + apn => "AXIS", + login => "axis", + password => "123456", + }, + N("Indonesia") . "|IM3" => { + apn => "www.imdosat-m3.net", + login => "gprs", + password => "im3", + dns => "202.155.46.66 ", + dns => "202.155.46.77", + }, + N("Indonesia") . "|Indosat" => { + apn => "satelindogprs.com", + dns => "202.152.162.250", + }, + N("Indonesia") . "|Telkomsel" => { + apn => "internet", + login => "wap", + password => "wap123", + dns => "202.152.0.2", + dns => "202.155.14.251", + }, + N("Indonesia") . "|Excelcomindo (XL)" => { + apn => "www.xlgprs.net", + login => "xlgprs", + password => "proxl", + dns => "202.152.254.245", + dns => "202.152.254.246", + }, + N("Indonesia") . "|Indosat (Matrix)" => { + apn => "satelindogprs.com indosatgprs", + dns => "202.155.46.66", + dns => "202.155.46.77", + }, + N("Ireland") . "|o2 (contract)" => { + apn => "open.internet", + login => "gprs", + password => "gprs", + dns => "62.40.32.33", + dns => "62.40.32.34", + }, + N("Ireland") . "|o2 (pre-pay)" => { + apn => "pp.internet", + login => "faster", + password => "web", + dns => "62.40.32.33", + dns => "62.40.32.34", + }, + N("Ireland") . "|Vodafone (HSDPA/GPRS/EDGE/UMTS)" => { + apn => "hs.vodafone.ie", + login => "vodafone", + password => "vodafone", + }, + N("Ireland") . "|Vodafone (GPRS/EDGE/UMTS) (old)" => { + apn => "isp.vodafone.ie", + login => "vodafone", + password => "vodafone", + }, + N("Ireland") . "|Meteor" => { + apn => "isp.mymeteor.ie", + login => "my", + password => "meteor", + }, + N("Ireland") . "|Vodafone (pre-pay)" => { + apn => "live.vodafone.com", + login => "vodafone", + password => "vodafone", + dns => "10.24.59.100", + }, + N("Ireland") . "|Three Ireland" => { + apn => "3ireland.ie", + dns => "172.31.140.69", + dns => "172.30.140.69", + }, + N("Israel") . "|CellCom" => { + apn => "etecsa", + login => "etecsa", + dns => "192.168.91.10", + dns => "192.168.91.4", + }, + N("Israel") . "|Orange" => { + apn => "orangeinternet", + dns => "158.43.192.1", + dns => "158.43.128.1", + }, + N("Israel") . "|Vodafone (MTC)" => { + apn => "apn01", + dns => "10.10.10.30", + }, + N("India") . "|Airtel" => { + apn => "airtelgprs.com", + dns => "202.56.230.5 ", + dns => "202.56.240.5", + }, + N("India") . "|BPL" => { + apn => "bplgprs.com", + login => "bplmobile", + dns => "202.169.145.34", + dns => "202.169.129.40", + }, + N("India") . "|BSNL" => { + apn => "celloneportal", + dns => "192.168.051.163", + }, + N("India") . "|BSNL Prepaid (West Bengal)" => { + apn => "www.e.pr", + dns => "218.248.240.208", + dns => "218.248.240.135", + }, + N("India") . "|Hutch (normal)" => { + apn => "www", + dns => "10.11.206.51", + dns => "10.11.206.50", + }, + N("India") . "|Hutch (Gujarat)" => { + apn => "web", + dns => "10.11.206.51", + dns => "10.11.206.50", + }, + N("India") . "|Idea Cellular" => { + apn => "internet", + dns => "10.4.42.15", + }, + N("India") . "|MTNL Delhi" => { + apn => "gprsmtnldel", + login => "mtnl", + password => "mtnl123", + }, + N("India") . "|MTNL Mumbai (pre-paid)" => { + apn => "gprsppsmum", + login => "mtnl", + password => "mtnl123", + }, + N("India") . "|MTNL Mumbai (post-paid)" => { + apn => "gprsmtnlmum", + login => "mtnl", + password => "mtnl123", + }, + N("India") . "|MTNL Mumbai (Plan 2)" => { + apn => "gprsmtnlmum", + login => "mtnl", + password => "mtnl123", + }, + N("India") . "|Orange" => { + apn => "portalnmms", + dns => "10.11.206.51", + dns => "10.11.206.50", + }, + N("India") . "|Spice telecom" => { + apn => "Simplyenjoy", + login => "Mobile number", + password => "spice", + }, + N("India") . "|Spice telecom (kar)" => { + apn => "simplydownload", + }, + N("India") . "|Tata Indicom (Plug2Surf)" => { + cdma => 1, + login => "internet", + password => "internet", + }, + N("India") . "|Telekomsel" => { + apn => "internet", + login => "wap", + password => "wap123", + }, + N("India") . "|Vodafone" => { + apn => "www", + login => "guest", + password => "guest", + }, + N("Iceland") . "|Islandssimi" => { + apn => "gprs.islandssimi.is", + dns => "213.176.128.51", + dns => "213.176.128.50", + }, + N("Iceland") . "|Nova" => { + apn => "internet.nova.is", + dns => "192.168.190.54", + dns => "192.168.190.55", + }, + N("Italy") . "|Vodafone" => { + apn => "web.omnitel.it", + }, + N("Italy") . "|TIM" => { + apn => "ibox.tim.it", + }, + N("Italy") . "|TIM (WAP)" => { + apn => "wap.tim.it", + login => "WAPTIM", + dns => "213.230.155.94 ", + dns => "213.230.130.222", + }, + N("Italy") . "|Wind" => { + apn => "internet.wind", + }, + N("Italy") . "|Wind (business)" => { + apn => "internet.wind.biz", + }, + N("Italy") . "|3 (ricaricabile)" => { + apn => "tre.it", + }, + N("Italy") . "|3 (abbonamento)" => { + apn => "datacard.tre.it", + }, + N("Italy") . "|Fastweb (SIM voce/dati)" => { + apn => "apn.fastweb.it", + }, + N("Italy") . "|Fastweb (SIM solo dati)" => { + apn => "datacard.fastweb.it", + }, + N("Jamaica") . "|Cable & Wireless" => { + apn => "wap", + }, + N("Jamaica") . "|Digicel" => { + apn => "web.digiceljamaica.com", + login => "wapuser", + password => "wap03jam", + dns => "208.131.176.126", + dns => "200.10.152.232", + }, + N("Japan") . "|Vodafone (J-Phone)" => { + apn => "vodafone", + login => "ai@vodafone", + password => "vodafone", + dns => "61.195.195.153", + dns => "61.195.194.26", + }, + N("Japan") . "|Softbank Mobile" => { + cdma => 1, + login => "ai@softbank", + password => "softbank", + }, + N("Japan") . "|e-mobile" => { + cdma => 1, + login => "em", + password => "em", + }, + N("Japan") . "|NTTdocomo" => { + cdma => 1, + }, + N("Japan") . "|au(KDDI)" => { + cdma => 1, + login => "au@au-win.ne.jp", + password => "au", + dns => "210.196.3.183", + dns => "210.141.112.163", + }, + N("Kenya") . "|Celtel" => { + apn => "ke.celtel.com", + }, + N("Kenya") . "|Safaricom" => { + apn => "web.safaricom.com", + login => "web", + password => "web", + }, + N("Kenya") . "|Econet" => { + apn => "internet.econet.co.ke", + }, + N("Kuwait") . "|Vodafone" => { + apn => "apn01", + dns => "10.10.10.30", + }, + N("Kuwait") . "|Wataniya" => { + apn => "action.wataniya.com", + }, + N("Kazakhstan") . "|Beeline" => { + apn => "internet.beeline.kz", + login => "@internet.beeline", + dns => "212.19.149.53 ", + dns => "194.226.128.1", + }, + N("Laos") . "|ETL" => { + apn => "etlnet", + dns => "192.168.4.130", + }, + N("Lebanon") . "|Cellis FTML" => { + apn => "internet.ftml.com.lb", + login => "plugged", + password => "plugged", + }, + N("Lebanon") . "|MTC Touch" => { + apn => "gprs.mtctouch.com.lb", + }, + N("Lebanon") . "|LibanCell" => { + apn => "isurf.libancell.com.lb", + }, + N("Saint Lucia") . "|Cable & Wireless" => { + apn => "internet", + dns => "-", + }, + N("Sri Lanka") . "|Airtel" => { + apn => "www.wap.airtel.lk", + }, + N("Sri Lanka") . "|Dialog GSM (Post-Paid)" => { + apn => "www.dialogsl.com", + }, + N("Sri Lanka") . "|Dialog GSM (Pre-Paid)" => { + apn => "ppinternet", + }, + N("Sri Lanka") . "|Hutch" => { + apn => "htwap", + }, + N("Sri Lanka") . "|Mobitel" => { + apn => "isp", + }, + N("Sri Lanka") . "|Tigo" => { + apn => "wap", + }, + N("Lithuania") . "|Bite" => { + apn => "banga", + login => "bite", + dns => "213.226.131.131", + dns => "193.219.88.36", + }, + N("Lithuania") . "|TELE2 GPRS" => { + apn => "internet.tele2.lt", + gateway => "130.244.196.90", + }, + N("Lithuania") . "|Omnitel (contract)" => { + apn => "gprs.omnitel.net", + dns => "194.176.32.129", + dns => "195.22.175.1", + }, + N("Lithuania") . "|Omnitel (no contract)" => { + apn => "gprs.startas.lt", + login => "omni", + password => "omni", + dns => "194.176.32.129", + dns => "195.22.175.1", + }, + N("Luxembourg") . "|LUXGSM" => { + apn => "webp.pt.lu", + dns => "194.154.192.101", + dns => "194.154.192.102", + }, + N("Luxembourg") . "|Tango" => { + apn => "internet", + login => "tango", + password => "tango", + }, + N("Luxembourg") . "|VOXmobile" => { + apn => "vox.lu", + }, + N("Latvia") . "|LMT" => { + apn => "internet.lmt.lv", + dns => "212.93.96.2", + dns => "212.93.96.4", + }, + N("Latvia") . "|Tele2" => { + apn => "internet.tele2.lv", + login => "gprs", + password => "internet", + }, + N("Morocco") . "|Maroc Telecom" => { + apn => "iam", + login => "wac", + password => "1987", + }, + N("Morocco") . "|Medi Telecom" => { + apn => "wap.meditel.ma", + login => "MEDIWAP", + password => "MEDIWAP", + }, + N("Moldova") . "|Moldcell" => { + apn => "internet", + login => "gprs", + password => "gprs", + }, + N("Moldova") . "|Eventis" => { + apn => "internet.md", + }, + N("Montenegro") . "|Mobtel Srbija" => { + apn => "internet", + login => "mobtel", + password => "gprs", + dns => "217.65.192.1", + dns => "217.65.192.52", + }, + N("Montenegro") . "|Promonte GSM" => { + apn => "gprs.promonte.com", + }, + N("Montenegro") . "|T-Mobile" => { + apn => "internet-postpaid", + login => "38167", + password => "38167", + }, + N("Montenegro") . "|Telekom Srbija (default)" => { + apn => "gprsinternet", + login => "mts", + password => "64", + dns => "195.178.38.3", + }, + N("Montenegro") . "|Telekom Srbija (via MMS)" => { + apn => "mms", + login => "mts", + password => "64", + dns => "195.178.38.3", + }, + N("Montenegro") . "|Telekom Srbija (via wap)" => { + apn => "gprswap", + login => "mts", + password => "64", + dns => "195.178.38.3", + }, + N("Mongolia") . "|MobiCom" => { + apn => "internet", + }, + N("Macao") . "|Macau Hutchison Telecom" => { + apn => "ctm-mobile", + }, + N("Macao") . "|Macau Hutchison Telecom (MMS)" => { + apn => "mms.hutchisonmacau.com", + login => "hutchison", + password => "1234", + }, + N("Macao") . "|CTM" => { + apn => "ctm-mobile", + }, + N("Macao") . "|Macau Hutchison Telecom (Internet)" => { + apn => "web.hutchisonmacau.com", + login => "hutchison", + password => "1234", + }, + N("Malta") . "|Go Mobile (Post-paid)" => { + apn => "gosurfing", + }, + N("Malta") . "|Go Mobile (Pre-paid)" => { + apn => "rtgsurfing", + }, + N("Malta") . "|Vodafone" => { + apn => "Internet", + login => "Internet", + password => "Internet", + }, + N("Mauritius") . "|Emtel" => { + apn => "WEB", + }, + N("Maldives") . "|Dhiraagu" => { + apn => "internet.dhimobile", + }, + N("Mexico") . "|TELCEL" => { + apn => "internet.itelcel.com", + login => "webgprs", + password => "webgprs2002", + dns => "148.233.151.245", + dns => "148.233.151.245", + }, + N("Mexico") . "|Iusacell" => { + cdma => 1, + }, + N("Malaysia") . "|DIGI" => { + apn => "diginet", + dns => "203.92.128.131", + dns => "203.92.128.132", + }, + N("Malaysia") . "|Maxis (contract)" => { + apn => "internet.gprs.maxis", + dns => "202.75.129.101", + dns => "10.216.4.21", + }, + N("Malaysia") . "|Maxis (pre-pay)" => { + apn => "net", + login => "maxis", + password => "net", + }, + N("Malaysia") . "|Timecel" => { + apn => "timenett.com.my", + dns => "203.121.16.85", + dns => "203.121.16.120", + }, + N("Malaysia") . "|TM Touch" => { + apn => "internet", + dns => "202.188.0.133", + }, + N("Malaysia") . "|Celcom" => { + apn => "celcom.net.my", + }, + N("Malaysia") . "|Maxis 3G (contract)" => { + apn => "unet", + login => "maxis", + password => "wap", + dns => "10.213.17.1", + dns => "10.213.17.2", + }, + N("Mozambique") . "|MCel" => { + apn => "isp.mcel.mz", + login => "guest", + password => "guest", + dns => "212.96.24.2", + dns => "212.96.24.1", + }, + N("Nigeria") . "|Zain" => { + apn => "wap", + login => "wap", + password => "wap", + }, + N("Nigeria") . "|MTN" => { + apn => "web.gprs.mtnnigeria.net", + login => "web", + password => "web", + }, + N("Nigeria") . "|Glo-Ng" => { + apn => "glosecure", + login => "gprs", + password => "gprs", + dns => "-", + }, + N("Nicaragua") . "|Alo Pcs" => { + apn => "internet.ideasalo.ni", + login => "internet", + password => "internet", + }, + N("Nicaragua") . "|Movistar" => { + apn => "internet.movistar.ni", + login => "internet", + password => "internet", + }, + N("Netherlands") . "|Hi" => { + apn => "portalmmm.nl", + }, + N("Netherlands") . "|KPN Mobile" => { + apn => "internet", + login => "KPN", + password => "gprs", + dns => "62.133.126.28", + dns => "62.133.126.29", + }, + N("Netherlands") . "|o2" => { + apn => "internet", + dns => "195.99.65.220", + dns => "195.99.66.220", + }, + N("Netherlands") . "|T-Mobile" => { + apn => "internet", + dns => "193.78.240.12", + dns => "193.79.242.39", + }, + N("Netherlands") . "|Telfort" => { + apn => "internet", + login => "telfortnl", + }, + N("Netherlands") . "|Vodafone" => { + apn => "live.vodafone.com", + login => "vodafone", + password => "vodafone", + }, + N("Netherlands") . "|Vodafone (business)" => { + apn => "office.vodafone.nl", + login => "vodafone", + password => "vodafone", + }, + N("Netherlands") . "|XS4ALL Mobiel Internet" => { + apn => "umts.xs4all.nl", + }, + N("Norway") . "|Netcom" => { + apn => "internet.netcom.no", + login => "netcom", + password => "netcom", + dns => "212.169.123.67 ", + dns => "212.45.188.254", + }, + N("Norway") . "|ice.net (Nordisk Mobiltelefon)" => { + cdma => 1, + login => "cdma", + password => "cdma", + }, + N("Norway") . "|Telenor" => { + apn => "internet", + dns => "212.17.131.3", + dns => "148.122.161.2", + }, + N("Norway") . "|TDC" => { + apn => "internet.no", + dns => "80.232.41.10", + dns => "80.232.41.20", + }, + N("Norway") . "|NetworkNorway" => { + apn => "internet", + }, + N("Norway") . "|OneCall" => { + apn => "internet", + }, + N("Norway") . "|Lebara" => { + apn => "internet", + }, + N("Norway") . "|Altibox" => { + apn => "internet", + }, + N("Norway") . "|SheTalks" => { + apn => "internet", + }, + N("Norway") . "|Telipol" => { + apn => "internet", + }, + N("Nepal") . "|Mero Mobile" => { + apn => "mero", + }, + N("New Zealand") . "|Vodafone" => { + apn => " live.vodafone.com", + dns => "202.20.93.10", + dns => "203.97.191.189", + }, + N("New Zealand") . "|Vodafone (restricted)" => { + apn => "www.vodafone.net.nz", + dns => "202.20.93.10", + dns => "203.97.191.189", + }, + N("New Zealand") . "|Vodafone (unrestricted)" => { + apn => "internet", + dns => "202.20.93.10", + dns => "203.97.191.189", + }, + N("Panama") . "|Cable and Wireless" => { + apn => "apn01.cwpanama.com.pa", + login => "xxx", + password => "xxx", + }, + N("Panama") . "|Movistar" => { + apn => "internet.movistar.pa", + login => "movistarpa", + password => "movistarpa", + }, + N("Oman") . "|Nawras" => { + apn => "isp.nawras.com.om", + }, + N("Peru") . "|Claro" => { + apn => "tim.pe", + login => "tim", + password => "tulibertad", + }, + N("Philippines") . "|Globe Telecom" => { + apn => "internet.globe.com.ph", + login => "globe", + password => "globe", + dns => "203.127.225.10", + dns => "203.127.225.11", + }, + N("Philippines") . "|Smart" => { + apn => "internet", + login => "witsductoor", + password => "banonoy", + dns => "202.57.96.3", + dns => "202.57.96.4", + }, + N("Philippines") . "|Sun Cellular" => { + apn => "minternet", + }, + N("Philippines") . "|Globe Telecoms (WAP)" => { + apn => "www.globe.com.ph", + login => "globe", + password => "globe", + dns => "203.127.225.10", + dns => "203.127.225.11", + }, + N("Pakistan") . "|Djuice" => { + apn => "172.18.19.11", + login => "telenor", + password => "telenor", + }, + N("Pakistan") . "|Mobilink GSM" => { + apn => "connect.mobilinkworld.com", + }, + N("Pakistan") . "|Mobilink GSM (jazz)" => { + apn => "jazzconnect.mobilinkworld.com", + }, + N("Pakistan") . "|Telenor" => { + apn => "internet", + login => "telenor", + password => "telenor", + }, + N("Pakistan") . "|Ufone" => { + apn => "ufone.internet", + login => "ufone", + password => "ufone", + }, + N("Pakistan") . "|ZONG" => { + apn => "zonginternet", + }, + N("Poland") . "|ERA" => { + apn => "erainternet", + login => "erainternet", + password => "erainternet", + dns => "213.158.194.1 ", + dns => "213.158.193.38", + }, + N("Poland") . "|Idea" => { + apn => "www.idea.pl", + login => "idea", + password => "idea", + dns => "194.9.223.79", + dns => "217.17.34.10", + }, + N("Poland") . "|Play Online" => { + apn => "Internet", + }, + N("Poland") . "|Polkomtel" => { + apn => "www.plusgsm.pl", + dns => "212.2.96.51 ", + dns => "212.2.96.52", + }, + N("Poland") . "|Heyah" => { + apn => "heyah.pl", + login => "heyah", + password => "heyah", + dns => "213.158.194.1", + dns => "213.158.193.38", + }, + N("Poland") . "|Orange" => { + apn => "internet", + login => "internet", + password => "internet", + dns => "194.9.223.79", + dns => "194.204.159.1", + }, + N("Poland") . "|iPlus" => { + apn => "www.plusgsm.pl", + dns => "212.2.96.51", + dns => "212.2.96.52", + }, + N("Portugal") . "|Kanguru" => { + apn => "myconnection", + dns => "62.169.67.172", + dns => "62.169.67.171", + }, + N("Portugal") . "|Kanguru (fixo)" => { + apn => "kangurufixo", + dns => "62.169.67.172", + dns => "62.169.67.171", + }, + N("Portugal") . "|Optimus" => { + apn => "internet", + dns => "194.79.69.129", + }, + N("Portugal") . "|TMN" => { + apn => "internet", + dns => "194.65.3.20", + dns => "194.65.3.21", + }, + N("Portugal") . "|Vodafone" => { + apn => "internet.vodafone.pt", + dns => "212.18.160.133", + dns => "212.18.160.134", + }, + N("Paraguay") . "|CTI" => { + apn => "internet.ctimovil.com.py", + login => "ctigprs", + password => "ctigprs999", + }, + N("Romania") . "|Orange" => { + apn => "internet", + dns => "172.22.7.21 ", + dns => "172.22.7.20", + }, + N("Romania") . "|Vodafone" => { + apn => "internet.vodafone.ro", + login => "internet.vodafone.ro", + password => "vodafone", + dns => "193.230.161.3", + dns => "193.230.161.4", + }, + N("Romania") . "|Zapp" => { + cdma => 1, + login => "zapp", + password => "zapp", + }, + N("Serbia") . "|Mobtel Srbija" => { + apn => "internet", + login => "mobtel", + password => "gprs", + dns => "217.65.192.1", + dns => "217.65.192.52", + }, + N("Serbia") . "|Telekom Srbija (default)" => { + apn => "gprsinternet", + login => "mts", + password => "64", + dns => "195.178.38.3", + }, + N("Serbia") . "|Telekom Srbija (via MMS)" => { + apn => "mms", + login => "mts", + password => "64", + dns => "195.178.38.3", + }, + N("Serbia") . "|Telekom Srbija (via wap)" => { + apn => "gprswap", + login => "mts", + password => "64", + dns => "195.178.38.3", + }, + N("Russian Federation") . "|BaikalWestCom" => { + apn => "inet.bwc.ru", + login => "bwc", + password => "bwc", + dns => "81.18.113.2", + dns => "81.18.112.50", + }, + N("Russian Federation") . "|Beeline" => { + apn => "internet.beeline.ru", + login => "beeline", + password => "beeline", + dns => "217.118.66.243", + dns => "217.118.66.244", + }, + N("Russian Federation") . "|Megafon (nw)" => { + apn => "internet.nw", + dns => "10.140.142.42 ", + dns => "10.140.142.45", + }, + N("Russian Federation") . "|МТС" => { + apn => "internet.mts.ru", + login => "mts", + password => "mts", + dns => "213.87.0.1", + dns => "213.87.1.1", + }, + N("Russian Federation") . "|PrimTelephone" => { + apn => "internet.primtel.ru", + }, + N("Russian Federation") . "|Megafon (ugsm)" => { + apn => "internet.ugsm", + dns => "83.149.32.2 ", + dns => "83.149.33.2", + }, + N("Russian Federation") . "|Megafon (usi)" => { + apn => "internet.usi.ru", + dns => "212.120.160.130 ", + dns => "212.120.160.130", + }, + N("Russian Federation") . "|Megafon (dv)" => { + apn => "internet.dv", + dns => "83.149.52.77", + dns => "194.186.112.18", + }, + N("Russian Federation") . "|Megafon (kvk)" => { + apn => "internet.kvk", + dns => "83.149.24.244 ", + dns => "62.183.50.230", + }, + N("Russian Federation") . "|Megafon (ltmsk)" => { + apn => "internet.ltmsk", + dns => "10.22.10.20 ", + dns => "10.22.10.21", + }, + N("Russian Federation") . "|Megafon (sib)" => { + apn => "internet.sib", + dns => "83.149.51.65 ", + dns => "83.149.50.65", + }, + N("Russian Federation") . "|Megafon (volga)" => { + apn => "internet.volga", + dns => "83.149.16.7 ", + dns => "195.128.128.1", + }, + N("Russian Federation") . "|Megafon (mc)" => { + apn => "internet.mc", + dns => "81.18.129.252 ", + dns => "217.150.34.1", + }, + N("Russian Federation") . "|NCC" => { + apn => "internet", + login => "ncc", + dns => "10.0.3.5 ", + dns => "10.0.3.2", + }, + N("Russian Federation") . "|NTC" => { + apn => "internet.ntc", + dns => "80.243.64.67 ", + dns => "80.243.68.34", + }, + N("Russian Federation") . "|Megafon (Moscow)" => { + apn => "internet", + login => "gdata", + password => "gdata", + }, + N("Russian Federation") . "|Enisey TeleCom" => { + apn => "internet.etk.ru", + login => "etk", + dns => "10.10.30.3", + dns => "10.10.30.4", + }, + N("Russian Federation") . "|Motiv" => { + apn => "inet.ycc.ru", + login => "motiv", + dns => "217.148.52.34", + dns => "217.148.52.3", + }, + N("Russian Federation") . "|Tatincom" => { + apn => "internet.tatincom.ru", + login => "tatincom", + password => "tatincom", + dns => "89.207.96.2", + dns => "89.207.97.18", + }, + N("Russian Federation") . "|Tele2" => { + apn => "wap.tele2.ru", + login => "gprs", + dns => "130.244.127.161", + dns => "130.244.127.169", + }, + N("Russian Federation") . "|Skylink (Moscow)" => { + cdma => 1, + login => "mobile@skylink.msk.ru", + password => "internet", + }, + N("Saudi Arabia") . "|Mobily" => { + apn => "web2", + }, + N("Saudi Arabia") . "|STC" => { + apn => "jawalnet.com.sa", + dns => "212.118.133.101", + dns => "212.118.133.102", + }, + N("Sweden") . "|3 (Mobiltelefon)" => { + apn => "data.tre.se", + }, + N("Sweden") . "|3 (Bredband)" => { + apn => "bredband.tre.se", + }, + N("Sweden") . "|3 (Bredband Kontantkort)" => { + apn => "net.tre.se", + }, + N("Sweden") . "|Glocalnet" => { + apn => "internet.glocalnet.se", + }, + N("Sweden") . "|Halebop" => { + apn => "halebop.telia.se", + }, + N("Sweden") . "|ice.net (Nordisk Mobiltelefon)" => { + cdma => 1, + login => "cdma", + password => "cdma", + }, + N("Sweden") . "|Tele2/Comviq" => { + apn => "internet.tele2.se", + }, + N("Sweden") . "|Telenor" => { + apn => "internet.telenor.se", + }, + N("Sweden") . "|Telia" => { + apn => "online.telia.se", + }, + N("Singapore") . "|M1" => { + apn => "sunsurf", + login => "65", + password => "user123", + dns => "202.79.64.21", + dns => "202.79.64.26", + }, + N("Singapore") . "|SingTel" => { + apn => "internet", + dns => "165.21.100.88", + dns => "165.21.83.88", + }, + N("Singapore") . "|Starhub" => { + apn => "shwap", + login => "star", + password => "hub", + dns => "203.116.1.78", + }, + N("Slovenia") . "|Mobitel (postpaid)" => { + apn => "internet", + login => "mobitel", + password => "internet", + dns => "213.229.248.161 ", + dns => "193.189.160.11", + }, + N("Slovenia") . "|Mobitel (prepaid)" => { + apn => "internetpro", + login => "mobitel", + password => "internet", + dns => "213.229.248.161 ", + dns => "193.189.160.11", + }, + N("Slovenia") . "|Simobil" => { + apn => "none", + dns => "121.30.86.130", + dns => "193.189.160.11", + }, + N("Slovakia") . "|T-Mobile (EuroTel)" => { + apn => "internet", + dns => "194.154.230.66 ", + dns => "194.154.230.74", + }, + N("Slovakia") . "|Globtel" => { + apn => "internet", + dns => "213.151.200.3", + dns => "195.12.140.130", + }, + N("Slovakia") . "|Orange" => { + apn => "internet", + login => "jusernejm", + password => "pasvord", + dns => "213.151.200.30 ", + dns => "213.151.208.161", + }, + N("Slovakia") . "|Eurotel" => { + apn => "internet", + dns => "194.154.230.64", + dns => "194.154.230.74", + }, + N("Senegal") . "|Tigo" => { + apn => "internet.tigo.hn", + dns => "200.85.0.104", + dns => "200.85.0.107", + }, + N("El Salvador") . "|movistar" => { + apn => "movistar.sv", + login => "movistarsv", + password => "movistarsv", + }, + N("Thailand") . "|AIS" => { + apn => "internet", + dns => "202.183.255.20", + dns => "202.183.255.21", + }, + N("Thailand") . "|DTAC" => { + apn => "www.dtac.co.th", + dns => "202.44.202.2", + dns => "203.44.144.33", + }, + N("Thailand") . "|True" => { + apn => "internet", + login => "true", + password => "true", + }, + N("Turkey") . "|Aria" => { + apn => "internet", + dns => "212.156.4.4", + dns => "212.156.4.20", + }, + N("Turkey") . "|Aycell" => { + apn => "aycell", + dns => "212.156.4.1", + dns => "212.156.4.4", + }, + N("Turkey") . "|Turkcell" => { + apn => "internet", + login => "gprs", + password => "gprs", + dns => "86.108.136.27", + dns => "86.108.136.26", + }, + N("Turkey") . "|Telsim (Post-paid)" => { + apn => "telsim", + login => "telsim", + password => "telsim", + dns => "212.65.128.20", + dns => "212.156.4.7", + }, + N("Turkey") . "|Telsim (pre-paid)" => { + apn => "prepaidgprs", + dns => "212.65.128.20", + dns => "212.156.4.7", + }, + N("Trinidad and Tobago") . "|Digicel" => { + apn => "wap.digiceltt.com", + login => "wap", + password => "wap", + }, + N("Trinidad and Tobago") . "|TSTT" => { + apn => "internet", + login => "wap", + password => "wap", + }, + N("Taiwan") . "|Chunghwa Telecom (emome)" => { + apn => "internet", + }, + N("Taiwan") . "|Far EasTone / KGT" => { + apn => "internet", + }, + N("Taiwan") . "|TW Mobile / TransAsia" => { + apn => "internet", + }, + N("Taiwan") . "|Vibo Telecom / Aurora" => { + apn => "vibo", + }, + N("Taiwan") . "|Asia Pacific Telecom (APBW)" => { + cdma => 1, + }, + N("Ukraine") . "|Jeans" => { + apn => "www.jeans.ua", + dns => "80.255.64.23", + dns => "80.255.64.24", + }, + N("Ukraine") . "|Djuice" => { + apn => "www.djuice.com.ua", + dns => "212.58.160.33", + dns => "212.58.160.34", + }, + N("Ukraine") . "|Mobi-GSM" => { + apn => "internet.urs", + dns => "213.186.192.254", + dns => "193.239.128.5", + }, + N("Ukraine") . "|Ace&Base" => { + apn => "www.ab.kyivstar.net", + login => "igprs", + password => "internet", + }, + N("Ukraine") . "|Life (standard)" => { + apn => "internet", + dns => "212.58.160.33", + dns => "212.58.160.34", + }, + N("Ukraine") . "|Beeline" => { + apn => "internet.beeline.ua", + }, + N("Ukraine") . "|Life (faster)" => { + apn => "speed", + dns => "212.58.160.33", + dns => "212.58.160.34", + }, + N("Ukraine") . "|Wellcome" => { + apn => "internet.urs", + dns => "213.186.192.254", + dns => "193.239.128.5", + }, + N("Ukraine") . "|Jeans (Hyper)" => { + apn => "hyper.net", + dns => "212.58.160.33", + dns => "212.58.160.34", + }, + N("Ukraine") . "|UMC (internet)" => { + apn => "internet", + login => "internet", + dns => "212.58.160.33", + dns => "212.58.160.34", + }, + N("Ukraine") . "|UMC (umc.ua)" => { + apn => "www.umc.ua", + dns => "80.255.64.23", + dns => "80.255.64.24", + }, + N("Ukraine") . "|Utel" => { + apn => "3g.utel.ua", + }, + N("Uganda") . "|MTN" => { + apn => "yellopix.mtn.co.ug", + dns => "212.88.97.20", + dns => "212.88.97.67", + }, + N("United States") . "|AT&T" => { + apn => "WAP.CINGULAR", + login => "WAP@CINGULARGPRS.COM", + password => "CINGULAR1", + }, + N("United States") . "|AT&T (Tethering)" => { + apn => "ISP.CINGULAR", + login => "ISP@CINGULARGPRS.COM", + password => "CINGULAR1", + }, + N("United States") . "|AT&T (Tethering with data acceleration)" => { + apn => "ISP.CINGULAR", + login => "ISPDA@CINGULARGPRS.COM", + password => "CINGULAR1", + }, + N("United States") . "|T-Mobile (Web)" => { + apn => "wap.voicestream.com", + }, + N("United States") . "|T-Mobile (Internet)" => { + apn => "internet2.voicestream.com", + }, + N("United States") . "|T-Mobile (Internet with VPN)" => { + apn => "internet3.voicestream.com", + }, + N("United States") . "|Sprint" => { + cdma => 1, + }, + N("United States") . "|Boost Mobile (Prepaid)" => { + cdma => 1, + }, + N("United States") . "|Verizon" => { + cdma => 1, + }, + N("United States") . "|US Cellular" => { + cdma => 1, + }, + N("United States") . "|Alltel" => { + cdma => 1, + }, + N("United States") . "|Leap Wireless" => { + cdma => 1, + }, + N("United States") . "|Cricket Communications" => { + cdma => 1, + }, + N("United States") . "|Jump Mobile (Prepaid)" => { + cdma => 1, + }, + N("United States") . "|MetroPCS" => { + cdma => 1, + }, + N("Uruguay") . "|Ancel" => { + apn => "gprs.ancel", + dns => "200.40.30.245 ", + dns => "200.40.220.245", + }, + N("Uruguay") . "|CTI" => { + apn => "internet.ctimovil.com.uy", + login => "ctiweb", + password => "ctiweb999", + }, + N("Uruguay") . "|Movistar" => { + apn => "webapn.movistar.com.uy", + login => "movistar", + password => "movistar", + }, + N("Uzbekistan") . "|Uzdunrobita" => { + apn => "net.urd.uz", + login => "user", + password => "pass", + }, + N("Saint Vincent and the Grenadines") . "|Digicel" => { + apn => "wap.digiceloecs.com", + login => "wapoecs", + password => "wap03oecs", + }, + N("Venezuela") . "|Digitel TIM" => { + apn => "gprsweb.digitel.ve", + dns => "57.67.127.195", + }, + N("South Africa") . "|Cell-c" => { + apn => "internet", + login => "Cellcis", + password => "Crap", + dns => "196.7.0.138", + dns => "196.7.142.132", + }, + N("South Africa") . "|MTN" => { + apn => "internet", + dns => "196.11.240.241", + dns => "209.212.97.1", + }, + N("South Africa") . "|Vodacom" => { + apn => "internet", + dns => "196.207.40.165", + dns => "196.43.46.190", + }, + N("South Africa") . "|Virgin Mobile" => { + apn => "vdata", + dns => "196.7.0.138", + dns => "196.7.142.132", + }, + N("South Africa") . "|Vodacom (unrestricted APN)" => { + apn => "unrestricted", + dns => "196.207.32.69", + dns => "196.43.45.190", + }, +); + +1; diff --git a/lib/network/connection/providers/xdsl.pm b/lib/network/connection/providers/xdsl.pm new file mode 100644 index 0000000..52b1b58 --- /dev/null +++ b/lib/network/connection/providers/xdsl.pm @@ -0,0 +1,1352 @@ +# -*- coding: utf-8 -*- +package network::connection::providers::xdsl; # $Id: xdsl.pm 59309 2006-09-01 12:08:15Z tv $ + +# This should probably be splitted out into ldetect-lst as some provider db + +use common; +use utf8; + +# Originally from : +# http://www.eagle-usb.org/article.php3?id_article=23 +# http://www.sagem.com/web-modems/download/support-fast1000-fr.htm +# http://perso.wanadoo.fr/michel-m/protocolesfai.htm +# Then other ISP found in : +# http://www.adslayuda.com/Comtrend500+file-16.html + +# the output is provided in html at http://faq.eagle-usb.org/wakka.php?wiki=ListConfigADSL +# this file should be put in /usr/share/eagle-usb/ for eagle-usb driver +# or in /usr/lib/libDrakX/network/ as part of the drakxtools + +our %data = ( + ## format chosen is the following : + # country|provider => { VPI, VCI_hexa, ... } all parameters + # country is automagically translated into LANG with N function + # provider is kept "as-is", not translated + # provider_id is used by eagleconfig to identify an ISP (I use ISO_3166-1) + # see http://en.wikipedia.org/wiki/ISO_3166-1 + # url_tech : technical URL providing info about ISP + # vpi : virtual path identifier + # vci : virtual channel identifier (in hexa below !!) + # Encapsulation: + # 1=PPPoE LLC, 2=PPPoE VCmux (never used ?) + # 3=RFC1483/2684 Routed IP LLC, + # 4=RFC1483/2684 Routed IP (IPoA VCmux) + # 5 RFC2364 PPPoA LLC, + # 6 RFC2364 PPPoA VCmux + # see http://faq.eagle-usb.org/wakka.php?wiki=AdslDescription + # dns are provided for when !usepeerdns in peers config file + # dnsServers : array ref with any valid DNS (order matters) + # DOMAINNAME2 : used for search key in /etc/resolv.conf + # method : PPPoA, pppoe, static or dhcp + # login_format : e.g. fti/login for France Telecom + # encryption : for pppd connection, when encryption is supported + # modem : model of modem provided by ISP or tested with ISP + # please forward updates to http://forum.eagle-usb.org + # try to order alphabetically by country (in English) / ISP (local language) + + N("Algeria") . "|Wanadoo" => + { + provider_id => 'DZ01', + vpi => 0, + vci => 23, + Encapsulation => 1, + method => 'pppoe', + dnsServers => [ qw(82.101.136.29 82.101.136.206) ], + }, + + N("Algeria") . "|Algerie Telecom (FAWRI)" => + { + provider_id => 'DZ02', + vpi => 0, + vci => 26, + Encapsulation => 1, + method => 'pppoe', + dnsServers => [ qw(61.88.88.88 205.252.144.228) ], + }, + + N("Argentina") . "|Speedy" => + { + provider_id => 'AR01', + vpi => 8, + vci => 23, + Encapsulation => 1, + method => 'pppoe', + dnsServers => [ qw(200.51.254.238 200.51.209.22) ], + }, + + N("Argentina") . "|Arnet" => + { + provider_id => 'AR02', + vpi => 8, + vci => 21, + Encapsulation => 1, + method => 'pppoe', + dnsServers => [ qw(200.45.191.35 200.45.191.40) ], + }, + + N("Austria") . "|" . N("Any") => + { + provider_id => 'AT00', + vpi => 8, + vci => 30, + Encapsulation => 6, + method => 'pppoa', + }, + + N("Austria") . "|AON" => + { + provider_id => 'AT01', + vpi => 1, + vci => 20, + Encapsulation => 6, + method => 'pppoa', + }, + + N("Austria") . "|Telstra" => + { + provider_id => 'AT02', + vpi => 8, + vci => 23, + Encapsulation => 1, + method => 'pppoe', + }, + + N("Australia") . "|Arachnet" => + { + provider_id => 'AU01', + url_tech => "http://www.ains.com.au/consumer/support/technical.htm", + vpi => 8, + vci => 23, + Encapsulation => 6, + method => 'pppoa', + }, + + N("Australia") . "|Speedstream On net" => + { + provider_id => 'AU02', + url_tech => "http://www.ains.com.au/consumer/support/technical.htm", + vpi => 8, + vci => 22, + Encapsulation => 6, + method => 'pppoa', + }, + + N("Australia") . "|Speedstream Off net" => + { + provider_id => 'AU03', + url_tech => "http://www.ains.com.au/consumer/support/technical.htm", + vpi => 8, + vci => 23, + Encapsulation => 1, + method => 'pppoe', + }, + + N("Belgium") . "|ADSL Office" => + { + provider_id => 'BE04', + vpi => 8, + vci => 23, + Encapsulation => 3, + method => 'pppoe', + }, + + N("Belgium") . "|Tiscali BE" => + { + provider_id => 'BE01', + vpi => 8, + vci => 23, + Encapsulation => 6, + method => 'pppoa', + dnsServers => [ qw(212.35.2.1 212.35.2.2 212.233.1.34 212.233.2.34) ], + DOMAINNAME2 => 'tiscali.be', + }, + + N("Belgium") . "|Belgacom" => + { + provider_id => 'BE03', + vpi => 8, + vci => 23, + Encapsulation => 6, + method => 'pppoa', + }, + + N("Belgium") . "|Turboline" => + { + provider_id => 'BE02', + vpi => 8, + vci => 23, + Encapsulation => 5, + method => 'pppoa', + }, + + N("Belgium") . "|Scarlet ADSL" => + { + provider_id => 'BE05', + vpi => 8, + vci => 20, + Encapsulation => 6, + method => 'pppoa', + }, + + N("Brazil") . "|Speedy/Telefonica" => + { + provider_id => 'BR01', + vpi => 8, + vci => 23, + Encapsulation => 1, + method => 'pppoe', + dnsServers => [ qw(200.204.0.10 200.204.0.138) ], + }, + + N("Brazil") . "|Velox/Telemar" => + { + provider_id => 'BR02', + vpi => 0, + vci => 21, + Encapsulation => 1, + method => 'pppoe', + }, + + N("Brazil") . "|Turbo/Brasil Telecom" => + { + provider_id => 'BR03', + vpi => 0, + vci => 23, + Encapsulation => 1, + method => 'pppoe', + }, + + N("Brazil") . "|Rio Grande do Sul (RS)" => + { + provider_id => 'BR04', + vpi => 1, + vci => 20, + Encapsulation => 1, + method => 'pppoe', + }, + + N("Bulgaria") . "|BTK ISDN" => + { + provider_id => 'BG02', + vpi => 1, + vci => 20, + Encapsulation => 1, + method => 'pppoe', + }, + + N("Bulgaria") . "|BTK POTS" => + { + provider_id => 'BG01', + vpi => 0, + vci => 23, + Encapsulation => 1, + method => 'pppoe', + }, + + N("China") . "|China Netcom|Beijing" => + { + provider_id => 'CN01', + vpi => 0, + vci => 23, + Encapsulation => 3, + method => 'pppoe', + }, + + N("China") . "|China Netcom|Changchun" => + { + provider_id => 'CN02', + vpi => 8, + vci => 23, + Encapsulation => 3, + method => 'pppoe', + }, + + N("China") . "|China Netcom|Harbin" => + { + provider_id => 'CN03', + vpi => 8, + vci => 23, + Encapsulation => 3, + method => 'pppoe', + }, + + N("China") . "|China Netcom|Jilin" => + { + provider_id => 'CN04', + vpi => 0, + vci => 27, + Encapsulation => 3, + method => 'pppoe', + }, + + N("China") . "|China Netcom|Lanzhou" => + { + provider_id => 'CN05', + vpi => 0, + vci => 20, + Encapsulation => 3, + method => 'pppoe', + }, + + N("China") . "|China Netcom|Tianjin" => + { + provider_id => 'CN06', + vpi => 0, + vci => 23, + Encapsulation => 3, + method => 'pppoe', + }, + + N("China") . "|China Netcom|Xi'an" => + { + provider_id => 'CN07', + vpi => 8, + vci => 23, + Encapsulation => 3, + method => 'pppoe', + }, + + N("China") . "|China Telecom|Chongqing" => + { + provider_id => 'CN08', + vpi => 0, + vci => 23, + Encapsulation => 3, + method => 'pppoe', + }, + + N("China") . "|China Telecom|Fujian" => + { + provider_id => 'CN09', + vpi => 0, + vci => 0xc8, + Encapsulation => 3, + method => 'pppoe', + }, + + N("China") . "|China Telecom|Guangxi" => + { + provider_id => 'CN10', + vpi => 0, + vci => 23, + Encapsulation => 3, + method => 'pppoe', + }, + + N("China") . "|China Telecom|Guangzhou" => + { + provider_id => 'CN11', + vpi => 8, + vci => 20, + Encapsulation => 3, + method => 'pppoe', + }, + + N("China") . "|China Telecom|Hangzhou" => + { + provider_id => 'CN12', + vpi => 0, + vci => 20, + Encapsulation => 3, + method => 'pppoe', + }, + + N("China") . "|China Netcom|Hunan" => + { + provider_id => 'CN13', + vpi => 0, + vci => 23, + Encapsulation => 3, + method => 'pppoe', + }, + + N("China") . "|China Telecom|Nanjing" => + { + provider_id => 'CN14', + vpi => 8, + vci => 23, + Encapsulation => 3, + method => 'pppoe', + }, + + N("China") . "|China Telecom|Shanghai" => + { + provider_id => 'CN15', + vpi => 8, + vci => 51, + Encapsulation => 3, + method => 'pppoe', + }, + + N("China") . "|China Telecom|Shenzhen" => + { + provider_id => 'CN16', + vpi => 8, + vci => 23, + Encapsulation => 3, + method => 'pppoe', + }, + + N("China") . "|China Telecom|Urumqi" => + { + provider_id => 'CN17', + vpi => 0, + vci => 20, + Encapsulation => 3, + method => 'pppoe', + }, + + N("China") . "|China Telecom|Wuhan" => + { + provider_id => 'CN18', + vpi => 0, + vci => 20, + Encapsulation => 3, + method => 'pppoe', + }, + + N("China") . "|China Telecom|Yunnan" => + { + provider_id => 'CN19', + vpi => 0, + vci => 23, + Encapsulation => 3, + method => 'pppoe', + }, + + N("China") . "|China Telecom|Zhuhai" => + { + provider_id => 'CN20', + vpi => 0, + vci => 23, + Encapsulation => 3, + method => 'pppoe', + }, + + N("Czech Republic") . "|Cesky Telecom PPPoA" => + { + provider_id => 'CZ01', + url_tech => 'http://www.telecom.cz/domacnosti/internet/pristupove_sluzby/broadband/vse_o_kz_a_moznostech_instalace.php', + vpi => 8, + vci => 30, + Encapsulation => 6, + method => 'pppoa', + }, + + N("Czech Republic") . "|Cesky Telecom PPPoE" => + { + provider_id => 'CZ02', + url_tech => 'http://www.telecom.cz/zakaznicka_podpora/dokumenty_ke_stazeni/internet_expres.php', + vpi => 8, + vci => 30, + Encapsulation => 1, + method => 'pppoe', + }, + + N("Denmark") . "|" . N("Any") => + { + provider_id => 'DK01', + vpi => 0, + vci => 65, + Encapsulation => 3, + method => 'pppoe', + }, + + N("Denmark") . "|Cybercity" => + { + provider_id => 'DK02', + vpi => 0, + vci => 23, + Encapsulation => 6, + method => 'pppoa', + }, + + N("Denmark") . "|Tiscali" => + { + provider_id => 'DK03', + vpi => 0, + vci => 23, + Encapsulation => 6, + method => 'pppoa', + }, + + N("Egypt") . "|Raya Telecom" => + { + provider_id => 'EG01', + vpi => 8, + vci => 50, + method => 'pppoa', + Encapsulation => 6, + dnsServers => [ qw(62.240.110.197 62.240.110.198) ], + }, + + N("Finland") . "|Sonera" => + { + provider_id => 'FI01', + vpi => 0, + vci => 64, + Encapsulation => 3, + method => 'pppoe', + }, + + N("France") . "|Free non dégroupé 512/128 & 1024/128" => + { + provider_id => 'FR01', + vpi => 8, + vci => 23, + Encapsulation => 6, + CMVep => 'FR', + dnsServers => [ qw(213.228.0.23 212.27.32.176) ], + method => 'pppoa', + DOMAINNAME2 => 'free.fr', + }, + + N("France") . "|Free non dégroupé ADSL Max" => + { + provider_id => 'FR11', + vpi => 8, + vci => 23, + Encapsulation => 6, + CMVep => 'FR04', + dnsServers => [ qw(213.228.0.23 212.27.32.176) ], + method => 'pppoa', + DOMAINNAME2 => 'free.fr', + }, + + N("France") . "|Free dégroupé 1024/256 (mini)" => + { + provider_id => 'FR04', + vpi => 8, + vci => 24, + Encapsulation => 4, + CMVep => 'FR04', + dnsServers => [ qw(213.228.0.23 212.27.32.176 213.228.0.68 212.27.32.176 212.27.32.177 212.27.39.2 212.27.39.1) ], + method => 'dhcp', + DOMAINNAME2 => 'free.fr', + }, + + N("France") . "|n9uf tel9com 512 & dégroupé 1024" => + { + provider_id => 'FR05', + vpi => 8, + vci => 23, + Encapsulation => 6, + CMVep => 'FR', + dnsServers => [ qw(212.30.93.108 212.203.124.146 62.62.156.12 62.62.156.13) ], + method => 'pppoa', + }, + + N("France") . "|Cegetel non dégroupé 512 IP/ADSL et dégroupé" => + { + provider_id => 'FR08', + vpi => 8, + vci => 23, + Encapsulation => 6, + CMVep => 'FR', + dnsServers => [ qw(212.94.174.85 212.94.174.86) ], + method => 'pppoa', + login_format => 'login@cegetel.net', + }, + + N("France") . "|Cegetel ADSL Max 8 Mb" => + { + provider_id => 'FR10', + vpi => 8, + vci => 23, + Encapsulation => 6, + CMVep => 'FR10', + dnsServers => [ qw(212.94.174.85 212.94.174.86) ], + method => 'pppoa', + login_format => 'login@cegetel.net', + }, + + N("France") . "|Club-Internet" => + { + provider_id => 'FR06', + vpi => 8, + vci => 23, + Encapsulation => 6, + CMVep => 'FR', + dnsServers => [ qw(194.117.200.10 194.117.200.15) ], + method => 'pppoa', + DOMAINNAME2 => 'club-internet.fr', + }, + + N("France") . "|Orange" => + { + provider_id => 'FR09', + vpi => 8, + vci => 23, + Encapsulation => 6, + CMVep => 'FR', + dnsServers => [ qw(80.10.246.2 80.10.246.129) ], + method => 'pppoa', + login_format => 'fti/login', + DOMAINNAME2 => 'orange.fr', + }, + + N("France") . "|Télé2" => + { + provider_id => 'FR02', + vpi => 8, + vci => 23, + Encapsulation => 6, + CMVep => 'FR', + dnsServers => [ qw(212.151.136.242 130.244.127.162 212.151.136.246) ], + method => 'pppoa', + }, + + N("France") . "|Tiscali.fr 128k" => + { + provider_id => 'FR03', + vpi => 8, + vci => 23, + Encapsulation => 5, + CMVep => 'FR', + dnsServers => [ qw(213.36.80.1 213.36.80.2) ], + method => 'pppoa', + }, + + N("France") . "|Tiscali.fr 512k" => + { + provider_id => 'FR07', + vpi => 8, + vci => 23, + Encapsulation => 6, + CMVep => 'FR', + dnsServers => [ qw(213.36.80.1 213.36.80.2) ], + method => 'pppoa', + }, + + N("Germany") . "|Deutsche Telekom (DT)" => + { + provider_id => 'DE01', + vpi => 1, + vci => 20, + Encapsulation => 1, + method => 'pppoe', + }, + + N("Germany") . "|1&1" => + { + provider_id => 'DE02', + vpi => 1, + vci => 20, + Encapsulation => 1, + dnsServers => [ qw(195.20.224.234 194.25.2.129) ], + method => 'pppoe', + }, + + N("Germany") . "|Alice DSL" => + { + provider_id => 'DE03', + vpi => 1, + vci => 20, + Encapsulation => 1, + dnsServers => [ qw(213.191.73.65 213.191.74.20) ], + method => 'pppoe', + }, + + N("Greece") . "|" . N("Any") => + { + provider_id => 'GR01', + vpi => 8, + vci => 23, + Encapsulation => 6, + method => 'pppoa', + }, + + N("Hungary") . "|Matav" => + { + provider_id => 'HU01', + vpi => 1, + vci => 20, + Encapsulation => 1, + method => 'pppoe', + }, + + N("Ireland") . "|" . N("Any") => + { + provider_id => 'IE01', + vpi => 8, + vci => 23, + Encapsulation => 1, + method => 'pppoe', + }, + + N("Israel") . "|Barak 013" => + { + provider_id => 'IL03', + vpi => 8, + vci => 48, + Encapsulation => 6, + dnsServers => [ qw(212.150.49.10 206.49.94.234 212.150.48.169) ], + method => 'pppoa' + }, + + N("Israel") . "|Bezeq 014" => + { + provider_id => 'IL04', + vpi => 8, + vci => 48, + Encapsulation => 6, + dnsServers => [ qw(192.115.106.10 192.115.106.11 192.115.106.35) ], + method => 'pppoa' + }, + + N("Israel") . "|Bezeq" => + { + provider_id => 'IL01', + vpi => 8, + vci => 30, + Encapsulation => 6, + dnsServers => [ qw(192.115.106.10 192.115.106.11 192.115.106.35) ], + method => 'pppoa', + }, + + N("Israel") . "|BGU" => + { + provider_id => 'IL06', + vpi => 8, + vci => 48, + Encapsulation => 6, + dnsServers => [ qw(132.72.140.46 132.72.140.45) ], + method => 'pppoa' + }, + + N("Israel") . "|HaifaU" => + { + provider_id => 'IL07', + vpi => 8, + vci => 48, + Encapsulation => 6, + dnsServers => [ qw(132.74.1.3 132.74.1.5) ], + method => 'pppoa' + }, + + N("Israel") . "|HUJI" => + { + provider_id => 'IL08', + vpi => 8, + vci => 48, + Encapsulation => 6, + dnsServers => [ qw(128.139.6.1 128.139.4.3) ], + method => 'pppoa' + }, + + N("Israel") . "|Kavey Zahave 012" => + { + provider_id => 'IL02', + vpi => 8, + vci => 48, + Encapsulation => 6, + dnsServers => [ qw(212.117.129.3 212.117.128.6) ], + method => 'pppoa' + }, + + N("Israel") . "|Netvision 017" => + { + provider_id => 'IL01', + vpi => 8, + vci => 48, + Encapsulation => 6, + dnsServers => [ qw(212.143.212.143 194.90.1.5) ], + method => 'pppoa' + }, + + N("Israel") . "|Smile 015" => + { + provider_id => 'IL05', + vpi => 8, + vci => 48, + Encapsulation => 6, + dnsServers => [ qw(192.116.202.222 213.8.172.83) ], + method => 'pppoa' + }, + + N("Israel") . "|TAU" => + { + provider_id => 'IL09', + vpi => 8, + vci => 48, + Encapsulation => 6, + dnsServers => [ qw(132.66.32.10 132.66.16.2) ], + method => 'pppoa' + }, + + N("Israel") . "|Technion" => + { + provider_id => 'IL10', + vpi => 8, + vci => 48, + Encapsulation => 6, + dnsServers => [ qw(132.68.1.2 132.68.1.9) ], + method => 'pppoa' + }, + + N("India") . "|" . N("Any") => + { + provider_id => 'IN01', + vpi => 0, + vci => 20, + Encapsulation => 6, + method => 'pppoa', + }, + + N("Iceland") . "|Islandssimi" => + { + provider_id => 'IS01', + vpi => 0, + vci => 23, + Encapsulation => 6, + method => 'pppoa', + }, + + N("Iceland") . "|Landssimi" => + { + provider_id => 'IS02', + vpi => 8, + vci => 30, + Encapsulation => 6, + method => 'pppoa', + }, + + N("Italy") . "|Telecom Italia" => + { + provider_id => 'IT01', + vpi => 8, + vci => 23, + Encapsulation => 6, + CMVep => 'IT', + dnsServers => [ qw(195.20.224.234 194.25.2.129) ], + method => 'pppoa', + }, + + N("Italy") . "|Telecom Italia/Office Users (ADSL Smart X)" => + { + provider_id => 'IT02', + vpi => 8, + vci => 23, + Encapsulation => 3, + CMVep => 'IT', + method => 'static', + }, + + N("Italy") . "|Tiscali.it, Alice" => + { + provider_id => 'IT03', + vpi => 8, + vci => 23, + Encapsulation => 6, + CMVep => 'IT', + dnsServers => [ qw(195.20.224.234 194.25.2.129) ], + method => 'pppoa', + }, + + N("Italy") . "|Libero.it" => + { + provider_id => 'IT04', + url_tech => 'http://internet.libero.it/assistenza/adsl/installazione_ass.phtml', + vpi => 8, + vci => 23, + Encapsulation => 6, + CMVep => 'IT', + dnsServers => [ qw(193.70.192.25 193.70.152.25) ], + method => 'pppoa', + }, + + N("Sri Lanka") . "|Srilanka Telecom" => + { + provider_id => 'LK01', + url_tech => 'http://www.sltnet.lk', + vpi => 8, + vci => 23, + Encapsulation => 6, + dnsServers => [ qw(203.115.0.1 203.115.0.18) ], + method => 'pppoa', + encryption => 1, + }, + + N("Lithuania") . "|Lietuvos Telekomas" => + { + provider_id => 'LT01', + vpi => 8, + vci => 23, + Encapsulation => 1, + method => 'pppoe', + }, + + N("Mauritius") . "|wanadoo.mu" => + { + provider_id => 'MU01', + vpi => 8, + vci => 23, + Encapsulation => 6, + dnsServers => [ qw(202.123.2.6 202.123.2.11) ], + method => 'pppoa', + }, + + N("Mauritius") . "|Telecom Plus (Mauritius Telecom)" => + { + provider_id => 'MU02', + url_tech => 'http://www.telecomplus.net', + vpi => 8, + vci => 23, + Encapsulation => 6, + dnsServers => [ qw(202.123.1.6 202.123.1.11) ], + method => 'pppoa', + }, + + N("Morocco") . "|Maroc Telecom" => + { + provider_id => 'MA01', + vpi => 8, + vci => 23, + Encapsulation => 6, + dnsServers => [ qw(212.217.0.1 212.217.0.12) ], + method => 'pppoa', + }, + + N("Netherlands") . "|KPN" => + { + provider_id => 'NL01', + vpi => 8, + vci => 30, + Encapsulation => 6, + method => 'pppoa', + }, + + N("Netherlands") . "|Eager Telecom" => + { + provider_id => 'NL02', + vpi => 0, + vci => 21, + Encapsulation => 3, + method => 'pppoe', + }, + + N("Netherlands") . "|Tiscali" => + { + provider_id => 'NL03', + vpi => 0, + vci => 22, + Encapsulation => 1, + method => 'pppoe', + }, + + N("Netherlands") . "|Versatel" => + { + provider_id => 'NL04', + vpi => 0, + vci => 20, + Encapsulation => 3, + method => 'pppoe', + }, + + N("Norway") . "|Bluecom" => + { + provider_id => 'NO01', + method => 'dhcp', + }, + + N("Norway") . "|Firstmile" => + { + provider_id => 'NO02', + method => 'dhcp', + }, + + N("Norway") . "|NextGenTel" => + { + provider_id => 'NO03', + method => 'dhcp', + }, + + N("Norway") . "|SSC" => + { + provider_id => 'NO04', + method => 'dhcp', + }, + + N("Norway") . "|Tele2" => + { + provider_id => 'NO05', + method => 'dhcp', + }, + + N("Norway") . "|Telenor ADSL" => + { + provider_id => 'NO06', + method => 'PPPoE', + }, + + N("Norway") . "|Tiscali" => + { + provider_id => 'NO07', + vpi => 8, + vci => 35, + method => 'dhcp', + }, + + N("Pakistan") . "|Micronet BroadBand" => + { + provider_id => 'PK01', + vpi => 1, + vci => 20, + Encapsulation => 3, + dnsServers => [ qw(203.82.48.3 203.82.48.4) ], + method => 'pppoe', + encryption => 1, + }, + + N("Poland") . "|Telekomunikacja Polska (TPSA/neostrada)" => + { + provider_id => 'PL01', + vpi => 0, + vci => 23, + Encapsulation => 6, + dnsServers => [ qw(194.204.152.34 217.98.63.164) ], + method => 'pppoa', + }, + + N("Poland") . "|Netia neostrada" => + { + provider_id => 'PL02', + url_tech => 'http://www.netia.pl/?o=d&s=210', + vpi => 8, + vci => 23, + Encapsulation => 1, + dnsServers => [ qw(195.114.181.130 195.114.161.61) ], + method => 'pppoe', + }, + + N("Portugal") . "|PT" => + { + provider_id => 'PT01', + vpi => 0, + vci => 23, + Encapsulation => 1, + method => 'pppoe', + }, + + N("Russia") . "|MTU-Intel" => + { + provider_id => 'RU01', + url_tech => 'http://stream.ru/s-requirements', + vpi => 1, + vci => 32, + Encapsulation => 1, + dnsServers => [ qw(212.188.4.10 195.34.32.116) ], + method => 'pppoe', + }, + + N("Singapore") . "|Singnet" => + { + provider_id => 'SG01', + vpi => 0, + vci => 64, + method => 'pppoa', + Encapsulation => 6, + }, + + N("Senegal") . "|Sonatel Multimedia Sentoo" => + { + provider_id => 'SN01', + vpi => 0, + vci => 35, + Encapsulation => 6, + method => 'pppoa', + DOMAINNAME2 => 'sentoo.sn', + }, + + N("Slovenia") . "|SiOL" => + { + provider_id => 'SL01', + vpi => 1, + vci => 20, + method => 'pppoe', + Encapsulation => 1, + dnsServers => [ qw(193.189.160.11 193.189.160.12) ], + DOMAINNAME2 => 'siol.net', + }, + + N("Spain") . "|Telefónica IP dinámica" => + { + provider_id => 'ES01', + vpi => 8, + vci => 20, + Encapsulation => 1, + CMVep => 'ES', + dnsServers => [ qw(80.58.32.33 80.58.0.97) ], + method => 'pppoe', + login_format => 'adslppp@telefonicanetpa / adslppp', + }, + + N("Spain") . "|Telefónica ip fija" => + { + provider_id => 'ES02', + vpi => 8, + vci => 20, + Encapsulation => 3, + CMVep => 'ES', + dnsServers => [ qw(80.58.32.33 80.58.0.97) ], + method => 'static', + login_format => 'adslppp@telefonicanetpa / adslppp', + }, + + N("Spain") . "|Wanadoo/Eresmas Retevision" => + { + provider_id => 'ES03', + vpi => 8, + vci => 23, + Encapsulation => 6, + CMVep => 'ES', + dnsServers => [ qw(80.58.0.33 80.58.32.97) ], + method => 'pppoa', + login_format => 'rtxxxxx@wanadooadsl', + encryption => 1, + }, + + N("Spain") . "|Wanadoo PPPoE" => + { + provider_id => 'ES04', + vpi => 8, + vci => 20, + Encapsulation => 1, + CMVep => 'ES', + method => 'pppoe', + }, + + N("Spain") . "|Wanadoo ip fija" => + { + provider_id => 'ES05', + vpi => 8, + vci => 20, + Encapsulation => 3, + CMVep => 'ES', + method => 'static', + }, + + N("Spain") . "|Tiscali" => + { + provider_id => 'ES06', + vpi => 1, + vci => 20, + Encapsulation => 6, + CMVep => 'ES', + method => 'pppoa', + login_format => 'login@tiscali.es', + }, + + N("Spain") . "|Arrakis" => + { + provider_id => 'ES07', + vpi => 0, + vci => 23, + Encapsulation => 6, + CMVep => 'ES', + method => 'pppoa', + }, + + N("Spain") . "|Auna" => + { + provider_id => 'ES08', + vpi => 0, + vci => 23, + Encapsulation => 6, + CMVep => 'ES', + method => 'pppoa', + }, + + N("Spain") . "|Communitel" => + { + provider_id => 'ES09', + vpi => 0, + vci => 21, + Encapsulation => 6, + CMVep => 'ES', + method => 'pppoa', + }, + + N("Spain") . "|Euskatel" => + { + provider_id => 'ES10', + vpi => 8, + vci => 20, + Encapsulation => 1, + CMVep => 'ES', + method => 'pppoe', + }, + + N("Spain") . "|Uni2" => + { + provider_id => 'ES11', + vpi => 1, + vci => 21, + Encapsulation => 6, + CMVep => 'ES', + method => 'pppoa', + }, + + N("Spain") . "|Ya.com PPPoE" => + { + provider_id => 'ES12', + vpi => 8, + vci => 20, + Encapsulation => 1, + CMVep => 'ES', + method => 'pppoe', + login_format => 'adXXXXXXXXX@yacomadsl', + }, + + N("Spain") . "|Ya.com static" => + { + provider_id => 'ES13', + vpi => 8, + vci => 20, + Encapsulation => 3, + CMVep => 'ES', + method => 'static', + login_format => 'adXXXXXXXXX@yacomadsl', + }, + + N("Spain") . "|Arsys" => + { + provider_id => 'ES14', + vpi => 1, + vci => 21, + Encapsulation => 1, + CMVep => 'ES', + dnsServers => [ qw(217.76.128.4 217.76.129.4) ], + method => 'pppoe', + login_format => 'login@arsystel', + }, + + N("Spain") . "|Terra" => + { + provider_id => 'ES15', + vpi => 8, + vci => 20, + Encapsulation => 1, + CMVep => 'ES', + dnsServers => [ qw(213.4.132.1 213.4.141.1) ], + method => 'pppoe', + login_format => 'login@terraadsl', + }, + + N("Spain") . "|Jazztel" => + { + provider_id => 'ES16', + vpi => 8, + vci => 23, + Encapsulation => 6, + CMVep => 'ES', + dnsServers => [ qw(62.14.63.145 62.14.2.1) ], + method => 'pppoa', + login_format => 'username@adsl', + encryption => 1, + }, + + N("Sweden") . "|Telia" => + { + provider_id => 'SE01', + vpi => 8, + vci => 23, + Encapsulation => 3, + method => 'pppoe', + }, + + N("Switzerland") . "|" . N("Any") => + { + provider_id => 'CH01', + vpi => 8, + vci => 23, + Encapsulation => 3, + method => 'pppoe', + }, + + N("Switzerland") . "|BlueWin / Swisscom" => + { + provider_id => 'CH02', + vpi => 8, + vci => 23, + Encapsulation => 5, + dnsServers => [ qw(195.186.4.108 195.186.4.109) ], + method => 'pppoa', + }, + + N("Switzerland") . "|VTX Datacomm (ex-Tiscali)" => + { + provider_id => 'CH03', + vpi => 8, + vci => 23, + Encapsulation => 1, + method => 'pppoa', + }, + + N("Thailand") . "|Asianet" => + { + provider_id => 'TH01', + vpi => 0, + vci => 64, + Encapsulation => 1, + dnsServers => [ qw(203.144.225.242 203.144.225.72 203.144.223.66) ], + method => 'pppoe', + }, + + N("Tunisia") . "|Planet.tn" => + { + provider_id => 'TU01', + url_tech => 'http://www.planet.tn/', + vpi => 0, + vci => 23, + Encapsulation => 5, + dnsServers => [ qw(193.95.93.77 193.95.66.10) ], + method => 'pppoe', + }, + + N("Turkey") . "|TTnet" => + { + provider_id => 'TR01', + url_tech => 'http://www.ttnet.net.tr', + vpi => 8, + vci => 23, + Encapsulation => 1, + dnsServers => [ qw(195.175.37.14 195.175.37.69) ], + method => 'pppoe', + encryption => 1, + login_format => 'login@ttnet', + }, + + N("United Arab Emirates") . "|Etisalat" => + { + provider_id => 'AE01', + vpi => 0, + vci => 32, + Encapsulation => 5, + dnsServers => [ qw(213.42.20.20 195.229.241.222) ], + method => 'pppoa', + }, + + N("United Kingdom") . "|Tiscali UK " => + { + provider_id => 'UK01', + vpi => 0, + vci => 26, + Encapsulation => 6, + dnsServers => [ qw(212.74.112.66 212.74.112.67) ], + method => 'pppoa', + }, + + N("United Kingdom") . "|British Telecom " => + { + provider_id => 'UK02', + vpi => 0, + vci => 26, + Encapsulation => 6, + dnsServers => [ qw(194.74.65.69 194.72.9.38) ], + method => 'pppoa', + }, + + ); + +1; diff --git a/lib/network/connection/wireless.pm b/lib/network/connection/wireless.pm new file mode 100644 index 0000000..ad02481 --- /dev/null +++ b/lib/network/connection/wireless.pm @@ -0,0 +1,1132 @@ +package network::connection::wireless; + +use base qw(network::connection::ethernet); + +use strict; +use common; +use log; +use network::network; + +#- class attributes: +#- network: ID of the selected network + +sub get_type_name() { N("Wireless") } +sub get_type_description() { N("Wireless (Wi-Fi)") } +sub _get_type_icon() { 'wireless' } +sub get_devices { + my ($_class, %options) = @_; + require detect_devices; + my @devices = detect_devices::probe_category('network/wireless'); + my @wireless = grep { detect_devices::is_wireless_interface($_) } detect_devices::get_lan_interfaces(); + my @all_devices = (@devices, network::connection::ethernet::get_unlisted_devices(\@wireless, \@devices)); + foreach (@all_devices) { + my $interface = $_->{interface} || network::connection::ethernet::device_to_interface($_) or next; + my $driver = network::connection::ethernet::interface_to_driver($interface) or next; + $_->{driver} = $driver if $driver; + } + @all_devices, + if_(!$options{automatic_only}, { + driver => 'ndiswrapper', + description => N("Use a Windows driver (with ndiswrapper)"), + }); +} + +sub handles_ifcfg { + my ($_class, $ifcfg) = @_; + require detect_devices; + detect_devices::is_wireless_interface($ifcfg->{DEVICE}) || exists $ifcfg->{WIRELESS_MODE}; +} + +sub get_metric { 35 } + +#- http://www.linux-wireless.org/Install-HOWTO/WL/WEP-Key-HOWTO.txt +my $wpa_supplicant_max_wep_key_len = 32; + +our %wireless_enc_modes = ( + none => N_("None"), + open => N_("Open WEP"), + restricted => N_("Restricted WEP"), + 'wpa-psk' => N_("WPA/WPA2 Pre-Shared Key"), + 'wpa-eap' => N_("WPA/WPA2 Enterprise"), +); +#define the eap related variables we handle +#0 means we preserve value if found +#1 means we save without quotes +#2 save with quotes +my %eap_vars = ( + ssid => 2, + scan_ssid => 1, + identity => 2, + password => 2, + key_mgmt => 1, + eap => 1, + pairwise => 1, + group => 1, + proto => 1, + ca_cert => 2, + client_cert => 2, + phase2 => 2, + anonymous_identity => 2, + subject_match => 2, + disabled => 0, + id_str => 0, + bssid => 0, + priority => 0, + auth_alg => 0, + eapol_flags => 0, + proactive_key_caching => 0, + peerkey => 0, + ca_path => 0, + private_key => 0, + private_key_passwd => 0, + dh_file => 0, + altsubject_match => 0, + phase1 => 0, + fragment_size => 0, + eap_workaround => 0, +); + +my @thirdparty_settings = ( + { + name => 'zd1201', + description => 'ZyDAS ZD1201', + url => 'http://linux-lc100020.sourceforge.net/', + firmware => { + test_file => 'zd1201*.fw', + }, + }, + + (map { + { + name => "ipw${_}", + description => "Intel(R) PRO/Wireless ${_}", + url => "http://ipw${_}.sourceforge.net/", + firmware => { + url => "http://ipw${_}.sourceforge.net/firmware.php", + test_file => "ipw$_-*.fw", + }, + }; + } (2100, 2200)), + + { + name => "ipw3945", + description => "Intel(R) PRO/Wireless 3945", + url => "http://ipw3945.sourceforge.net/", + firmware => { + package => "ipw3945-ucode", + test_file => "ipw3945.ucode", + }, + tools => { + package => "ipw3945d", + test_file => '/usr/sbin/ipw3945d', + }, + }, + + (map { + my ($version, $ucode_api, $ucode_version) = @$_; + $ucode_version ||= $version; + { + name => "iwl${version}", + description => "Intel(R) PRO/Wireless ${version}", + url => "http://intellinuxwireless.org/", + firmware => { + package => "iwlwifi-${version}-ucode", + test_file => "iwlwifi-${ucode_version}${ucode_api}.ucode", + }, + sleep => 1, + }; + } ([ 3945, '-1' ], [ 4965, '-1' ], [ 'agn', '-1', 5000 ])), + + { + name => 'p54pci', + description => 'PCI adaptors based on the Intersil Prism54 chip series', + url => 'http://wireless.kernel.org/en/users/Drivers/p54', + firmware => { + url => 'http://wireless.kernel.org/en/users/Drivers/p54#firmware', + test_file => "isl3886pci", + }, + }, + + { + name => 'p54usb', + description => 'USB adaptors based on the Intersil Prism54 chip series', + url => 'http://wireless.kernel.org/en/users/Drivers/p54', + firmware => { + url => 'http://wireless.kernel.org/en/users/Drivers/p54#firmware', + test_file => "isl388*usb", + }, + }, + + { + name => 'atmel', + matching => [ qw(at76_usb atmel_cs atmel_pci) ], + description => 'Atmel at76c50x cards', + url => 'http://thekelleys.org.uk/atmel/', + firmware => { + test_file => 'atmel_at76c50*', + }, + links => 'http://at76c503a.berlios.de/', + }, + + { + name => 'madwifi', + matching => 'ath_pci', + description => 'Multiband Atheros Driver for WiFi', + url => 'http://madwifi.org/', + kernel_module => 1, + tools => { + optional => 1, + test_file => '/usr/bin/athstats', + }, + }, + + { + name => 'prism2', + matching => qr/^prism2_/, + description => 'Prism2 based cards', + tools => { + package => 'prism2-utils', + test_file => '/sbin/wlanctl-ng', + }, + }, + + { + name => 'zd1211', + matching => 'zd1211rw', + description => 'ZD1211 chip', + firmware => { + url => 'http://sourceforge.net/projects/zd1211/', + test_file => 'zd1211/zd1211_*', + }, + }, + + { + name => 'bcm43xx', + description => 'Broadcom bcm43xx wireless chips', + url => 'http://bcm43xx.berlios.de/', + firmware => { + test_file => 'bcm43xx_microcode*.fw', + no_package => 1, + extract => { + name => 'bcm43xx-fwcutter', + test_file => '/usr/bin/bcm43xx-fwcutter', + windows_source => 'bcmwl5.sys', + default_source => 'bcmwl5.sys', + run => sub { + my ($file) = @_; + run_program::rooted($::prefix, '/usr/bin/bcm43xx-fwcutter', + '-w', $network::thirdparty::firmware_directory, $file); + }, + }, + }, + }, + + (map { + +{ + name => $_, + description => "Broadcom $_ wireless chips", + url => 'http://wireless.kernel.org/en/users/Drivers/b43', + firmware => { + test_file => $_ . "/ucode*.fw", + no_package => 1, + extract => { + name => 'b43-fwcutter', + test_file => '/usr/bin/b43-fwcutter', + windows_source => 'bcmwl5.sys', + default_source => 'bcmwl5.sys', + run => sub { + my ($file) = @_; + run_program::rooted($::prefix, '/usr/bin/b43-fwcutter', + '-w', $network::thirdparty::firmware_directory, $file); + }, + }, + }, + }; + } qw(b43 b43legacy)), + + { + name => 'broadcom-wl', + matching => 'wl', + description => 'Broadcom Hybrid', + url => 'http://www.broadcom.com/support/802.11/linux_sta.php', + kernel_module => 1, + }, + + { + name => 'acx100', + matching => [ qw(acx_pci acx_usb) ], + description => 'ACX100/ACX111/TNETW1450', + firmware => { + url => 'http://acx100.sourceforge.net/wiki/Firmware', + test_file => 'tiacx1*', + no_distro_package => 1, + }, + }, + + { + name => 'ndiswrapper', + description => 'Wireless device using ndiswrapper (windows drivers)', + tools => { + test_file => '/usr/sbin/ndiswrapper', + }, + firmware => { + user_install => sub { + my ($settings, $in) = @_; + require network::ndiswrapper; + $settings->{device} = network::ndiswrapper::select_device($in) or return; + network::ndiswrapper::setup_device($in, $settings->{device}); + $settings->{device}{driver} = $settings->{name}; + }, + url => 'http://ndiswrapper.sourceforge.net/mediawiki/index.php/List', + component_name => N_("Windows driver"), + no_package => 1, + }, + no_module_reload => 1, + }, + + { + name => 'rt61', + matching => 'rt61pci', + description => 'Ralink RT61 802.11abg WLAN', + firmware => { + url => 'http://rt2x00.serialmonkey.com/', + test_file => 'rt2661.bin', + }, + }, + + { + name => 'rt73', + matching => 'rt73usb', + description => 'Ralink RT73 802.11abg WLAN', + firmware => { + url => 'http://rt2x00.serialmonkey.com/', + test_file => 'rt73.bin', + }, + }, + + (map { + +{ + name => "rt${_}", + matching => qr/^rt${_}(sta|)$/, + description => 'Ralink RT${_} WiFi', + kernel_module => 1, + firmware => { + url => 'http://www.ralinktech.com/', + test_file => "rt${_}.bin", + }, + }; + } (2860, 2870, 3090)), + + { + name => 'rtl8187se', + matching => 'r8180', + description => 'Realtek RTL8180 / RTL8185 WiFi', + kernel_module => 1, + }, +); + +sub get_packages { 'wireless-tools' } + +sub get_thirdparty_settings() { + \@thirdparty_settings; +} + +sub setup_thirdparty { + my ($self, $in) = @_; + require network::rfswitch; + network::rfswitch::configure(); + if ($self->get_driver eq 'ndiswrapper') { + require network::ndiswrapper; + my @devices = map { network::ndiswrapper::present_devices($_) } network::ndiswrapper::installed_drivers(); + return {} if member($self->{device}, @devices) && network::ndiswrapper::find_interface($self->{device}); + } + my $thirdparty = $self->SUPER::setup_thirdparty($in); + my $driver = $self->get_driver; + if ($self->{thirdparty} && $driver eq 'ipw3945' && !$self->rf_killed && !$self->SUPER::check_device) { + log::explanations("Reloading module $driver"); + eval { modules::unload($driver) }; + eval { modules::load($driver) }; + } + $thirdparty; +} + +sub rf_killed { + my ($self) = @_; + if ($self->{device}{sysfs_device}) { + my $rf_kill_path = $self->{device}{sysfs_device} . "/rf_kill"; + if (-e $rf_kill_path) { + my $rf_kill = chomp_(cat_($rf_kill_path)); + #- for ipw drivers, 0 means no RF kill switch + return $rf_kill != 0; + } + } + undef; +} + +sub check_device { + my ($self) = @_; + if ($self->rf_killed) { + $self->{device}{error} = N("Your wireless card is disabled, please enable the wireless switch (RF kill switch) first."); + return 0; + } + return $self->SUPER::check_device; +} + +sub load_interface_settings { + my ($self) = @_; + $self->network::connection::load_interface_settings; + $self->{hide_passwords} = 1; + # override ifcfg with network-specific settings if available + my $network = $self->get_selected_network; + $self->{ifcfg}= $network ? + get_network_ifcfg($network->{ap}) || get_network_ifcfg($network->{essid}) : + $self->{ifcfg}; + + $self->SUPER::map_ifcfg2config_settings; +} + +sub get_networks { + my ($self, $o_net) = @_; + require network::monitor; + ($self->{networks}, $self->{control}{roaming}) = network::monitor::list_wireless($o_net && $o_net->{monitor}, $self->get_interface); + $self->probed_networks; + $self->{networks}; +} + +sub refresh_roaming_ids { + my ($self) = @_; + #- needed when switching from non-roaming to roaming + #- or after restarting wpa_supplicant + #- to get fresh wpa_supplicant network IDs + get_networks($self) if $self->{control}{roaming}; +} + +sub selected_network_is_configured { + my ($self) = @_; + $self->refresh_roaming_ids; + $self->SUPER::selected_network_is_configured; +} + +sub guess_network { + my ($_self) = @_; + #- FIXME: try to find the AP matching $self->{ifcfg}{WIRELESS_ESSID}; +} + +sub get_network_ifcfg { + my ($ssid) = @_; + require network::network; + my $file = $::prefix . $network::network::wireless_d . '/' . $ssid; + -f $file && { getVarsFromSh($file) }; +} + +sub guess_network_access_settings { + my ($self) = @_; + + my $network = $self->get_selected_network; + my $ifcfg = $self->{ifcfg}; + $ifcfg ||= {}; + + $self->{access}{network}{bssid} = $network && $network->{hidden} && $network->{ap}; + $self->{access}{network}{essid} = $network && $network->{essid} || $ifcfg->{WIRELESS_ESSID} || !$network && "any"; + ($self->{access}{network}{key}, my $restricted, $self->{access}{network}{force_ascii_key}) = + get_wep_key_from_iwconfig($ifcfg->{WIRELESS_ENC_KEY}); + + $self->{access}{network}{encryption} = + $network && $network->{flags} =~ /eap/i ? + 'wpa-eap' : + $network && $network->{flags} =~ /wpa/i ? + 'wpa-psk' : + $network && $network->{flags} =~ /wep/i || $self->{access}{network}{key} ? + $ifcfg->{WIRELESS_ENC_MODE} || ($restricted ? 'restricted' : 'open') : + 'none'; + + undef $self->{ifcfg}{WIRELESS_IWPRIV} if is_old_rt2x00($self->get_driver) && $self->{ifcfg}{WIRELESS_IWPRIV} =~ /WPAPSK/; + + my $system_file = '/etc/sysconfig/drakx-net'; + my %global_settings = getVarsFromSh($system_file); + $self->{control}{roaming} = + (exists $self->{ifcfg}{WIRELESS_WPA_DRIVER} || text2bool($global_settings{ROAMING})) + && !is_old_rt2x00($self->get_driver); + + $self->{access}{network}{mode} = + $network && $network->{mode} || + $ifcfg->{WIRELESS_MODE} || + 'Managed'; + + wpa_supplicant_load_eap_settings($self->{access}{network}) if $self->need_wpa_supplicant; +} + +sub get_network_access_settings_label { N("Wireless settings") } + +sub get_network_access_settings { + my ($self) = @_; + [ + { label => N("Operating Mode"), val => \$self->{access}{network}{mode}, + list => [ N_("Ad-hoc"), N_("Managed"), N_("Master"), N_("Repeater"), N_("Secondary"), N_("Auto") ], + format => \&translate, + }, + { label => N("Network name (ESSID)"), val => \$self->{access}{network}{essid}, + disabled => sub { my $network = $self->get_selected_network; $network && $network->{essid} } }, + { label => N("Encryption mode"), val => \$self->{access}{network}{encryption}, list => [ keys %wireless_enc_modes ], + sort => 1, format => sub { translate($wireless_enc_modes{$_[0]}) } }, + { label => N("Encryption key"), val => \$self->{access}{network}{key}, + hidden => sub { $self->{hide_passwords} }, + disabled => sub { member($self->{access}{network}{encryption}, qw(none wpa-eap)) } }, + { text => N("Hide password"), + type => "bool", val => \$self->{hide_passwords} }, + { text => N("Force using this key as ASCII string (e.g. for Livebox)"), + type => "bool", val => \$self->{access}{network}{force_ascii_key}, + disabled => sub { + #- only for WEP keys looking like hexadecimal + !member($self->{access}{network}{encryption}, qw(open restricted)) || + !get_hex_key($self->{access}{network}{key}); + } }, + { label => N("EAP Login/Username"), val => \$self->{access}{network}{eap_identity}, + disabled => sub { $self->{access}{network}{encryption} ne 'wpa-eap' }, + help => N("The login or username. Format is plain text. If you +need to specify domain then try the untested syntax + DOMAIN\\username") }, + { label => N("EAP Password"), val => \$self->{access}{network}{eap_password}, + hidden => sub { $self->{hide_passwords} }, + disabled => sub { $self->{access}{network}{encryption} ne 'wpa-eap' }, + help => N(" Password: A string. +Note that this is not the same thing as a psk. +____________________________________________________ +RELATED ADDITIONAL INFORMATION: +In the Advanced Page, you can select which EAP mode +is used for authentication. For the eap mode setting + Auto Detect: implies all possible modes are tried. + +If Auto Detect fails, try the PEAP TTLS combo bofore others +Note: + The settings MD5, MSCHAPV2, OTP and GTC imply +automatically PEAP and TTLS modes. + TLS mode is completely certificate based and may ignore +the username and password values specified here.") }, + { label => N("EAP client certificate"), val => \$self->{access}{network}{eap_client_cert}, + disabled => sub { $self->{access}{network}{encryption} ne 'wpa-eap' }, + help => N("The complete path and filename of client certificate. This is +only used for EAP certificate based authentication. It could be +considered as the alternative to username/password combo. + Note: other related settings are shown on the Advanced page.") }, + { label => N("Network ID"), val => \$self->{ifcfg}{WIRELESS_NWID}, advanced => 1 }, + { label => N("Operating frequency"), val => \$self->{ifcfg}{WIRELESS_FREQ}, advanced => 1 }, + { label => N("Sensitivity threshold"), val => \$self->{ifcfg}{WIRELESS_SENS}, advanced => 1 }, + { label => N("Bitrate (in b/s)"), val => \$self->{ifcfg}{WIRELESS_RATE}, advanced => 1 }, + { label => N("RTS/CTS"), val => \$self->{ifcfg}{WIRELESS_RTS}, advanced => 1, + help => N("RTS/CTS adds a handshake before each packet transmission to make sure that the +channel is clear. This adds overhead, but increase performance in case of hidden +nodes or large number of active nodes. This parameter sets the size of the +smallest packet for which the node sends RTS, a value equal to the maximum +packet size disable the scheme. You may also set this parameter to auto, fixed +or off.") + }, + { label => N("Fragmentation"), val => \$self->{ifcfg}{WIRELESS_FRAG}, advanced => 1 }, + { label => N("iwconfig command extra arguments"), val => \$self->{ifcfg}{WIRELESS_IWCONFIG}, advanced => 1, + help => N("Here, one can configure some extra wireless parameters such as: +ap, channel, commit, enc, power, retry, sens, txpower (nick is already set as the hostname). + +See iwconfig(8) man page for further information."), + }, + { label => + #-PO: split the "xyz command extra argument" translated string into two lines if it's bigger than the english one + N("iwspy command extra arguments"), val => \$self->{ifcfg}{WIRELESS_IWSPY}, advanced => 1, + help => N("iwspy is used to set a list of addresses in a wireless network +interface and to read back quality of link information for each of those. + +This information is the same as the one available in /proc/net/wireless : +quality of the link, signal strength and noise level. + +See iwpspy(8) man page for further information."), + }, + { label => N("iwpriv command extra arguments"), val => \$self->{ifcfg}{WIRELESS_IWPRIV}, advanced => 1, + disabled => sub { $self->need_rt2x00_iwpriv }, + help => N("iwpriv enable to set up optionals (private) parameters of a wireless network +interface. + +iwpriv deals with parameters and setting specific to each driver (as opposed to +iwconfig which deals with generic ones). + +In theory, the documentation of each device driver should indicate how to use +those interface specific commands and their effect. + +See iwpriv(8) man page for further information."), + }, + { label => N("EAP Protocol"), val => \$self->{access}{network}{forceeap}, + list => [ N_("Auto Detect"), N_("WPA2"), N_("WPA") ], + sort => 1, format => \&translate, advanced => 1, + help => N("Auto Detect is recommended as it first tries WPA version 2 with +a fallback to WPA version 1") }, + { label => N("EAP Mode"), val => \$self->{access}{network}{eap_eap}, + list => [ N_("Auto Detect"), N_("PEAP"), N_("TTLS"), N_("TLS"), N_("MSCHAPV2"), N_("MD5"), N_("OTP"), N_("GTC"), N_("LEAP") , N_("PEAP TTLS"), N_("TTLS TLS") ], + sort => 1, format => \&translate, advanced => 1, }, + { label => N("EAP key_mgmt"), val => \$self->{access}{network}{eap_key_mgmt}, advanced => 1, + disabled => sub { $self->{access}{network}{encryption} ne 'wpa-eap' }, + help => N("list of accepted authenticated key management protocols. +possible values are WPA-EAP, IEEE8021X, NONE") }, + { label => N("EAP outer identity"), val => \$self->{access}{network}{eap_anonymous_identity}, advanced => 1, + disabled => sub { $self->{access}{network}{encryption} ne 'wpa-eap' }, + help => N("Anonymous identity string for EAP: to be used as the +unencrypted identity with EAP types that support different +tunnelled identity, e.g., TTLS") }, + { label => N("EAP phase2"), val => \$self->{access}{network}{eap_phase2}, advanced => 1, + disabled => sub { $self->{access}{network}{encryption} ne 'wpa-eap' } , + help => N("Inner authentication with TLS tunnel parameters. +input is string with field-value pairs, Examples: +auth=MSCHAPV2 for PEAP or +autheap=MSCHAPV2 autheap=MD5 for TTLS") }, + { label => N("EAP CA certificate"), val => \$self->{access}{network}{eap_ca_cert}, advanced => 1, + disabled => sub { $self->{access}{network}{encryption} ne 'wpa-eap' }, + help => N("Full file path to CA certificate file (PEM/DER). This file +can have one or more trusted CA certificates. If ca_cert are not +included, server certificate will not be verified. If possible, +a trusted CA certificate should always be configured +when using TLS or TTLS or PEAP.") }, + { label => N("EAP certificate subject match"), val => \$self->{access}{network}{eap_subject_match}, advanced => 1, + disabled => sub { $self->{access}{network}{encryption} ne 'wpa-eap' }, + help => N(" Substring to be matched against the subject of +the authentication server certificate. If this string is set, +the server sertificate is only accepted if it contains this +string in the subject. The subject string is in following format: +/C=US/ST=CA/L=San Francisco/CN=Test AS/emailAddress=as\@example.com") }, + { label => N("Extra directives"), val => \$self->{access}{network}{extra}, advanced => 1, + help => N("Here one can pass extra settings to wpa_supplicant +The expected format is a string field=value pair. Multiple values +maybe specified, separating each value with the # character. +Note: directives are passed unchecked and may cause the wpa +negotiation to fail silently. Supported directives are preserved +across editing. +Supported directives are : + disabled, id_str, bssid, priority, auth_alg, eapol_flags, + proactive_key_caching, peerkey, ca_path, private_key, + private_key_passwd, dh_file, altsubject_match, phase1, + fragment_size and eap_workaround, pairwise, group + Others such as key_mgmt, eap maybe used to force + special settings different from the U.I settings.") }, + ]; +} + +sub check_network_access_settings { + my ($self) = @_; + + if (!member($self->{access}{network}{encryption}, qw(none wpa-eap)) && !$self->{access}{network}{key}) { + $self->{network_access}{error}{message} = N("An encryption key is required."); + $self->{network_access}{error}{field} = \$self->{access}{network}{key}; + return 0; + } + + if ($self->{access}{network}{encryption} eq 'wpa-psk' && + !convert_psk_key_for_wpa_supplicant($self->{access}{network}{key})) { + $self->{network_access}{error}{message} = N("The pre-shared key should have between 8 and 63 ASCII characters, or 64 hexadecimal characters."); + $self->{network_access}{error}{field} = \$self->{access}{network}{key}; + return 0; + } + if (member($self->{access}{network}{encryption}, qw(open restricted)) && + !convert_wep_key_for_wpa_supplicant($self->{access}{network}{key}, $self->{access}{network}{force_ascii_key})) { + $self->{network_access}{error}{message} = N("The WEP key should have at most %d ASCII characters or %d hexadecimal characters.", + $wpa_supplicant_max_wep_key_len, $wpa_supplicant_max_wep_key_len * 2); + $self->{network_access}{error}{field} = \$self->{access}{network}{key}; + return 0; + } + + if ($self->{ifcfg}{WIRELESS_FREQ} && $self->{ifcfg}{WIRELESS_FREQ} !~ /[0-9.]*[kGM]/) { + $self->{network_access}{error}{message} = N("Freq should have the suffix k, M or G (for example, \"2.46G\" for 2.46 GHz frequency), or add enough '0' (zeroes)."); + $self->{network_access}{error}{field} = \$self->{ifcfg}{WIRELESS_FREQ}; + return 0; + } + + if ($self->{ifcfg}{WIRELESS_RATE} && $self->{ifcfg}{WIRELESS_RATE} !~ /[0-9.]*[kGM]/) { + $self->{network_access}{error}{message} = N("Rate should have the suffix k, M or G (for example, \"11M\" for 11M), or add enough '0' (zeroes)."); + $self->{network_access}{error}{field} = \$self->{ifcfg}{WIRELESS_RATE}; + return 0; + } + + return 1; +} + +sub get_control_settings { + my ($self) = @_; + [ + @{$self->SUPER::get_control_settings}, + { text => N("Allow access point roaming"), val => \$self->{control}{roaming}, type => "bool", + disabled => sub { is_wpa_supplicant_blacklisted($self->get_driver) } }, + ]; +} + +sub need_wpa_supplicant { + my ($self) = @_; + ($self->{control}{roaming} || $self->{access}{network}{encryption} =~ /^wpa-/) && !is_old_rt2x00($self->get_driver); +} + +sub install_packages { + my ($self, $in) = @_; + if ($self->need_wpa_supplicant) { + $in->do_pkgs->ensure_is_installed('wpa_supplicant', '/usr/sbin/wpa_supplicant') or return; + $in->do_pkgs->ensure_is_installed('mandi', '/usr/sbin/mandi'); + } + $self->SUPER::install_packages($in); +} + + +sub build_ifcfg_settings { + my ($self) = @_; + + # if we are not using WEP, the key is always ASCII (#52128) + $self->{access}{network}{force_ascii_key} = 1 unless member($self->{access}{network}{encryption}, qw(open restricted)); + + my $settings = { + WIRELESS_MODE => $self->{access}{network}{mode}, + if_($self->need_wpa_supplicant, + WIRELESS_WPA_DRIVER => wpa_supplicant_get_driver($self->get_driver), + WIRELESS_WPA_REASSOCIATE => bool2yesno($self->need_wpa_supplicant_reassociate), + MII_NOT_SUPPORTED => 'no', + ), + WIRELESS_ESSID => $self->{access}{network}{essid}, + if_($self->{access}{network}{encryption} ne 'none', + WIRELESS_ENC_KEY => convert_wep_key_for_iwconfig($self->{access}{network}{key}, $self->{access}{network}{force_ascii_key})), + if_(member($self->{access}{network}{encryption}, qw(open restricted)), + WIRELESS_ENC_MODE => $self->{access}{network}{encryption}), + if_($self->need_rt2x00_iwpriv, + #- use iwpriv for WPA with rt2400/rt2500 drivers, they don't plan to support wpa_supplicant + WIRELESS_IWPRIV => qq(set AuthMode=WPAPSK +set EncrypType=TKIP +set SSID=$self->{access}{network}{essid} +set WPAPSK="$self->{access}{network}{key}" +set TxRate=0)), + (map { $_ => $self->{ifcfg}{$_} } + qw(WIRELESS_NWID WIRELESS_FREQ WIRELESS_SENS WIRELESS_RATE WIRELESS_RTS WIRELESS_FRAG WIRELESS_IWCONFIG WIRELESS_IWSPY), if_(!$self->need_rt2x00_iwpriv, 'WIRELESS_IWPRIV')), + }; + $self->SUPER::build_ifcfg_settings($settings); +} + +sub add_network_to_wpa_supplicant { + my ($self) = @_; + if ($self->{access}{network}{encryption} eq 'wpa-eap') { + wpa_supplicant_add_eap_network($self->{access}{network}); + } else { + wpa_supplicant_add_network($self->{access}{network}); + } + #- this should be handled by the monitoring daemon instead + run_program::run('/usr/sbin/wpa_cli', 'reconfigure'); +} + +sub write_settings { + my ($self, $o_net, $o_modules_conf) = @_; + + my $network = $self->get_selected_network; + network::network::write_wireless_conf($_, $self->build_ifcfg_settings) foreach + grep { $_ } ($network ? $network->{ap} : ()), $self->{access}{network}{essid}; + + $self->add_network_to_wpa_supplicant if $self->need_wpa_supplicant; + + wlan_ng_configure($self->{access}{network}{essid}, $self->{access}{network}{key}, $self->get_interface, $self->get_driver) if $self->{thirdparty}{name} eq 'prism2'; + + $self->SUPER::write_settings($o_net, $o_modules_conf); +} + +sub apply_network_selection { + my ($self) = @_; + require network::network; + my $file = network::network::get_ifcfg_file($self->get_interface); + network::network::write_interface_settings($self->build_ifcfg_settings, $file); + + $self->add_network_to_wpa_supplicant if $self->need_wpa_supplicant; +} + +sub network_is_configured { + my ($self, $network) = @_; + if ($self->{control}{roaming}) { + return defined $network->{id}; + } else { + my $wireless_ifcfg = get_network_ifcfg($network->{ap}) || defined $network->{essid} && get_network_ifcfg($network->{essid}); + return $wireless_ifcfg; + } +} + +sub connect { + my ($self, $_in, $net) = @_; + + $self->SUPER::connect; + + if ($self->{control}{roaming}) { + my $network_id; + foreach (0 .. 1) { + $self->refresh_roaming_ids if $_; + my $network = $self->get_selected_network; + $network_id = $network->{id} if $network && defined $network->{id}; + } + if (defined $network_id) { + if ($net->{monitor}) { + log::explanations("selecting wpa_supplicant network $network_id through network monitor"); + eval { $net->{monitor}->select_network($network_id) }; + return !$@; + } else { + run_program::run('/usr/sbin/wpa_cli', 'select_network', $network_id); + } + } + } +} + +sub get_status_message { + my ($self, $status) = @_; + my $interface = $self->get_interface; + my ($current_essid, $current_ap) = get_access_point($interface); + my $network = $current_essid || $current_ap && "[$current_ap]"; + { + link_up => N("Associated to wireless network \"%s\" on interface %s", $network, $interface), + link_down => N("Lost association to wireless network on interface %s", $interface), + }->{$status} || $self->SUPER::get_status_message($status); +} + + + +my $wpa_supplicant_conf = "/etc/wpa_supplicant.conf"; + +sub get_access_point { + my ($intf) = @_; + (chomp_(`/sbin/iwgetid -r $intf 2>/dev/null`), lc(chomp_(`/sbin/iwgetid -r -a $intf 2>/dev/null`))); +} + +sub is_old_rt2x00 { + my ($module) = @_; + member($module, qw(rt2400 rt2500 rt2570 rt61 rt73)); +} + +sub is_wpa_supplicant_blacklisted { + my ($module) = @_; + is_old_rt2x00($module); +} + +sub need_wpa_supplicant_reassociate { + my ($self) = @_; + $self->get_driver eq 'rt61pci'; +} + +sub need_rt2x00_iwpriv { + my ($self) = @_; + is_old_rt2x00($self->get_driver) && $self->{access}{network}{encryption} eq 'wpa-psk'; +} + +sub get_hex_key { + my ($key) = @_; + #- odd number or non-hexa characters, consider the key as ASCII and prepend "s:" + if ($key =~ /^([[:xdigit:]]{4}[\:-]?)+[[:xdigit:]]{2,}$/) { + $key =~ s/[\:-]//g; + return lc($key); + } +} + +sub convert_wep_key_for_iwconfig { + my ($real_key, $force_ascii) = @_; + !$force_ascii && get_hex_key($real_key) || "s:$real_key"; +} + +sub convert_wep_key_for_wpa_supplicant { + my ($key, $force_ascii) = @_; + if (my $hex_key = !$force_ascii && get_hex_key($key)) { + return length($hex_key) <= $wpa_supplicant_max_wep_key_len * 2 && $hex_key; + } else { + return length($key) <= $wpa_supplicant_max_wep_key_len && qq("$key"); + } +} + +sub get_wep_key_from_iwconfig { + my ($key) = @_; + my ($mode, $real_key) = $key =~ /^(?:(open|restricted)\s+)?(.*)$/; + my $is_ascii = $real_key =~ s/^s://; + my $force_ascii = to_bool($is_ascii && get_hex_key($real_key)); + ($real_key, $mode eq 'restricted', $force_ascii); +} + +sub convert_psk_key_for_wpa_supplicant { + my ($key) = @_; + my $l = length($key); + $l == 64 ? + get_hex_key($key) : + $l >= 8 && $l <= 63 ? + qq("$key") : + undef; +} + +#- FIXME: to be improved (quotes, comments) +sub wlan_ng_update_vars { + my ($file, $vars) = @_; + substInFile { + while (my ($key, $value) = each(%$vars)) { + s/^#?\Q$key\E=(?:"[^#]*"|[^#\s]*)(\s*#.*)?/$key=$value$1/ and delete $vars->{$key}; + } + $_ .= join('', map { "$_=$vars->{$_}\n" } keys %$vars) if eof; + } $file; +} + +sub wlan_ng_configure { + my ($essid, $key, $device, $module) = @_; + my $wlan_conf_file = "$::prefix/etc/wlan/wlan.conf"; + my @wlan_devices = split(/ /, (cat_($wlan_conf_file) =~ /^WLAN_DEVICES="(.*)"/m)[0]); + push @wlan_devices, $device unless member($device, @wlan_devices); + #- enable device and make it use the choosen ESSID + wlan_ng_update_vars($wlan_conf_file, + { + WLAN_DEVICES => qq("@wlan_devices"), + "SSID_$device" => qq("$essid"), + "ENABLE_$device" => "y" + }); + + my $wlan_ssid_file = "$::prefix/etc/wlan/wlancfg-$essid"; + #- copy default settings for this ESSID if config file does not exist + -f $wlan_ssid_file or cp_f("$::prefix/etc/wlan/wlancfg-DEFAULT", $wlan_ssid_file); + + #- enable/disable encryption + wlan_ng_update_vars($wlan_ssid_file, + { + (map { $_ => $key ? "true" : "false" } qw(lnxreq_hostWEPEncrypt lnxreq_hostWEPDecrypt dot11PrivacyInvoked dot11ExcludeUnencrypted)), + AuthType => $key ? qq("sharedkey") : qq("opensystem"), + if_($key, + dot11WEPDefaultKeyID => 0, + dot11WEPDefaultKey0 => qq("$key") + ) + }); + #- hide settings for non-root users + chmod 0600, $wlan_conf_file; + chmod 0600, $wlan_ssid_file; + + #- apply settings on wlan interface + require services; + services::restart($module eq 'prism2_cs' ? 'pcmcia' : 'wlan'); +} + +sub wpa_supplicant_get_driver { + my ($module) = @_; + $module =~ /^hostap_/ ? "hostap" : + $module eq "prism54" ? "prism54" : + $module =~ /^ath_/ ? "madwifi" : + $module =~ /^at76c50|atmel_/ ? "atmel" : + "wext"; +} + +sub wpa_supplicant_add_network { + my ($ui_input) = @_; + my $conf = wpa_supplicant_read_conf(); + + # use shorter variables + my $essid = $ui_input->{essid}; + my $bssid = $ui_input->{bssid}; + my $enc_mode = $ui_input->{encryption}; + my $key = $ui_input->{key}; + my $force_ascii = $ui_input->{force_ascii_key}; + my $mode = $ui_input->{mode}; + + my $network = { + ssid => qq("$essid"), + scan_ssid => to_bool($bssid), #- hidden or non-broadcasted SSIDs + if_($bssid, bssid => $bssid), + if_($enc_mode ne 'none', priority => 1), + }; + + if ($enc_mode eq 'wpa-psk') { + $network->{psk} = convert_psk_key_for_wpa_supplicant($key); + } else { + $network->{key_mgmt} = 'NONE'; + $network->{mode} = to_bool($mode eq 'Ad-hoc'); + if (member($enc_mode, qw(open restricted))) { + put_in_hash($network, { + wep_key0 => convert_wep_key_for_wpa_supplicant($key, $force_ascii), + wep_tx_keyidx => 0, + auth_alg => $enc_mode eq 'restricted' ? 'SHARED' : 'OPEN', + }); + } + } + + #- handle extra variables as final overides + handle_extra_params($network, $ui_input->{extra}); + + @$conf = difference2($conf, [ wpa_supplicant_find_similar($conf, $network) ]); + push @$conf, $network; + wpa_supplicant_write_conf($conf); +} + +sub wpa_supplicant_find_similar { + my ($conf, $network) = @_; + grep { + my $current = $_; + any { exists $network->{$_} && $network->{$_} eq $current->{$_} } qw(ssid bssid); + } @$conf; +} + +sub wpa_supplicant_read_conf() { + my @conf; + my $network; + foreach (cat_($::prefix . $wpa_supplicant_conf)) { + if ($network) { + #- in a "network = {}" block + # value is either the string with "quotes" - or a full-length string + if (/^\s*(\w+)=\s*(?|([^"].*)|("[^"]*")).*$/) { + $network->{$1} = $2; + } elsif (/^\}/) { + #- end of network block + push @conf, $network; + undef $network; + } + } elsif (/^\s*network={/) { + #- beginning of a new network block + $network = {}; + } + } + \@conf; +} + +sub wpa_supplicant_write_conf { + my ($conf) = @_; + my $buf; + my @conf = @$conf; + my $network; + foreach (cat_($::prefix . $wpa_supplicant_conf)) { + if ($network) { + #- in a "network = {}" block + if (/^\s*(\w+)=(.*)$/) { + push @{$network->{entries}}, { key => $1, value => $2 }; + member($1, qw(ssid bssid)) and $network->{$1} = $2; + } elsif (/^\}/) { + #- end of network block, write it + $buf .= "network={$network->{comment}\n"; + + my $new_network = first(wpa_supplicant_find_similar(\@conf, $network)); + foreach (@{$network->{entries}}) { + my $key = $_->{key}; + if ($new_network) { + #- do not write entry if not provided in the new network + exists $new_network->{$key} or next; + #- update value from the new network + $_->{value} = delete $new_network->{$key}; + } + $buf .= " "; + $buf .= "$key=$_->{value}" if $key; + $buf .= "$_->{comment}\n"; + } + if ($new_network) { + #- write new keys + while (my ($key, $value) = each(%$new_network)) { + $buf .= " $key=$value\n"; + } + } + $buf .= "}\n"; + $new_network and @conf = grep { $_ != $new_network } @conf; + undef $network; + } else { + #- unrecognized, keep it anyway + push @{$network->{entries}}, { comment => $_ }; + } + } else { + if (/^\s*network={/) { + #- beginning of a new network block + $network = {}; + } else { + #- keep other options, comments + $buf .= $_; + } + } + } + + #- write remaining networks + foreach (@conf) { + $buf .= "\nnetwork={\n"; + while (my ($key, $value) = each(%$_)) { + $buf .= " $key=$value\n"; + } + $buf .= "}\n"; + } + + output($::prefix . $wpa_supplicant_conf, $buf); + #- hide keys for non-root users + chmod 0600, $::prefix . $wpa_supplicant_conf; +} + +sub wpa_supplicant_load_eap_settings { + my ($network) = @_; + my $quoted_essid = qq("$network->{essid}"); + my $conf = wpa_supplicant_read_conf(); + foreach my $old_net (@$conf) { + if ($old_net->{ssid} eq $network->{essid} || $old_net->{ssid} eq $quoted_essid) { + $network->{extra} = ''; + foreach my $eap_var (keys %eap_vars) { + next if $eap_var eq 'ssid'; + my $ui_var = join('_', "eap", $eap_var); + if (defined $old_net->{$eap_var}) { + if ($eap_vars{$eap_var} == 0) { + if ($network->{extra} eq "") { + $network->{extra} = "$eap_var=$old_net->{$eap_var}"; + } else { + $network->{extra} = join('#', $network->{extra}, "$eap_var=$old_net->{$eap_var}"); + } + } else { + $network->{$ui_var} = $old_net->{$eap_var}; + #- remove quotes on selected variables + $network->{$ui_var} = $1 if $eap_vars{$eap_var} == 2 && $network->{$ui_var} =~ /^"(.*)"$/; + if ($eap_var eq "proto") { + $network->{forceeap} = 'WPA2' if $old_net->{$eap_var} eq "RSN"; + $network->{forceeap} = 'WPA' if $old_net->{$eap_var} eq "WPA"; + } + } + } + } + last; + } + } +} + +sub handle_extra_params { + my ($network, $extra) = @_; + #- handle extra variables as final overides + if (defined $extra && $extra ne "") { + #- FIXME: should split it on what the # sign? + foreach my $extra_var (split('#', $extra)) { + my ($key, $val) = split('=', $extra_var, 2); + $network->{$key} = $val; + } + } +} +sub wpa_supplicant_add_eap_network { + my ($ui_input) = @_; + + #- expect all variables for us to be prefixed with eap_ + my $conf = wpa_supplicant_read_conf(); + my $default_eap_cfg = { + pairwise => 'CCMP TKIP', + group => 'CCMP TKIP', + proto => 'RSN WPA', + key_mgmt => 'WPA-EAP IEEE8021X NONE', + scan_ssid => 1, + }; + if ($ui_input->{forceeap} eq 'WPA') { + #- WPA only + $default_eap_cfg->{pairwise} = 'TKIP'; + $default_eap_cfg->{group} = 'TKIP'; + $default_eap_cfg->{proto} = 'WPA'; + } elsif ($ui_input->{forceeap} eq 'WPA2') { + #- WPA2 only + $default_eap_cfg->{pairwise} = 'CCMP TKIP'; + $default_eap_cfg->{group} = 'CCMP TKIP'; + $default_eap_cfg->{proto} = 'RSN'; + } + my $network = { ssid => qq("$ui_input->{essid}") }; + #- set the values + foreach my $eap_var (keys %eap_vars) { + my $key = join('_', "eap", $eap_var); + if (!defined $ui_input->{$key} || $ui_input->{$key} =~ /auto detect/i) { + $network->{$eap_var} = $default_eap_cfg->{$eap_var} if $default_eap_cfg->{$eap_var}; + } else { + #- do not define if blank, the save routine will delete entry from file + next if !$ui_input->{$key}; + $network->{$eap_var} = $eap_vars{$eap_var} == 2 ? qq("$ui_input->{$key}") : $ui_input->{$key}; + } + } + #- handle extra variables as final overides + handle_extra_params($network, $ui_input->{extra}); + + $network->{mode} = to_bool($ui_input->{mode} eq 'Ad-hoc'); + + @$conf = difference2($conf, [ wpa_supplicant_find_similar($conf, $network) ]); + push @$conf, $network; + wpa_supplicant_write_conf($conf); +} +1; diff --git a/lib/network/connection/xdsl.pm b/lib/network/connection/xdsl.pm new file mode 100644 index 0000000..e55dd24 --- /dev/null +++ b/lib/network/connection/xdsl.pm @@ -0,0 +1,412 @@ +package network::connection::xdsl; + +use base qw(network::connection::ppp); + +use strict; +use common; + +sub get_type_name() { N("DSL") } +sub _get_type_icon() { 'xdsl' } + +sub get_devices() { + require detect_devices; + require network::connection::isdn; + require network::connection::ethernet; + my @usb_devices = detect_devices::get_xdsl_usb_devices(); + $_->{xdsl_type} = 'usb' foreach @usb_devices; + my @capi_devices = grep { $_->{driver} =~ /dsl/i } map { network::connection::isdn::find_capi_card($_) } network::connection::isdn->get_devices; + $_->{xdsl_type} = 'capi' foreach @capi_devices; + my @ethernet_devices = network::connection::ethernet::get_devices(); + $_->{xdsl_type} = 'ethernet' foreach @ethernet_devices; + @usb_devices, @capi_devices, @ethernet_devices; +} + +sub get_metric { 25 } +sub get_interface() { "ppp0" } + +sub get_up_timeout { 20 } + +my @non_ppp_protocols = qw(static dhcp); +sub uses_ppp { + my ($self) = @_; + !member($self->{protocol}, @non_ppp_protocols); +} + +sub uses_atm_arp { + my ($self) = @_; + $self->{device}{xdsl_type} eq 'usb' && !$self->uses_ppp; +} +sub get_atm_arp_interface { "atm0" } + +sub uses_atm_bridging { + my ($self) = @_; + $self->{device}{xdsl_type} eq 'usb' && member($self->{protocol}, qw(pppoe)); +} +sub get_atm_bridging_interface { "nas0" } + +sub get_pppoe_interface { + my ($self) = @_; + $self->uses_atm_bridging + ? $self->get_atm_bridging_interface + : $self->network::connection::ethernet::get_interface; +} + +my %protocol_settings = ( + pppoa => { + plugin => sub { + my ($self) = @_; + "pppoatm.so " . join('.', $self->{access}{peer}{vpi}, $self->{access}{peer}{vci}); + }, + }, + pppoe => { + pty => sub { + my ($self) = @_; + my $pppoe_interface = $self->get_pppoe_interface; + qq("pppoe -m 1412 -I $pppoe_interface"); + }, + options => [ + qw(default-asyncmap noaccomp nobsdcomp novjccomp nodeflate), + "mru 1492", + "mtu 1492", + "lcp-echo-interval 20", + "lcp-echo-failure 3", + ], + }, + pptp => { + pty => qq("/usr/sbin/pptp 10.0.0.138 --nolaunchpppd"), + options => [ qw(noipdefault) ], + }, + capi => { + plugin => "capiplugin.so avmadsl", + options => [ + qw(ipcp-accept-remote ipcp-accept-local sync noipx), + "connect /bin/true", + "lcp-echo-interval 5", + "lcp-echo-failure 3", + "lcp-max-configure 50", + "lcp-max-terminate 2", + "mru 1492", + "mtu 1492" + ], + }, +); + +my @thirdparty_settings = ( + { + matching => 'speedtch', + description => N_("Alcatel speedtouch USB modem"), + url => "http://www.speedtouch.com/supuser.htm", + name => 'speedtouch', + firmware => + { + package => 'speedtouch-firmware', + test_file => 'speedtch-*.bin*', + extract => { + name => 'speedtouch-firmware-extractor', + test_file => '/usr/sbin/firmware-extractor', + windows_source => 'alcaudsl.sys', + floppy_source => 'mgmt*.o', + default_source => '/usr/share/speedtouch/mgmt.o', + run => sub { + my ($file) = @_; + run_program::raw({ root => $::prefix, chdir => $network::thirdparty::firmware_directory }, + '/usr/sbin/firmware-extractor', $file); + }, + }, + }, + links => 'http://linux-usb.sourceforge.net/SpeedTouch/mandrake/index.html', + ppp => { + options => [ qw(noaccomp sync) ], + }, + }, + + { + name => 'eciadsl', + explanations => N_("The ECI Hi-Focus modem cannot be supported due to binary driver distribution problem. + +You can find a driver on http://eciadsl.flashtux.org/"), + no_distro_package => 1, + tools => { + test_file => '/usr/sbin/pppoeci', + }, + ppp => { + options => [ + qw(noipdefault noaccomp sync), + "linkname eciadsl", + "lcp-echo-interval 0", + ], + protocols => { + pppoe => { + pty => sub { + my ($self) = @_; + qq("/usr/bin/pppoeci -v 1 -vpi $self->{access}{peer}{vpi} -vci $self->{access}{peer}{vci}"); + }, + }, + }, + }, + }, + + { + matching => 'ueagle_atm', + description => 'Eagle chipset (from Analog Devices), e.g. Sagem F@st 800/840/908', + url => 'http://www.eagle-usb.org/', + name => 'ueagle', + firmware => { + test_file => 'ueagle-atm/eagle*.fw', + }, + links => 'http://atm.eagle-usb.org/wakka.php?wiki=UeagleAtmDoc', + }, + + { + matching => qr/^unicorn_.*_atm$/, + description => 'Bewan Adsl (Unicorn)', + url => 'http://www.bewan.com/bewan/users/downloads/', + name => 'unicorn', + kernel_module => 1, + tools => { + optional => 1, + test_file => '/usr/bin/bewan_adsl_status', + }, + sleep => 10, + ppp => { + options => [ + qw(default-asyncmap hide-password noaccomp nobsdcomp nodeflate novjccomp sync), + "lcp-echo-interval 20", + "lcp-echo-failure 3", + ], + }, + }, + + { + name => 'cxacru', + firmware => { + test_file => 'cxacru-fw.bin', + no_distro_package => 1, + explanations => N_("Modems using Conexant AccessRunner chipsets cannot be supported due to binary firmware distribution problem."), + url => 'http://accessrunner.sourceforge.net/firmware.shtml', + }, + } +); + +sub get_thirdparty_settings() { + \@thirdparty_settings; +} + +sub get_providers { + my ($self) = @_; + require network::connection::providers::xdsl; + if_($self->{device}{xdsl_type} ne 'capi', \%network::connection::providers::xdsl::data, '|'); +} + +sub get_protocols { + my ($self) = @_; + $self->{device}{xdsl_type} eq 'capi' ? + { + capi => N("DSL over CAPI"), + } : + { + dhcp => N("Dynamic Host Configuration Protocol (DHCP)"), + static => N("Manual TCP/IP configuration"), + pptp => N("Point to Point Tunneling Protocol (PPTP)"), + pppoe => N("PPP over Ethernet (PPPoE)"), + pppoa => N("PPP over ATM (PPPoA)"), + }; +} + +sub guess_protocol { + my ($self, $net) = @_; + $self->{protocol} = $self->{provider} && $self->{provider}{method}; + if ($self->{device}{xdsl_type} eq 'capi') { + $self->{protocol} = 'capi'; + } elsif ($self->{device}{xdsl_type} eq 'ethernet') { + require network::connection::ethernet; + my $interface = $self->network::connection::ethernet::get_interface; + if (my $ifcfg = $net->{ifcfg}{$interface}) { + $self->{protocol} = $ifcfg->{BOOTPROTO} if member($ifcfg->{BOOTPROTO}, @non_ppp_protocols); + $self->{protocol} ||= 'dhcp'; + #- pppoa shouldn't be selected by default for ethernet devices, fallback on pppoe + $self->{protocol} = 'pppoe' if $self->{protocol} eq 'pppoa'; + } + } +} + +sub guess_access_settings { + my ($self) = @_; + require network::adsl; + my $probe = {}; + network::adsl::adsl_probe_info($probe); + $self->{access}{login} = $probe->{adsl}{login}; + $self->{access}{password} = $probe->{adsl}{passwd}; + $self->{access}{peer}{$_} = $probe->{adsl}{$_} foreach qw(vpi vci); + if ($self->{provider}) { + $self->{access}{peer}{$_} = hex($self->{provider}{$_}) foreach qw(vpi vci); + } +} + +sub get_access_settings { + my ($self) = @_; + + [ + @{$self->network::connection::ppp::get_access_settings}, + if_(member($self->{protocol}, qw(pppoa pppoe)), + { label => N("Virtual Path ID (VPI):"), val => \$self->{access}{peer}{vpi}, advanced => 1 }, + { label => N("Virtual Circuit ID (VCI):"), val => \$self->{access}{peer}{vci}, advanced => 1 } + ), + ]; +} + +sub get_peer_default_options { + my ($self) = @_; + $self->network::connection::ppp::get_peer_default_options, + qw(lock persist nopcomp noccp novj), + "kdebug 1", + "holdoff 4", + "maxfail 5"; +} + +sub build_peer { + my ($self) = @_; + my $may_call = sub { ref $_[0] eq 'CODE' ? $_[0]->($self) : $_[0] }; + my @ppp_fields = qw(plugin pty); + my @ppp_options; + if ($self->{thirdparty}) { + foreach my $settings (grep { $_ } $self->{thirdparty}{ppp}{protocols}{$self->{protocol}}, $self->{thirdparty}{ppp}) { + @ppp_options = @{$settings->{options}} if $settings->{options}; + foreach (@ppp_fields) { + $self->{access}{peer}{$_} ||= $may_call->($settings->{$_}) if defined $settings->{$_}; + } + } + } + if (my $generic_settings = $protocol_settings{$self->{protocol}}) { + @ppp_options = @{$generic_settings->{options} || []} if !@ppp_options; + foreach (@ppp_fields) { + $self->{access}{peer}{$_} ||= $may_call->($generic_settings->{$_}) if defined $generic_settings->{$_}; + } + } + + @ppp_options, #- write them before pty/plugin stuff + $self->network::connection::ppp::build_peer; +} + +sub write_settings { + my ($self, $net) = @_; + + if ($self->{device}{xdsl_type} eq 'ethernet' && $self->{protocol} eq 'pppoe') { + my $interface = $self->network::connection::ethernet::get_interface; + $net->{ifcfg}{$interface} = { + DEVICE => $interface, + BOOTPROTO => 'none', + NETMASK => '255.255.255.0', + NETWORK => '10.0.0.0', + BROADCAST => '10.0.0.255', + MII_NOT_SUPPORTED => 'yes', + ONBOOT => 'yes', + }; + } + + if ($self->{protocol} eq 'capi') { + require network::connection::isdn; + network::connection::isdn::write_capi_conf($self->{device}); + } + + #- TODO: add "options ueagle-atm cmv_file= $net->{adsl}{cmv}.bin" in /etc/modprobe.d/ueagle-atm + # if ($self->get_driver eq 'ueagle-atm') { ... } + + if ($self->uses_ppp) { + $self->network::connection::ppp::write_settings; + } else { + $self->network::connection::write_settings; + } +} + +sub build_ifcfg_settings { + my ($self) = @_; + my $settings = { + if_($self->uses_ppp, TYPE => 'ADSL'), + }; + if ($self->uses_atm_arp) { + #- use ATMARP with the atm0 interface + put_in_hash($settings, { + DEVICE => $self->get_atm_arp_interface, + ATM_ADDR => join('.', @{$self->{access}{peer}}{qw(vpi vci)}), + MII_NOT_SUPPORTED => "yes", + }); + } + if ($self->uses_atm_bridging) { + put_in_hash($settings, { + ATM_DEVICE => $self->get_atm_bridging_interface, + ATM_ADDR => join('.', @{$self->{access}{peer}}{qw(vpi vci)}), + }); + } + $self->network::connection::build_ifcfg_settings($settings); +} + +sub unload_connection { + my ($self) = @_; + require network::connection::isdn; + network::connection::isdn::unload_connection($self->{device}) if $self->{protocol} eq 'capi'; +} + +sub install_packages { + my ($self, $in) = @_; + my $per_type_packages = { + pppoa => [ qw(ppp-pppoatm) ], + pppoe => [ qw(rp-pppoe) ], + pptp => [ qw(pptp-linux) ], + capi => [ qw(ppp) ], + }; + my @packages = @{$per_type_packages->{$self->{protocol}} || []}; + push @packages, 'linux-atm' if $self->uses_atm_arp || $self->uses_atm_bridging; + if (@packages && !$in->do_pkgs->install(@packages)) { + $in->ask_warn(N("Error"), N("Could not install the packages (%s)!", @packages)); + return; + } + if ($self->{protocol} eq 'capi') { + require network::connection::isdn; + network::connection::isdn::install_packages($self->{device}, $in); + $in->do_pkgs->ensure_is_installed_if_available("drdsl", "/usr/sbin/drdsl"); + } + 1; +} + +sub prepare_connection { + my ($self) = @_; + + if ($::isInstall) { + #- load modules that are not automatically loaded during install + my @modules = qw(ppp_synctty ppp_async ppp_generic n_hdlc); #- required for pppoe/pptp connections + push @modules, 'pppoatm' if $self->{protocol} eq 'pppoa'; + foreach (@modules) { + eval { modules::load($_) } or log::l("failed to load $_ module: $@"); + } + } + + if ($self->{protocol} eq 'capi') { + require network::connection::isdn; + network::connection::isdn::prepare_connection($self->{device}); + require run_program; + run_program::rooted($::prefix, "/usr/sbin/drdsl"); + } + + 1; +} + +sub connect { + my ($self) = @_; + if ($self->{device}{xdsl_type} eq 'ethernet') { + require network::tools; + network::tools::start_interface($self->network::connection::ethernet::get_interface, 0); + } + $self->network::connection::connect; +} + +sub disconnect { + my ($self) = @_; + $self->network::connection::disconnect; + if ($self->{device}{xdsl_type} eq 'ethernet') { + require network::tools; + network::tools::stop_interface($self->network::connection::ethernet::get_interface, 0); + } +} + +1; |