Mageia Bugzilla – Attachment 676 Details for
Bug 1266
network::tools::get_routes() doesn't work with kernel-2.6.39
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
fix reading routes on both older and newer kernels (2.6.39+)
routes.diff (text/plain), 765 bytes, created by
Thierry Vignaud
on 2011-07-25 14:54:55 CEST
(
hide
)
Description:
fix reading routes on both older and newer kernels (2.6.39+)
Filename:
MIME Type:
Creator:
Thierry Vignaud
Created:
2011-07-25 14:54:55 CEST
Size:
765 bytes
patch
obsolete
>diff -up ./network/tools.pm.tv2 ./network/tools.pm >--- ./network/tools.pm.tv2 2011-07-25 12:30:34.557684586 +0000 >+++ ./network/tools.pm 2011-07-25 12:52:16.855875299 +0000 >@@ -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) }
diff -up ./network/tools.pm.tv2 ./network/tools.pm --- ./network/tools.pm.tv2 2011-07-25 12:30:34.557684586 +0000 +++ ./network/tools.pm 2011-07-25 12:52:16.855875299 +0000 @@ -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) }
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1266
: 676