diff options
Diffstat (limited to 'lib/network/tools.pm')
-rw-r--r-- | lib/network/tools.pm | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/network/tools.pm b/lib/network/tools.pm index 60eeb8b..ed6ec39 100644 --- a/lib/network/tools.pm +++ b/lib/network/tools.pm @@ -263,7 +263,10 @@ sub host_hex_to_dotted { sub get_routes() { my %routes; - foreach (cat_("/proc/net/route")) { + my @routes = cat_("/proc/net/route"); + require bootloader; + @routes = reverse(@routes) if bootloader::cmp_kernel_versions(c::kernel_version(), "2.6.39") >= 0; + foreach (@routes) { if (/^(\S+)\s+([0-9A-F]+)\s+([0-9A-F]+)\s+[0-9A-F]+\s+\d+\s+\d+\s+(\d+)\s+([0-9A-F]+)/) { if (defined $3) { $routes{$1}{gateway} = hex($3) ? host_hex_to_dotted($3) : $routes{$1}{network} } if (defined $2) { $routes{$1}{network} = host_hex_to_dotted($2) } |