diff mbox

[net-next] net: ipv6: use common fib_default_rule_pref

Message ID 1441198992-25359-1-git-send-email-phil@nwl.cc
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Phil Sutter Sept. 2, 2015, 1:03 p.m. UTC
This switches IPv6 policy routing to use the shared
fib_default_rule_pref() function of IPv4 and DECnet. It is also used in
multicast routing for IPv4 as well as IPv6.

The motivation for this patch is a complaint about iproute2 behaving
inconsistent between IPv4 and IPv6 when adding policy rules: Formerly,
IPv6 rules were assigned a fixed priority of 0x3FFF whereas for IPv4 the
assigned priority value was decreased with each rule added.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 net/ipv6/fib6_rules.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

David Miller Sept. 2, 2015, 6:34 p.m. UTC | #1
From: Phil Sutter <phil@nwl.cc>
Date: Wed,  2 Sep 2015 15:03:12 +0200

> This switches IPv6 policy routing to use the shared
> fib_default_rule_pref() function of IPv4 and DECnet. It is also used in
> multicast routing for IPv4 as well as IPv6.
> 
> The motivation for this patch is a complaint about iproute2 behaving
> inconsistent between IPv4 and IPv6 when adding policy rules: Formerly,
> IPv6 rules were assigned a fixed priority of 0x3FFF whereas for IPv4 the
> assigned priority value was decreased with each rule added.
> 
> Signed-off-by: Phil Sutter <phil@nwl.cc>

All ->default_pref() methods are therefore going to be set to the
default, so just kill off the method entirely and call
fib_default_rule_pref() directly.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Thomas Graf Sept. 2, 2015, 6:46 p.m. UTC | #2
On 09/02/15 at 11:34am, David Miller wrote:
> From: Phil Sutter <phil@nwl.cc>
> Date: Wed,  2 Sep 2015 15:03:12 +0200
> 
> > This switches IPv6 policy routing to use the shared
> > fib_default_rule_pref() function of IPv4 and DECnet. It is also used in
> > multicast routing for IPv4 as well as IPv6.
> > 
> > The motivation for this patch is a complaint about iproute2 behaving
> > inconsistent between IPv4 and IPv6 when adding policy rules: Formerly,
> > IPv6 rules were assigned a fixed priority of 0x3FFF whereas for IPv4 the
> > assigned priority value was decreased with each rule added.
> > 
> > Signed-off-by: Phil Sutter <phil@nwl.cc>
> 
> All ->default_pref() methods are therefore going to be set to the
> default, so just kill off the method entirely and call
> fib_default_rule_pref() directly.

How strict are we with regard to compatibility here? New IPv6 rules
with no pref specified currently get appended at the end of the list
whereas this would start inserting at the head.

I'm absolutely in favour of the new behaviour but this could break
scripts which do not have proper prefs specified.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index 2367a16..a859ad2 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -258,11 +258,6 @@  nla_put_failure:
 	return -ENOBUFS;
 }
 
-static u32 fib6_rule_default_pref(struct fib_rules_ops *ops)
-{
-	return 0x3FFF;
-}
-
 static size_t fib6_rule_nlmsg_payload(struct fib_rule *rule)
 {
 	return nla_total_size(16) /* dst */
@@ -279,7 +274,7 @@  static const struct fib_rules_ops __net_initconst fib6_rules_ops_template = {
 	.configure		= fib6_rule_configure,
 	.compare		= fib6_rule_compare,
 	.fill			= fib6_rule_fill,
-	.default_pref		= fib6_rule_default_pref,
+	.default_pref		= fib_default_rule_pref,
 	.nlmsg_payload		= fib6_rule_nlmsg_payload,
 	.nlgroup		= RTNLGRP_IPV6_RULE,
 	.policy			= fib6_rule_policy,