diff options
Diffstat (limited to 'perl-install/network')
-rw-r--r-- | perl-install/network/adsl.pm | 35 | ||||
-rw-r--r-- | perl-install/network/drakfirewall.pm | 8 | ||||
-rw-r--r-- | perl-install/network/ethernet.pm | 16 | ||||
-rw-r--r-- | perl-install/network/netconnect.pm | 33 | ||||
-rw-r--r-- | perl-install/network/smb.pm | 32 |
5 files changed, 83 insertions, 41 deletions
diff --git a/perl-install/network/adsl.pm b/perl-install/network/adsl.pm index 9dab12255..26d2565fc 100644 --- a/perl-install/network/adsl.pm +++ b/perl-install/network/adsl.pm @@ -134,17 +134,17 @@ sync speedtouch => { - start => '/usr/sbin/modem_run -v 0 -f /usr/share/speedtouch/mgmt.o', + start => '/usr/sbin/modem_run -k -n 2 -f /usr/share/speedtouch/mgmt.o', overide_script => 1, server => { - pppoa => '"/usr/sbin/pppoa3 -e 1 -c -vpi ' . hex($netc->{vpi}) . " -vci " . hex($netc->{vci}) . '"', + pppoa => '"/usr/sbin/pppoa3 -e 1 -c" +plugin pppoatm.so +' . join('.', hex($netc->{vpi}), hex($netc->{vci})), }, ppp_options => qq( sync noaccomp), aliases => [ - # disable kernel driver, we use userland stuff but for firmware upload - if_(c::kernel_version() =~ /^\Q2.4/, ['speedtch', 'off']), ['char-major-108', 'ppp_generic'], ['tty-ldisc-3', 'ppp_async'], ['tty-ldisc-13', 'n_hdlc'], @@ -156,7 +156,9 @@ noaccomp), }, sagem => { - start => "/usr/sbin/eaglectrl -w", + start => qq( +modprobe eagle-usb +/usr/sbin/eaglectrl -w), stop => "/usr/bin/killall pppoa", get_intf => "/usr/sbin/eaglectrl -i", server => { @@ -235,10 +237,10 @@ usepeerdns defaultroute) ); + my $pty_option = $modems{$adsl_device}{server}{$adsl_type} && "pty $modems{$adsl_device}{server}{$adsl_type}"; output("$::prefix/etc/ppp/peers/adsl", qq(noauth noipdefault -pty $modems{$adsl_device}{server}{$adsl_type} $modems{$adsl_device}{ppp_options} kdebug 1 nopcomp @@ -249,6 +251,7 @@ maxfail 25 persist usepeerdns defaultroute +$pty_option user "$adsl->{login}" )); @@ -284,10 +287,9 @@ user "$adsl->{login}" set_cnx_script($netc, "adsl", join("\n", "/sbin/route del default", $modems{$adsl_device}{start}, - # /usr/sbin/pppd call adsl - #$modems{$adsl_device}{server}{$adsl_type} || - "/usr/sbin/pppd file /etc/ppp/peers/adsl $modems{$adsl_device}{pppd_options}", - $ppp_options{$adsl_type}{connect} + $ppp_options{$adsl_type}{connect} || + "/usr/sbin/pppd file /etc/ppp/peers/adsl $modems{$adsl_device}{pppd_options}", + "" ), $ppp_options{$adsl_type}{disconnect}, $netc->{adsltype} @@ -336,9 +338,16 @@ INTERFACE=`$modems{$adsl_device}{get_intf}` } elsif ($adsl_device eq 'speedtouch') { # speedtouch really is used only with pppoa, let its own script handle firmware upload and the like: set_cnx_script($netc, 'adsl', - qq(/sbin/route del default -/usr/share/speedtouch/speedtouch.sh start\n), - "/usr/share/speedtouch/speedtouch.sh stop\n", + qq(/sbin/route del default 2>/dev/null +/usr/sbin/modem_run -k -n 2 -f /usr/share/speedtouch/mgmt.o +pppd call adsl + +for i in 0 1 2 3 4; do + /sbin/ifconfig | grep -q 'ppp' && exit + sleep 3 +done +exit 1\n), + "/usr/bin/killall pppd\n", $netc->{adsltype}); } diff --git a/perl-install/network/drakfirewall.pm b/perl-install/network/drakfirewall.pm index 7c9450107..f1b9355e9 100644 --- a/perl-install/network/drakfirewall.pm +++ b/perl-install/network/drakfirewall.pm @@ -47,7 +47,7 @@ my @all_servers = { name => N_("Samba server"), pkg => 'samba-server', - ports => '137/tcp 137/udp 138/tcp 138/udp 139/tcp 139/udp 1024-1100/tcp 1024-1100/udp', + ports => '137/tcp 137/udp 138/tcp 138/udp 139/tcp 139/udp 1024:1100/tcp 1024:1100/udp', hide => 1, }, { @@ -61,6 +61,12 @@ my @all_servers = ports => '8/icmp', force_default_selection => 0, }, + { + name => "BitTorrent", + ports => '6881:6999/tcp', + hide => 1, + pkg => 'bittorrent bittorrent-shadowsclient', + }, ); sub port2server { diff --git a/perl-install/network/ethernet.pm b/perl-install/network/ethernet.pm index 845d7b3d8..a6e58df1b 100644 --- a/perl-install/network/ethernet.pm +++ b/perl-install/network/ethernet.pm @@ -39,7 +39,8 @@ sub mapIntfToDevice { my ($interface) = @_; my $hw_addr = c::getHwIDs($interface); my ($bus, $slot, $func) = map { hex($_) } ($hw_addr =~ /([0-9a-f]+):([0-9a-f]+)\.([0-9a-f]+)/); - $hw_addr ? grep { $_->{pci_bus} == $bus && $_->{pci_device} == $slot && $_->{pci_function} == $func } detect_devices::probeall() : {}; + $hw_addr && (every { defined $_ } $bus, $slot, $func) ? + grep { $_->{pci_bus} == $bus && $_->{pci_device} == $slot && $_->{pci_function} == $func } detect_devices::probeall() : {}; } @@ -62,8 +63,19 @@ sub get_eth_cards() { ($description) = (mapIntfToDevice($interface))[0]->{description}; } if (!$description) { + my $drv = readlink("/sys/class/net/$interface/driver"); + if ($drv and $drv =~ s!.*/!!) { + $a = $drv; + my %l; + my %sysfs_fields = (id => "device", subid => "subsystem_device", vendor => "vendor", subvendor => "subsystem_vendor"); + $l{$_} = hex(chomp_(cat_("/sys/class/net/$interface/device/" . $sysfs_fields{$_}))) foreach keys %sysfs_fields; + my @cards = grep { my $dev = $_; every { $dev->{$_} eq $l{$_} } keys %l } detect_devices::probeall(); + $description = $cards[0]{description} if $#cards == 0; + } + } + if (!$description) { my @cards = grep { $_->{driver} eq ($a || $saved_driver) } detect_devices::probeall(); - $description = $cards[0]{descripxtion} if @cards == 1; + $description = $cards[0]->{description} if $#cards == 0; } $a and $saved_driver = $a; # handle multiple cards managed by the same driver [ $interface, $saved_driver, if_($description, $description) ] diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm index d4ff1ab1d..d52523ad8 100644 --- a/perl-install/network/netconnect.pm +++ b/perl-install/network/netconnect.pm @@ -86,7 +86,7 @@ sub real_main { my ($ntf_name, $ipadr, $netadr, $gateway_ex, $up, $need_restart_network); my ($isdn, $isdn_name, $isdn_type, %isdn_cards); my $my_isdn = join('', N("Manual choice"), " (", N("Internal ISDN card"), ")"); - my ($module, $auto_ip, $onboot, $needhostname, $hotplug, $track_network_id, @fields); # lan config + my ($module, $auto_ip, $protocol, $onboot, $needhostname, $hotplug, $track_network_id, @fields); # lan config my $success = 1; my $ethntf = {}; my $db_path = "$::prefix/usr/share/apps/kppp/Provider"; @@ -130,8 +130,8 @@ sub real_main { @all_cards = network::ethernet::get_eth_cards(); %eth_intf = network::ethernet::get_eth_cards_names(@all_cards); require list_modules; - my @wmodules = list_modules::category2modules('network/wireless'); - %eth_intf = map { $_->[0] => join(': ', $_->[0], $_->[2]) } grep { int(!$is_wireless) ^ member($_->[1], @wmodules) } @all_cards; + %eth_intf = map { $_->[0] => join(': ', $_->[0], $_->[2]) } + grep { $is_wireless ^ !c::isNetDeviceWirelessAware($_->[0]) } @all_cards; }; my $find_lan_module = sub { @@ -175,7 +175,7 @@ sub real_main { ); my $offer_to_connect = sub { - return "ask_connect_now" if $netc->{internet_cnx_choice} eq 'adsl' && $adsl_devices{$ntf_name}; + return "ask_connect_now" if $netc->{internet_cnx_choice} eq 'adsl' && ($adsl_devices{$ntf_name} || $adsl_type eq 'pppoe'); return "ask_connect_now" if member($netc->{internet_cnx_choice}, qw(modem isdn)); return "end"; }; @@ -334,10 +334,6 @@ sub real_main { [ { label => N("Net Device"), type => "list", val => \$isdn_name, allow_empty_list => 1, list => [ $my_isdn, N("External ISDN modem"), keys %isdn_cards ] } ] }, - complete => sub { - $in->ask_warn(N("Warning"), N("Sorry, we support only 2.4 and above kernels.")) if c::kernel_version() !~ /^\Q2.4/; - return 0; - }, post => sub { # !intern_pci: # data => [ { val => \$isdn_type, type => "list", list => [ , ], } ], @@ -346,7 +342,7 @@ sub real_main { return "isdn_ask"; } elsif ($isdn_name eq N("External ISDN modem")) { detect($netc->{autodetect}, 'modem'); - $netc->{isdntype} = 'isdn_external'; + $netcnx->{type} = $netc->{isdntype} = 'isdn_external'; $netcnx->{isdn_external}{device} = network::modem::first_modem($netc); network::isdn::read_config($netcnx->{isdn_external}); $netcnx->{isdn_external}{special_command} = 'AT&F&O2B40'; @@ -653,12 +649,6 @@ killall pppd name => N("ADSL configuration") . "\n\n" . N("Select the network interface to configure:"), data => [ { label => N("Net Device"), type => "list", val => \$ntf_name, allow_empty_list => 1, list => \@adsl_devices, format => sub { $eth_intf{$_[0]} || $adsl_devices{$_[0]} } } ], - complete => sub { - if (c::kernel_version() !~ /^\Q2.4/ && $ntf_name eq 'speedtouch') { - $in->ask_warn(N("Warning"), N("Sorry, we support only 2.4 and above kernels.")); - } - return 0; - }, post => sub { my %packages = ( 'eci' => [ 'eciadsl', 'missing' ], @@ -836,7 +826,7 @@ You can find a driver on http://eciadsl.flashtux.org/"), pre => $lan_detect, name => N("Select the network interface to configure:"), data => sub { - [ { label => N("Net Device"), type => "list", val => \$ntf_name, list => [ N("Manual choice"), sort keys %eth_intf ], + [ { label => N("Net Device"), type => "list", val => \$ntf_name, list => [ (sort keys %eth_intf), N("Manual choice") ], allow_empty_list => 1, format => sub { $eth_intf{$_[0]} || $_[0] } } ]; }, post => sub { @@ -875,7 +865,7 @@ Modifying the fields below will override this configuration."), { pre => sub { $find_lan_module->(); - $auto_ip = $l10n_lan_protocols{defined $auto_ip ? ($auto_ip ? 'dhcp' : 'static') : $ethntf->{BOOTPROTO}} || 0; + $protocol = $l10n_lan_protocols{defined $auto_ip ? ($auto_ip ? 'dhcp' : 'static') : $ethntf->{BOOTPROTO}} || 0; }, name => sub { my $_msg = N("Zeroconf hostname resolution"); @@ -883,10 +873,10 @@ Modifying the fields below will override this configuration."), N("The following protocols can be used to configure an ethernet connection. Please choose the one you want to use") }, data => sub { - [ { val => \$auto_ip, type => "list", list => [ sort values %l10n_lan_protocols ] } ]; + [ { val => \$protocol, type => "list", list => [ sort values %l10n_lan_protocols ] } ]; }, post => sub { - $auto_ip = $auto_ip ne $l10n_lan_protocols{static} || 0; + $auto_ip = $protocol ne $l10n_lan_protocols{static} || 0; return 'lan_intf'; }, }, @@ -1320,11 +1310,6 @@ fi output_with_perm("$::prefix$network::tools::connect_prog", 0755, $connect_cmd) if $connect_cmd; $netcnx->{$_} = $netc->{$_} foreach qw(NET_DEVICE NET_INTERFACE); $netcnx->{type} =~ /adsl/ or run_program::rooted($::prefix, "/chkconfig --del adsl 2> /dev/null"); - - if ($::isInstall && $::o->{security} >= 3) { - require network::drakfirewall; - network::drakfirewall::main($in, $::o->{security} <= 3); - } } sub main { diff --git a/perl-install/network/smb.pm b/perl-install/network/smb.pm index 941463c65..4ef3f45a4 100644 --- a/perl-install/network/smb.pm +++ b/perl-install/network/smb.pm @@ -42,7 +42,7 @@ sub smbclient { my $group = $server->{group} ? " -W $server->{group}" : ''; my $U = $server->{username} ? sprintf("%s/%s%%%s", @$server{'domain', 'username', 'password'}) : '%'; - `smbclient -U $U -L $name $ip$group`; + `smbclient -U $U -L $name $ip$group 2>/dev/null`; } sub find_servers { @@ -178,4 +178,34 @@ sub write_smb_conf { "); } +sub write_smb_ads_conf { + my ($domain, $realm) = @_; + + #- was going to just have a canned config in samba-winbind + #- and replace the domain, but sylvestre/buchan didn't bless it yet + + my $f = "$::prefix/etc/samba/smb.conf"; + rename $f, "$f.orig"; + output($f, " +[global] + workgroup = $domain + realm = $realm + server string = Samba Member %v + security = ads + encrypt passwords = Yes + password server = * + log file = /var/log/samba/log.%m + max log size = 50 + socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 + os level = 18 + local master = No + dns proxy = No + winbind uid = 10000-20000 + winbind gid = 10000-20000 + winbind separator = + + template homedir = /home/%D/%U + template shell = /bin/bash + winbind use default domain = yes +"); +} 1; |