summaryrefslogtreecommitdiffstats
path: root/perl-install/network
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/network')
-rw-r--r--perl-install/network/netconnect.pm36
-rw-r--r--perl-install/network/tools.pm17
2 files changed, 31 insertions, 22 deletions
diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm
index d6a790966..a71423b9c 100644
--- a/perl-install/network/netconnect.pm
+++ b/perl-install/network/netconnect.pm
@@ -1133,7 +1133,15 @@ notation (for example, 1.2.3.4).")),
return 1;
}
},
- next => 'ndiswrapper_intf',
+ post => sub {
+ if (keys %eth_intf ) {
+ return 'ndiswrapper_intf';
+ } else {
+ $ntf_name = network::tools::ndiswrapper_setup();
+ $ethntf = $intf->{$ntf_name} ||= { DEVICE => $ntf_name };
+ return 'lan_protocol';
+ }
+ }
},
ndiswrapper_intf =>
@@ -1143,29 +1151,13 @@ notation (for example, 1.2.3.4).")),
},
data => sub {
[ { label => N("Net Device"), type => "list", val => \$ntf_name, list => [ sort keys %eth_intf ],
- format => sub { translate($eth_intf{$_[0]}) }, allow_empty_list => 1 } ];
+ format => sub { translate($eth_intf{$_[0]}) } } ];
},
post => sub {
- if ($ntf_name) {
- #- if another module is loaded for the wireless interface, unload it before using ndiswrapper
- my $eth = find { $_->[0] eq $ntf_name } @all_cards;
- $ntf_name and modules::unload($eth->[1]);
- }
- modules::unload("ndiswrapper");
- #- unload ndiswrapper first so that the newly installed .inf files will be read
- modules::load("ndiswrapper");
-
- #- FIXME: move this somewhere in get_eth_cards, so that configure_eth_aliases correctly writes ndiswrapper
- #- find the first interface matching an ndiswrapper driver, try ethtool then sysfs
- my @available_drivers = network::tools::ndiswrapper_available_drivers();
- $ntf_name = find {
- my $drv = c::getNetDriver($_) || readlink("/sys/class/net/$_/driver");
- $drv =~ s!.*/!!;
- member($drv, @available_drivers);
- } detect_devices::getNet();
- #- fallback on wlan0
- $ntf_name ||= "wlan0";
-
+ #- if another module is loaded for the wireless interface, unload it before using ndiswrapper
+ my $eth = find { $_->[0] eq $ntf_name } @all_cards;
+ $eth and modules::unload($eth->[1]);
+ $ntf_name = network::tools::ndiswrapper_setup();
$ethntf = $intf->{$ntf_name} ||= { DEVICE => $ntf_name };
return 'lan_protocol';
},
diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm
index de3f8a4b5..9c5ea152c 100644
--- a/perl-install/network/tools.pm
+++ b/perl-install/network/tools.pm
@@ -304,4 +304,21 @@ sub ndiswrapper_available_drivers() {
`ndiswrapper -l` =~ /(\w+)\s+driver present, hardware present/mg;
}
+sub ndiswrapper_setup() {
+ modules::unload("ndiswrapper");
+ #- unload ndiswrapper first so that the newly installed .inf files will be read
+ modules::load("ndiswrapper");
+
+ #- FIXME: move this somewhere in get_eth_cards, so that configure_eth_aliases correctly writes ndiswrapper
+ #- find the first interface matching an ndiswrapper driver, try ethtool then sysfs
+ my @available_drivers = network::tools::ndiswrapper_available_drivers();
+ my $ntf_name = find {
+ my $drv = c::getNetDriver($_) || readlink("/sys/class/net/$_/driver");
+ $drv =~ s!.*/!!;
+ member($drv, @available_drivers);
+ } detect_devices::getNet();
+ #- fallback on wlan0
+ return $ntf_name || "wlan0";
+}
+
1;