Bug 1266 - network::tools::get_routes() doesn't work with kernel-2.6.39
Summary: network::tools::get_routes() doesn't work with kernel-2.6.39
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: All Linux
Priority: Normal enhancement
Target Milestone: Mageia 3
Assignee: Olivier Blin
QA Contact:
URL:
Whiteboard: (Mga2)
Keywords: PATCH
: 2169 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-05-13 20:50 CEST by Thierry Vignaud
Modified: 2012-09-06 15:26 CEST (History)
7 users (show)

See Also:
Source RPM: drakx-net
CVE:
Status comment:


Attachments
fix reading routes on both older and newer kernels (2.6.39+) (765 bytes, patch)
2011-07-25 14:54 CEST, Thierry Vignaud
Details | Diff

Description Thierry Vignaud 2011-05-13 20:50:05 CEST
network::tools::get_routes() doesn't work with kernel-2.6.39 since /proc/net/routes output is reversed.
"eth0    00000000  (...)" is now listed first instead of last.
eg:

face   Destination(...)
eth0    00000000  (...)
eth0    0000FEA9 (...)

Thus get_current_gateway_interface() fails, thus has_network_connection() fails too.
Thus both net_applet & mgaapplet see the network as down whereas it's up
Thierry Vignaud 2011-05-16 15:56:00 CEST

Source RPM: draxk-net => drakx-net

D Morgan 2011-05-17 15:40:56 CEST

CC: (none) => dmorganec
Target Milestone: --- => Mageia 2

Comment 1 Ahmad Samir 2011-05-17 17:28:46 CEST
(Why Mageia 2? if possible it should be fixed before Mageia 1 is out....).
Comment 2 Ahmad Samir 2011-05-20 05:27:59 CEST
*** Bug 1319 has been marked as a duplicate of this bug. ***

CC: (none) => davidwhodgins

Comment 3 Stefan Puch 2011-05-26 12:02:34 CEST
I can confirm this bug. It is located in Mandriva 2010.2 as well. I used the following workaround for kernel 2.6.39 as I cannot program perl:

- edit /usr/lib/libDrakX/network/tools.pm
- locate line foreach (cat_("/proc/net/route")) {
  in function sub get_routes()
- replace the line with the following three lines of code:
my @content = cat_("/proc/net/route");
my @rev_content = sort {$b cmp $a} @content;
foreach (@rev_content)  {   

This is just a quick hack to resort the lines from /proc/net/route 
This implies that net_applet will fail with kernel version before 2.6.39!

CC: (none) => s.puch

Colin Guthrie 2011-07-16 22:53:34 CEST

CC: (none) => mageia

Comment 4 Ahmad Samir 2011-07-21 17:05:38 CEST
*** Bug 2169 has been marked as a duplicate of this bug. ***

CC: (none) => oliver.bgr

Comment 5 Fabien Balsacq 2011-07-24 22:54:59 CEST
With kernel 3.0 this is still the same.

And the simple workaround (just tested it) from Stefan Puch is functional for the libdrakx-net-0.97-1.mga1 package.

Therefore it's probably worth having this included in a coming libdrakx-net-0.98.mga2 which would have with kernel 3.0 minimum as dependency.

CC: (none) => balsacq

Comment 6 Thierry Vignaud 2011-07-25 14:54:55 CEST
Created attachment 676 [details]
fix reading routes on both older and newer kernels (2.6.39+)
Comment 7 Thierry Vignaud 2011-07-25 14:55:27 CEST
Of course, it would be better to move bootloader::cmp_kernel_versions() to any.pm...

Keywords: (none) => PATCH

Comment 8 Olivier Blin 2011-07-27 00:19:26 CEST
I'd prefer to get the same code working for both 2.6.39+ and previous versions.

Status: NEW => ASSIGNED

Comment 9 Thierry Vignaud 2011-07-27 12:40:24 CEST
Then change your data structure in order to get keep all routes for each interface instead of keeping only one, then lookup the right one...
Comment 10 Manuel Hiebel 2011-07-31 16:12:44 CEST
seems fixed in cauldron, closing ?
Comment 11 Olivier Blin 2011-07-31 23:21:57 CEST
Please don't close for now, I'll work on a more generic fix
Comment 12 Thierry Vignaud 2011-08-23 16:09:34 CEST
But when :-) ?

Decreasing the priority then..

Severity: normal => enhancement

Comment 13 Thierry Vignaud 2011-12-16 23:45:01 CET
... :-)
Comment 14 Olivier Blin 2012-04-30 00:31:43 CEST
There's also this fix from Mandriva:
http://svn.mandriva.com/viewvc/soft/drakx-net/trunk/lib/network/tools.pm?r1=253976&r2=273311
Comment 15 Marja Van Waes 2012-05-26 13:02:57 CEST
Hi,

This bug was filed against cauldron, but we do not have cauldron at the moment.

Please report whether this bug is still valid for Mageia 2.

Thanks :)

Cheers,
marja

Keywords: (none) => NEEDINFO

Comment 16 Marja Van Waes 2012-06-16 19:50:43 CEST
(In reply to comment #14)
> There's also this fix from Mandriva:
> http://svn.mandriva.com/viewvc/soft/drakx-net/trunk/lib/network/tools.pm?r1=253976&r2=273311

In the change log I don't see you applied this fix, so I take it this bug is still valid

Keywords: NEEDINFO => (none)
CC: (none) => marja11
Target Milestone: Mageia 2 => Mageia 3
Whiteboard: (none) => (Mga2)

Comment 17 Thierry Vignaud 2012-09-06 15:26:20 CEST
After 1+ year, let's close it

Status: ASSIGNED => RESOLVED
Resolution: (none) => FIXED


Note You need to log in before you can comment on or make changes to this bug.