Commit 03592383 authored by Denis V. Lunev's avatar Denis V. Lunev Committed by David S. Miller

[FIB]: Add netns to fib_rules_ops.

The backward link from FIB rules operations to the network namespace
will allow to simplify the API a bit.
Signed-off-by: default avatarDenis V. Lunev <den@openvz.org>
Acked-by: default avatarDaniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 853f4b50
...@@ -67,6 +67,7 @@ struct fib_rules_ops ...@@ -67,6 +67,7 @@ struct fib_rules_ops
const struct nla_policy *policy; const struct nla_policy *policy;
struct list_head rules_list; struct list_head rules_list;
struct module *owner; struct module *owner;
struct net *fro_net;
}; };
#define FRA_GENERIC_POLICY \ #define FRA_GENERIC_POLICY \
......
...@@ -249,6 +249,7 @@ static struct fib_rules_ops dn_fib_rules_ops = { ...@@ -249,6 +249,7 @@ static struct fib_rules_ops dn_fib_rules_ops = {
.policy = dn_fib_rule_policy, .policy = dn_fib_rule_policy,
.rules_list = LIST_HEAD_INIT(dn_fib_rules_ops.rules_list), .rules_list = LIST_HEAD_INIT(dn_fib_rules_ops.rules_list),
.owner = THIS_MODULE, .owner = THIS_MODULE,
.fro_net = &init_net,
}; };
void __init dn_fib_rules_init(void) void __init dn_fib_rules_init(void)
......
...@@ -315,6 +315,8 @@ int __net_init fib4_rules_init(struct net *net) ...@@ -315,6 +315,8 @@ int __net_init fib4_rules_init(struct net *net)
if (ops == NULL) if (ops == NULL)
return -ENOMEM; return -ENOMEM;
INIT_LIST_HEAD(&ops->rules_list); INIT_LIST_HEAD(&ops->rules_list);
ops->fro_net = net;
fib_rules_register(net, ops); fib_rules_register(net, ops);
err = fib_default_rules_init(ops); err = fib_default_rules_init(ops);
......
...@@ -249,6 +249,7 @@ static struct fib_rules_ops fib6_rules_ops = { ...@@ -249,6 +249,7 @@ static struct fib_rules_ops fib6_rules_ops = {
.policy = fib6_rule_policy, .policy = fib6_rule_policy,
.rules_list = LIST_HEAD_INIT(fib6_rules_ops.rules_list), .rules_list = LIST_HEAD_INIT(fib6_rules_ops.rules_list),
.owner = THIS_MODULE, .owner = THIS_MODULE,
.fro_net = &init_net,
}; };
static int __init fib6_default_rules_init(void) static int __init fib6_default_rules_init(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment