diff options
author | Patrick McHardy <kaber@trash.net> | 2010-04-13 01:03:15 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-13 17:49:30 -0400 |
commit | d8a566beaa75c6ad5e38cdccf0ea5294323e7866 (patch) | |
tree | 56fc11f0806e9e869e65c44a697c896add4b78f6 /net/core | |
parent | 561155110307ad304226a23272244398fa46cbae (diff) |
net: fib_rules: consolidate IPv4 and DECnet ->default_pref() functions.
Both functions are equivalent, consolidate them since a following patch
needs a third implementation for multicast routing.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/fib_rules.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index 05cce4ec84dd..1eb32276be77 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c | |||
@@ -39,6 +39,24 @@ int fib_default_rule_add(struct fib_rules_ops *ops, | |||
39 | } | 39 | } |
40 | EXPORT_SYMBOL(fib_default_rule_add); | 40 | EXPORT_SYMBOL(fib_default_rule_add); |
41 | 41 | ||
42 | u32 fib_default_rule_pref(struct fib_rules_ops *ops) | ||
43 | { | ||
44 | struct list_head *pos; | ||
45 | struct fib_rule *rule; | ||
46 | |||
47 | if (!list_empty(&ops->rules_list)) { | ||
48 | pos = ops->rules_list.next; | ||
49 | if (pos->next != &ops->rules_list) { | ||
50 | rule = list_entry(pos->next, struct fib_rule, list); | ||
51 | if (rule->pref) | ||
52 | return rule->pref - 1; | ||
53 | } | ||
54 | } | ||
55 | |||
56 | return 0; | ||
57 | } | ||
58 | EXPORT_SYMBOL(fib_default_rule_pref); | ||
59 | |||
42 | static void notify_rule_change(int event, struct fib_rule *rule, | 60 | static void notify_rule_change(int event, struct fib_rule *rule, |
43 | struct fib_rules_ops *ops, struct nlmsghdr *nlh, | 61 | struct fib_rules_ops *ops, struct nlmsghdr *nlh, |
44 | u32 pid); | 62 | u32 pid); |