summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2005-07-01 06:46:21 +0000
committerOlivier Blin <oblin@mandriva.org>2005-07-01 06:46:21 +0000
commit8325ea4f5a95738dc5794b46e6a4782d503e552f (patch)
tree404bd77da9ee0c59d7dd130e86353318687b8dc0
parentad4662164cb3a73838c02b9f518f8bad4a47774c (diff)
downloaddrakx-8325ea4f5a95738dc5794b46e6a4782d503e552f.tar
drakx-8325ea4f5a95738dc5794b46e6a4782d503e552f.tar.gz
drakx-8325ea4f5a95738dc5794b46e6a4782d503e552f.tar.bz2
drakx-8325ea4f5a95738dc5794b46e6a4782d503e552f.tar.xz
drakx-8325ea4f5a95738dc5794b46e6a4782d503e552f.zip
remove useless grouping and rewrite code to be safer
-rw-r--r--perl-install/network/tools.pm8
1 files changed, 4 insertions, 4 deletions
diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm
index cf93a5319..1d15b50c0 100644
--- a/perl-install/network/tools.pm
+++ b/perl-install/network/tools.pm
@@ -238,10 +238,10 @@ sub host_hex_to_dotted {
sub get_routes() {
my %routes;
foreach (cat_("/proc/net/route")) {
- if (/^(\w+)\s+([0-9A-F]+)\s+([0-9A-F]+)\s+(?:[0-9A-F]+)\s+\d+\s+\d+\s+(\d+)\s+([0-9A-F]+)/) {
- hex($2) and $routes{$1}{network} = host_hex_to_dotted($2);
- hex($3) and $routes{$1}{gateway} = host_hex_to_dotted($3);
- $4 and $routes{$1}{metric} = $4;
+ if (/^(\w+)\s+([0-9A-F]+)\s+([0-9A-F]+)\s+[0-9A-F]+\s+\d+\s+\d+\s+(\d+)\s+([0-9A-F]+)/) {
+ if (hex($2)) { $routes{$1}{network} = host_hex_to_dotted($2) }
+ elsif (hex($3)) { $routes{$1}{gateway} = host_hex_to_dotted($3) }
+ elsif ($4) { $routes{$1}{metric} = $4 }
}
}
#- TODO: handle IPv6 with /proc/net/ipv6_route