Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 257801 - sys-apps/iproute2 unexpected results of ip rule flush
Summary: sys-apps/iproute2 unexpected results of ip rule flush
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High minor (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-05 18:46 UTC by Dmitriy Bogun
Modified: 2009-07-11 06:15 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
test system1 info (iproute2-system1-info,3.07 KB, text/plain)
2009-02-05 22:47 UTC, Dmitriy Bogun
Details
test system2 info (iproute2-system2-info,3.31 KB, text/plain)
2009-02-05 22:47 UTC, Dmitriy Bogun
Details
test system2 info (iproute2-system2-info,3.48 KB, text/plain)
2009-02-08 21:05 UTC, Dmitriy Bogun
Details
test system1 info(after update) (iproute2-system1-info,3.05 KB, text/plain)
2009-02-13 14:08 UTC, Dmitriy Bogun
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitriy Bogun 2009-02-05 18:46:15 UTC
Looks like that "ip rule flush" break some internals. So further manipulation with rules may lead to unexpected results.

Short example
# ip rule
0:      from all lookup local 
32766:  from all lookup main 
32767:  from all lookup default

# ip rule flush
0:      from all lookup local 

# ip rule add table default
# ip rule add table main
# ip rule
0:      from all lookup local 
0:      from all lookup main 
0:      from all lookup default

All rule indexes now 0. They continue to work, but there is no warranty that rules will executed in proper order. In some cases last rule appear not after rule "0: from all lookup local", it appear in some random place. Unfortunately now I can't repeat it. Most experiments with ip rules in lead to system reboot.

Reproducible: Always




I have tested 2 system - both show such results.

System details:
1.
# uname -a
Linux alice 2.6.24.4-00 #2 Sat Jan 31 03:41:52 EET 2009 i586 Pentium MMX GenuineIntel GNU/Linux
# eix -ce iproute2
[I] sys-apps/iproute2 (2.6.24.20080108@19.01.2009 -> (~)2.6.28): kernel routing and traffic control utilities

2.
# uname -a
Linux mahoro 2.6.25-hardened-r11 #4 Sat Jan 31 02:26:47 EET 2009 i686 Pentium III (Katmai) GenuineIntel GNU/Linux
# eix -ce iproute2
[I] sys-apps/iproute2 (2.6.24.20080108@29.07.2008): kernel routing and traffic control utilities
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2009-02-05 22:41:34 UTC
Please post your `emerge --info' too.
Comment 2 Dmitriy Bogun 2009-02-05 22:47:18 UTC
Created attachment 181091 [details]
test system1 info
Comment 3 Dmitriy Bogun 2009-02-05 22:47:44 UTC
Created attachment 181092 [details]
test system2 info
Comment 4 SpanKY gentoo-dev 2009-02-08 19:17:00 UTC
you're saying that running `ip rule` sometimes causes your system to reboot ?

the `uname` output of your system2 doesnt match the emerge info of your system2

what version of iproute2 exactly are you using ?  can you test with a 2.6.28 kernel ?
Comment 5 Dmitriy Bogun 2009-02-08 21:04:22 UTC
No, command "ip rule" and "ip rule flush" not causes reboot. I try to say - that only reboot of system can return ip rule to initial state.

Sorry for system2 info, I will now upload correct version.

I use 
# ip -V
ip utility, iproute2-ss080108
sys-apps/iproute2-2.6.24.20080108
on both systems.

What version of iproute2 and kernel should I test? It must be gentoo-sources or vanilla-sources or hardened-sources?
Comment 6 Dmitriy Bogun 2009-02-08 21:05:23 UTC
Created attachment 181379 [details]
test system2 info

Now it must be correct.
Comment 7 SpanKY gentoo-dev 2009-02-08 23:44:23 UTC
any 2.6.28 kernel with 2.6.28 iproute2 should be fine, thanks
Comment 8 Dmitriy Bogun 2009-02-13 14:07:52 UTC
I have updated system1 to =vanilla-sources-2.6.28.4 and iproute2 to 
=sys-apps/iproute2-2.6.28

# ip -V
ip utility, iproute2-ss090115

The problem still there.
+ echo part 0
part 0
+ ip rule ls
0:      from all lookup local 
32762:  from all lookup main 
32763:  from 77.244.36.156 lookup i_vokar 
32764:  from all fwmark 0x21 lookup i_vokar 
32765:  from 85.90.221.86 lookup i_velton 
32766:  from all fwmark 0x20 lookup i_velton 
32767:  from all lookup default 
+ echo Flush rules
Flush rules
+ ip rule flush
+ ip rule ls
0:      from all lookup local 
+ echo Restore default rules
Restore default rules
+ ip rule add table default
+ ip rule add table main
+ echo Setup site rules
Setup site rules
+ /etc/init.d/net.rtrules zap
 * Manually resetting net.rtrules to stopped state.
+ /etc/init.d/net.rtrules start
 * Activaiting iproute2 rules(set in reverse order)
 *   Apply ip rule del table main ...                           [ ok ]
 *   Apply ip rule add fwmark 32 table i_velton ...             [ ok ]
 *   Apply ip rule add from 85.90.221.86 table i_velton ...     [ ok ]
 *   Apply ip rule add fwmark 33 table i_vokar ...              [ ok ]
 *   Apply ip rule add from 77.244.36.156 table i_vokar ...     [ ok ]
 *   Apply ip rule add table main ...                           [ ok ]
+ echo Final rules layout
Final rules layout
+ ip rule ls
0:      from all lookup local 
0:      from all lookup default 
0:      from all fwmark 0x20 lookup i_velton 
0:      from 85.90.221.86 lookup i_velton 
0:      from all fwmark 0x21 lookup i_vokar 
0:      from 77.244.36.156 lookup i_vokar 
0:      from all lookup main

As you can see - all rules have index 0. And rule "ip rule add table default" must be last one, in normal case rules added in reverse order, something like LIFO. Afret this script system became unavailable from network... there is nothing surprisingly because table "default" contain default routes... and system not see local routes on interfaces if table "default" will lookup first before table "main".

Here is "normal" rules order afrer system reboot. Set by the same script /etc/init.d/net.rtrules
# ip rule ls
0:      from all lookup local 
32762:  from all lookup main 
32763:  from 77.244.36.156 lookup i_vokar 
32764:  from all fwmark 0x21 lookup i_vokar 
32765:  from 85.90.221.86 lookup i_velton 
32766:  from all fwmark 0x20 lookup i_velton 
32767:  from all lookup default

Comment 9 Dmitriy Bogun 2009-02-13 14:08:49 UTC
Created attachment 181872 [details]
test system1 info(after update)
Comment 10 Alin Năstac (RETIRED) gentoo-dev 2009-07-11 06:14:46 UTC
I don't understand what you consider to be broken. If you want to restore the rule table to its initial state, you have to use pref parameter like so:
  ip rule add table main pref 32766
  ip rule add table default pref 32767

Closed as INVALID.