summaryrefslogtreecommitdiffstats
path: root/perl-install/network
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/network')
-rw-r--r--perl-install/network/ethernet.pm7
-rw-r--r--perl-install/network/isdn.pm8
-rw-r--r--perl-install/network/isdn_consts.pm10
-rw-r--r--perl-install/network/network.pm25
-rw-r--r--perl-install/network/tools.pm13
5 files changed, 43 insertions, 20 deletions
diff --git a/perl-install/network/ethernet.pm b/perl-install/network/ethernet.pm
index 7eb54397e..8c3bb5b56 100644
--- a/perl-install/network/ethernet.pm
+++ b/perl-install/network/ethernet.pm
@@ -159,13 +159,14 @@ sub configureNetwork {
configureNetwork_step_1:
$netc ||= {};
- my $last; foreach (@all_cards) {
+ my ($last, %last);
+ foreach (@all_cards) {
my $intf2 = findIntf($intf ||= {}, $_->[0]);
- add2hash($intf2, $last);
+ add2hash($intf2, $last{$_->[0]});
add2hash($intf2, { NETMASK => '255.255.255.0' });
configureNetworkIntf($netc, $in, $intf2, $netc->{NET_DEVICE}, 0, $_->[1]) or return;
- $last = $intf2;
+ $last = $last{$_->[0]} = $intf2;
}
$last or return;
diff --git a/perl-install/network/isdn.pm b/perl-install/network/isdn.pm
index 4605963cc..5d966d8a6 100644
--- a/perl-install/network/isdn.pm
+++ b/perl-install/network/isdn.pm
@@ -187,11 +187,13 @@ sub isdn_ask {
isdn_ask_step_1:
my $e = $in->ask_from_list_(N("ISDN Configuration"),
$label . "\n" . N("What kind of card do you have?"),
- [ N_("ISA / PCMCIA"), N_("PCI"), N_("I don't know") ]
+ [ N_("ISA / PCMCIA"), N_("PCI"), N_("USB"), N_("I don't know") ]
) or return;
isdn_ask_step_1b:
if ($e =~ /PCI/) {
$isdn->{card_type} = 'pci';
+ } elsif ($e =~ /USB/) {
+ $isdn->{card_type} = 'usb';
} else {
$in->ask_from_list_(N("ISDN Configuration"),
N("
@@ -206,7 +208,7 @@ If you have a PCMCIA card, you have to know the \"irq\" and \"io\" of your card.
$e = $in->ask_from_listf(N("ISDN Configuration"),
N("Which of the following is your ISDN card?"),
sub { $_[0]{description} },
- [ grep { $_->{card} eq $isdn->{card_type} } @isdndata ]) or goto isdn_ask_step_1b;
+ [ grep { $_->{card} eq $isdn->{card_type} } @isdndata ]) or goto ($isdn->{card_type} =~ /usb|pci/ ? 'isdn_ask_step_1' : 'isdn_ask_step_1b');
$e->{$_} and $isdn->{$_} = $e->{$_} foreach qw(driver type mem io io0 io1 irq firmware);
isdn_ask_step_3:
@@ -247,7 +249,7 @@ sub isdn_detect_backend {
if (my ($c) = modules::probe_category('network/isdn')) {
$isdn->{$_} = $c->{$_} foreach qw(description vendor id driver options firmware);
$isdn->{$_} = sprintf("%0x", $isdn->{$_}) foreach 'vendor', 'id';
- $isdn->{card_type} = 'pci';
+ $isdn->{card_type} = $c->{bus} eq 'USB' ? 'usb' : 'pci';
($isdn->{type}) = $isdn->{options} =~ /type=(\d+)/;
# $c->{options} !~ /id=HiSax/ && $isdn->{driver} eq "hisax" and $c->{options} .= " id=HiSax";
if ($c->{options} !~ /protocol=/ && $isdn->{protocol} =~ /\d/) {
diff --git a/perl-install/network/isdn_consts.pm b/perl-install/network/isdn_consts.pm
index b6ce7e1e1..04ddf6e96 100644
--- a/perl-install/network/isdn_consts.pm
+++ b/perl-install/network/isdn_consts.pm
@@ -324,6 +324,16 @@ our @isdndata =
type => '36',
card => 'pci',
},
+ { description => "BeWAN R834 (USB)",
+ driver => 'hisax_st5481',
+ type => '99',
+ card => 'usb',
+ },
+ { description => "Gazel 128 (USB)",
+ driver => 'hisax_st5481',
+ type => '99',
+ card => 'usb',
+ },
);
1;
diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm
index 958690635..8b14a2fae 100644
--- a/perl-install/network/network.pm
+++ b/perl-install/network/network.pm
@@ -10,6 +10,7 @@ use Socket;
use common;
use detect_devices;
use run_program;
+use network::tools;
use any;
use vars qw(@ISA @EXPORT);
use log;
@@ -152,7 +153,7 @@ sub write_resolv_conf {
}
sub write_interface_conf {
- my ($file, $intf, $_netc, $prefix) = @_;
+ my ($file, $intf, $netc, $prefix) = @_;
if ($intf->{HWADDR} && -e "$prefix/sbin/ip") {
$intf->{HWADDR} = undef;
@@ -173,7 +174,12 @@ sub write_interface_conf {
$intf->{BOOTPROTO} =~ s/dhcp.*/dhcp/;
- setVarsInSh($file, $intf, qw(DEVICE BOOTPROTO IPADDR NETMASK NETWORK BROADCAST ONBOOT HWADDR MII_NOT_SUPPORTED), if_($intf->{wireless_eth}, qw(WIRELESS_MODE WIRELESS_ESSID WIRELESS_NWID WIRELESS_FREQ WIRELESS_SENS WIRELESS_RATE WIRELESS_ENC_KEY WIRELESS_RTS WIRELESS_FRAG WIRELESS_IWCONFIG WIRELESS_IWSPY WIRELESS_IWPRIV)), if_($intf->{BOOTPROTO} eq "dhcp", qw(DHCP_HOSTNAME NEEDHOSTNAME)));
+ require network::ethernet;
+ my %cards = map { $_->[0] => $_->[1] } network::ethernet::conf_network_card_backend($netc, $intf);
+ setVarsInSh($file, $intf, qw(DEVICE BOOTPROTO IPADDR NETMASK NETWORK BROADCAST ONBOOT HWADDR MII_NOT_SUPPORTED),
+ if_(is_wireless_intf($cards{$intf->{DEVICE}}), qw(WIRELESS_MODE WIRELESS_ESSID WIRELESS_NWID WIRELESS_FREQ WIRELESS_SENS WIRELESS_RATE WIRELESS_ENC_KEY WIRELESS_RTS WIRELESS_FRAG WIRELESS_IWCONFIG WIRELESS_IWSPY WIRELESS_IWPRIV)),
+ if_($intf->{BOOTPROTO} eq "dhcp", qw(DHCP_HOSTNAME NEEDHOSTNAME))
+ );
log::explanations("written $intf->{DEVICE} interface configuration in $file");
}
@@ -307,18 +313,12 @@ sub gateway {
my @masked = masked_ip($ip) =~ $ip_regexp;
$masked[3] = 1;
join(".", @masked);
-
}
sub configureNetworkIntf {
my ($netc, $in, $intf, $net_device, $skip, $module) = @_;
my $text;
- my @wireless_modules = qw(aironet_cs aironet4500_cs hermes airo orinoco_cs orinoco airo_cs netwave_cs ray_cs wavelan_cs wvlan_cs airport);
- my $flag = 0;
- foreach (@wireless_modules) {
- $module =~ /$_/ and $flag = 1;
- }
- if ($flag) {
+ if (is_wireless_intf($module)) {
$intf->{wireless_eth} = 1;
$netc->{wireless_eth} = 1;
$intf->{WIRELESS_MODE} = "Managed";
@@ -338,7 +338,10 @@ notation (for example, 1.2.3.4).");
my $auto_ip = $intf->{BOOTPROTO} !~ /static/;
my $onboot = $intf->{ONBOOT} ? $intf->{ONBOOT} =~ /yes/ : bool2yesno(!member($intf->{DEVICE}, map { $_->{device} } detect_devices::pcmcia_probe()));
my $needhostname = $intf->{NEEDHOSTNAME} !~ /no/;
- my $hotplug = $::isStandalone && !$intf->{MII_NOT_SUPPORTED} || 1;
+ # blacklist:
+ #$intf->{MII_NOT_SUPPORTED} ||= bool2yesno(member($module, qw(bcm4400))); # 3c59x de4x5 e100 e1000 ne2k-pci
+ my $hotplug = text2bool($intf->{MII_NOT_SUPPORTED});
+ invbool(\$hotplug);
my $track_network_id = $::isStandalone && $intf->{HWADDR} || detect_devices::isLaptop();
delete $intf->{NETWORK};
delete $intf->{BROADCAST};
@@ -479,7 +482,7 @@ sub read_all_conf {
add2hash($netc, read_resolv_conf());
add2hash($netc, read_tmdns_conf("$prefix/etc/tmdns.conf")) if -r "$prefix/etc/tmdns.conf";
foreach (all("$prefix/etc/sysconfig/network-scripts")) {
- if (/ifcfg-(\w+)/ && $1 ne 'lo') {
+ if (/^ifcfg-(\w+)/ && $1 ne 'lo') {
my $intf = findIntf($intf, $1);
add2hash($intf, { getVarsFromSh("$prefix/etc/sysconfig/network-scripts/$_") });
}
diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm
index 62b9a0fb5..59bd397ca 100644
--- a/perl-install/network/tools.pm
+++ b/perl-install/network/tools.pm
@@ -9,7 +9,7 @@ use MDK::Common::Globals "network", qw($in $prefix $disconnect_file $connect_pro
use MDK::Common::System qw(getVarsFromSh);
@ISA = qw(Exporter);
-@EXPORT = qw(write_cnx_script write_secret_backend read_secret_backend passwd_by_login write_initscript ask_connect_now connect_backend disconnect_backend read_providers_backend ask_info2 type2interface connected connected_bg test_connected connected2 disconnected);
+@EXPORT = qw(ask_connect_now ask_info2 connect_backend connected connected2 connected_bg disconnect_backend disconnected is_wireless_intf passwd_by_login read_providers_backend read_secret_backend test_connected type2interface write_cnx_script write_initscript write_secret_backend);
@EXPORT_OK = qw($in);
sub write_cnx_script {
@@ -29,8 +29,10 @@ sub write_cnx_script {
sub write_secret_backend {
my ($a, $b) = @_;
- foreach my $i ("pap-secrets", "chap-secrets") {
- substInFile { s/^'$a'.*\n//; $_ .= "\n'$a' * '$b' * \n" if eof } "$prefix/etc/ppp/$i";
+ foreach my $i ("$prefix/etc/ppp/pap-secrets", "$prefix/etc/ppp/chap-secrets") {
+ substInFile { s/^'$a'.*\n//; $_ .= "\n'$a' * '$b' * \n" if eof } $i;
+ #- restore access right to secrets file, just in case.
+ chmod 0600, $i;
}
}
@@ -345,4 +347,9 @@ sub use_floppy {
}
+sub is_wireless_intf {
+ my ($module) = @_;
+ member($module, qw(airo aironet_cs aironet4500_cs airo_cs airport hermes orinoco_cs netwave_cs orinoco ray_cs wavelan_cs wvlan_cs))
+}
+
1;