* [Question/Bug] Should the priority of ip rule be unique?
@ 2016-01-08 6:32 Hong Hui Xiao
2016-01-11 23:01 ` Brian Haley
0 siblings, 1 reply; 3+ messages in thread
From: Hong Hui Xiao @ 2016-01-08 6:32 UTC (permalink / raw)
To: netdev
Hi,
>From the man page of ip rule at [1], it says that "Each rule should have
an explicitly set unique priority value." It is reasonable to have unique
priority for ambiguous rules.
But I have a set of unambiguous ip rules, do I still need to set the
priority of to be unique? In practice, I can set ip rules with duplicated
priority, and things works as expected. I want to confirm with iproute
developers if this is a support usecase. If so, the information in man
page may need updates.
5000: from all fwmark 0x4000000/0xffff0000 lookup table0
5000: from all fwmark 0x4010000/0xffff0000 lookup table1
5000: from all fwmark 0x4020000/0xffff0000 lookup table2
5000: from all fwmark 0x4030000/0xffff0000 lookup table3
[1] http://man7.org/linux/man-pages/man8/ip-rule.8.html (search for
"unique")
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Question/Bug] Should the priority of ip rule be unique?
2016-01-08 6:32 [Question/Bug] Should the priority of ip rule be unique? Hong Hui Xiao
@ 2016-01-11 23:01 ` Brian Haley
2016-01-12 12:35 ` Hong Hui Xiao
0 siblings, 1 reply; 3+ messages in thread
From: Brian Haley @ 2016-01-11 23:01 UTC (permalink / raw)
To: Hong Hui Xiao, netdev
On 01/08/2016 01:32 AM, Hong Hui Xiao wrote:
> Hi,
>
> From the man page of ip rule at [1], it says that "Each rule should have
> an explicitly set unique priority value." It is reasonable to have unique
> priority for ambiguous rules.
> But I have a set of unambiguous ip rules, do I still need to set the
> priority of to be unique? In practice, I can set ip rules with duplicated
> priority, and things works as expected. I want to confirm with iproute
> developers if this is a support usecase. If so, the information in man
> page may need updates.
>
> 5000: from all fwmark 0x4000000/0xffff0000 lookup table0
> 5000: from all fwmark 0x4010000/0xffff0000 lookup table1
> 5000: from all fwmark 0x4020000/0xffff0000 lookup table2
> 5000: from all fwmark 0x4030000/0xffff0000 lookup table3
>
>
> [1] http://man7.org/linux/man-pages/man8/ip-rule.8.html (search for
> "unique")
No, you shouldn't need to set the priority in this case as each rule is unique.
From reading earlier in the man page, and looking at the code, the rules are
ordered and scanned in order of decreasing priority, with a lower priority being
higher. In the case of rules with the same priority they are ordered based on
the order in which they were added to the kernel.
So I guess the man page could be tweaked a little, given "should" seems to
follow the liberal IANA meaning of recommended, but not required.
-Brian
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Question/Bug] Should the priority of ip rule be unique?
2016-01-11 23:01 ` Brian Haley
@ 2016-01-12 12:35 ` Hong Hui Xiao
0 siblings, 0 replies; 3+ messages in thread
From: Hong Hui Xiao @ 2016-01-12 12:35 UTC (permalink / raw)
To: Brian Haley; +Cc: netdev
Thanks Brian. It really helps.
From: Brian Haley <brian.haley@hpe.com>
To: Hong Hui Xiao/China/IBM@IBMCN, netdev@vger.kernel.org
Date: 01/12/2016 07:03
Subject: Re: [Question/Bug] Should the priority of ip rule be
unique?
On 01/08/2016 01:32 AM, Hong Hui Xiao wrote:
> Hi,
>
> From the man page of ip rule at [1], it says that "Each rule should
have
> an explicitly set unique priority value." It is reasonable to have
unique
> priority for ambiguous rules.
> But I have a set of unambiguous ip rules, do I still need to set the
> priority of to be unique? In practice, I can set ip rules with
duplicated
> priority, and things works as expected. I want to confirm with iproute
> developers if this is a support usecase. If so, the information in man
> page may need updates.
>
> 5000: from all fwmark 0x4000000/0xffff0000 lookup table0
> 5000: from all fwmark 0x4010000/0xffff0000 lookup table1
> 5000: from all fwmark 0x4020000/0xffff0000 lookup table2
> 5000: from all fwmark 0x4030000/0xffff0000 lookup table3
>
>
> [1] http://man7.org/linux/man-pages/man8/ip-rule.8.html (search for
> "unique")
No, you shouldn't need to set the priority in this case as each rule is
unique.
From reading earlier in the man page, and looking at the code, the rules
are
ordered and scanned in order of decreasing priority, with a lower priority
being
higher. In the case of rules with the same priority they are ordered
based on
the order in which they were added to the kernel.
So I guess the man page could be tweaked a little, given "should" seems to
follow the liberal IANA meaning of recommended, but not required.
-Brian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-01-12 12:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-08 6:32 [Question/Bug] Should the priority of ip rule be unique? Hong Hui Xiao
2016-01-11 23:01 ` Brian Haley
2016-01-12 12:35 ` Hong Hui Xiao
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.