summaryrefslogtreecommitdiffstats
path: root/perl-install/network/tools.pm
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2004-08-27 11:49:48 +0000
committerOlivier Blin <oblin@mandriva.org>2004-08-27 11:49:48 +0000
commit8fb993e064a06b3958a498a588e37500937af881 (patch)
tree2c0c8b7a9ede7bb0cb855e6db473056960b246b5 /perl-install/network/tools.pm
parent59af944646e11f6806f84e48c3b6b0ebc0385437 (diff)
downloaddrakx-8fb993e064a06b3958a498a588e37500937af881.tar
drakx-8fb993e064a06b3958a498a588e37500937af881.tar.gz
drakx-8fb993e064a06b3958a498a588e37500937af881.tar.bz2
drakx-8fb993e064a06b3958a498a588e37500937af881.tar.xz
drakx-8fb993e064a06b3958a498a588e37500937af881.zip
write metric in ifcfg files according to connection type
Diffstat (limited to 'perl-install/network/tools.pm')
-rw-r--r--perl-install/network/tools.pm12
1 files changed, 11 insertions, 1 deletions
diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm
index a789df850..536870973 100644
--- a/perl-install/network/tools.pm
+++ b/perl-install/network/tools.pm
@@ -289,7 +289,17 @@ sub get_interface_type {
my ($interface) = @_;
$interface->{DEVICE} =~ /^(eth|ath|wlan)/ && "ethernet" ||
$interface->{DEVICE} =~ /^ippp/ && "isdn" ||
- $interface->{DEVICE} =~ /^ppp/ && (member($interface->{TYPE}, "xDSL", "ADSL") ? "adsl" : "modem");
+ $interface->{DEVICE} =~ /^ppp/ && (member($interface->{TYPE}, "xDSL", "ADSL") ? "adsl" : "modem") ||
+ "unknown";
+}
+
+sub get_default_metric {
+ my ($type) = @_;
+ my @known_types = ("ethernet_gigabit", "ethernet", "adsl", "isdn", "modem", "unknown");
+ my $idx;
+ eval { $idx = find_index { $type eq $_ } @known_types };
+ $idx = @known_types if $@;
+ $idx * 10;
}
1;