summaryrefslogtreecommitdiffstats
path: root/perl-install/network
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/network')
-rw-r--r--perl-install/network/adsl.pm2
-rw-r--r--perl-install/network/modem.pm2
-rw-r--r--perl-install/network/netconnect.pm3
-rw-r--r--perl-install/network/network.pm3
-rw-r--r--perl-install/network/tools.pm12
5 files changed, 20 insertions, 2 deletions
diff --git a/perl-install/network/adsl.pm b/perl-install/network/adsl.pm
index 00354e186..985a999a8 100644
--- a/perl-install/network/adsl.pm
+++ b/perl-install/network/adsl.pm
@@ -291,9 +291,11 @@ user "$adsl->{login}"
#- FIXME:
#- ppp0 and ippp0 are hardcoded
my $kind = $adsl_type eq 'pppoe' ? 'xDSL' : 'ADSL';
+ my $metric = network::tools::get_default_metric("adsl"); #- FIXME, do not override if already set
output_with_perm("$::prefix/etc/sysconfig/network-scripts/ifcfg-ppp0", 0705, qq(DEVICE=ppp0
ONBOOT=no
TYPE=$kind
+METRIC=$metric
));
# sagem specific stuff
diff --git a/perl-install/network/modem.pm b/perl-install/network/modem.pm
index e790cf83c..9ac9f91b0 100644
--- a/perl-install/network/modem.pm
+++ b/perl-install/network/modem.pm
@@ -76,6 +76,7 @@ sub ppp_configure {
}
$toreplace{Gateway} = $modem->{auto_gateway} eq N("Automatic") ? '0.0.0.0' : $modem->{Gateway};
+ $toreplace{metric} = defined($modem->{metric}) ? $modem->{metric} : network::tools::get_default_metric("modem");
#- build ifcfg-ppp0.
my $various = <<END;
@@ -102,6 +103,7 @@ DISCONNECTTIMEOUT="5"
RETRYTIMEOUT="60"
BOOTPROTO="none"
PEERDNS="$toreplace{peerdns}"
+METRIC=$toreplace{metric}
END
output("$::prefix/etc/sysconfig/network-scripts/ifcfg-ppp0",
$various,
diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm
index cf5daabf6..cd19676a7 100644
--- a/perl-install/network/netconnect.pm
+++ b/perl-install/network/netconnect.pm
@@ -864,6 +864,9 @@ Do you really want to reconfigure this device?"),
{
pre => sub {
$find_lan_module->();
+ my $intf_type = member($module, list_modules::category2modules('network/gigabit')) ? "ethernet_gigabit" : "ethernet";
+ defined($ethntf->{METRIC}) or $ethntf->{METRIC} = network::tools::get_default_metric($intf_type);
+
$protocol = $l10n_lan_protocols{defined $auto_ip ? ($auto_ip ? 'dhcp' : 'static') : $ethntf->{BOOTPROTO}} || 0;
},
name => sub {
diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm
index 7be0aa698..2b07a95b9 100644
--- a/perl-install/network/network.pm
+++ b/perl-install/network/network.pm
@@ -154,13 +154,14 @@ sub write_interface_conf {
ONBOOT => bool2yesno(!member($intf->{DEVICE}, map { $_->{device} } detect_devices::pcmcia_probe())),
});
+ defined($intf->{METRIC}) or $intf->{METRIC} = network::tools::get_default_metric(network::tools::get_interface_type($intf)),
$intf->{BOOTPROTO} =~ s/dhcp.*/dhcp/;
if (local $intf->{WIRELESS_ENC_KEY} = $intf->{WIRELESS_ENC_KEY}) {
network::tools::convert_wep_key_for_iwconfig($intf->{WIRELESS_ENC_KEY});
}
- setVarsInSh($file, $intf, qw(DEVICE BOOTPROTO IPADDR NETMASK NETWORK BROADCAST ONBOOT HWADDR MII_NOT_SUPPORTED),
+ setVarsInSh($file, $intf, qw(DEVICE BOOTPROTO IPADDR NETMASK NETWORK BROADCAST ONBOOT HWADDR METRIC MII_NOT_SUPPORTED),
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)),
if_($intf->{DEVICE} =~ /^ippp\d+$/, qw(DIAL_ON_IFUP))
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;