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>
This commit is contained in:
parent
5611551103
commit
d8a566beaa
4 changed files with 21 additions and 36 deletions
|
@ -39,6 +39,24 @@ int fib_default_rule_add(struct fib_rules_ops *ops,
|
|||
}
|
||||
EXPORT_SYMBOL(fib_default_rule_add);
|
||||
|
||||
u32 fib_default_rule_pref(struct fib_rules_ops *ops)
|
||||
{
|
||||
struct list_head *pos;
|
||||
struct fib_rule *rule;
|
||||
|
||||
if (!list_empty(&ops->rules_list)) {
|
||||
pos = ops->rules_list.next;
|
||||
if (pos->next != &ops->rules_list) {
|
||||
rule = list_entry(pos->next, struct fib_rule, list);
|
||||
if (rule->pref)
|
||||
return rule->pref - 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(fib_default_rule_pref);
|
||||
|
||||
static void notify_rule_change(int event, struct fib_rule *rule,
|
||||
struct fib_rules_ops *ops, struct nlmsghdr *nlh,
|
||||
u32 pid);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue