summaryrefslogtreecommitdiffstats
path: root/perl-install/network
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2004-09-27 13:13:37 +0000
committerOlivier Blin <oblin@mandriva.org>2004-09-27 13:13:37 +0000
commit886c5748870cad340a4f512a2bd5553cd31ec771 (patch)
tree39c539786bfacb6adcb887fb2e777eb949a58839 /perl-install/network
parentfcd68ae9d9aa25f3b26d1d3d7e6e0676616a3bac (diff)
downloaddrakx-886c5748870cad340a4f512a2bd5553cd31ec771.tar
drakx-886c5748870cad340a4f512a2bd5553cd31ec771.tar.gz
drakx-886c5748870cad340a4f512a2bd5553cd31ec771.tar.bz2
drakx-886c5748870cad340a4f512a2bd5553cd31ec771.tar.xz
drakx-886c5748870cad340a4f512a2bd5553cd31ec771.zip
(get_default_gateway_interface) try to detect default connection in
this order : adsl > isdn > modem > ethernet
Diffstat (limited to 'perl-install/network')
-rw-r--r--perl-install/network/tools.pm26
1 files changed, 5 insertions, 21 deletions
diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm
index e1d59c69f..a16b89e76 100644
--- a/perl-install/network/tools.pm
+++ b/perl-install/network/tools.pm
@@ -236,33 +236,17 @@ sub find_matching_interface {
} sort keys %$intf;
}
-#- returns first dhcp interface started on boot
-sub get_default_ethernet_dhcp_interface {
- my ($intf) = @_;
- find { /^eth\d+/ && text2bool($intf->{$_}{ONBOOT}) && $intf->{$_}{BOOTPROTO} eq 'dhcp' } sort keys %$intf;
-}
-
-#- returns first ppp interface started on boot
-sub get_default_ppp_interface {
- my ($intf) = @_;
- find { /^ppp\d+/ && text2bool($intf->{$_}{ONBOOT}) } sort keys %$intf;
-}
-
-#- returns ippp interface dialed on boot
-sub get_default_ippp_interface {
- my ($intf) = @_;
- find { /^ippp\d+/ && (text2bool($intf->{$_}{ONBOOT}) || text2bool($intf->{$_}{DIAL_ON_IFUP})) } sort keys %$intf;
-}
-
#- returns gateway interface if found
sub get_default_gateway_interface {
my ($netc, $intf) = @_;
+ my @intfs = sort keys %$intf;
`$::prefix/sbin/ip route show` =~ /^default.*\s+dev\s+(\S+)/m && $1 ||
$netc->{GATEWAYDEV} ||
$netc->{GATEWAY} && find_matching_interface($intf, $netc->{GATEWAY}) ||
- get_default_ethernet_dhcp_interface($intf) ||
- get_default_ppp_interface($intf) ||
- get_default_ippp_interface($intf);
+ find { get_interface_type($intf->{$_}) eq 'adsl' } @intfs ||
+ find { get_interface_type($intf->{$_}) eq 'isdn' && text2bool($intf->{$_}{DIAL_ON_IFUP}) } @intfs ||
+ find { get_interface_type($intf->{$_}) eq 'modem' } @intfs ||
+ find { get_interface_type($intf->{$_}) eq 'ethernet' && $intf->{$_}{BOOTPROTO} eq 'dhcp' } @intfs;
}
#- returns (gateway_interface, interface is up, gateway address, dns server address)