提交 f8c26b8d 编写于 作者: D Denis V. Lunev 提交者: David S. Miller

[NETNS]: Add netns parameter to fib_rules_(un)register.

The patch extends the different fib rules API in order to pass the
network namespace pointer. That will allow to access the different
tables from a namespace relative object. As usual, the pointer to the
init_net variable is passed as parameter so we don't break the
network.
Acked-by: NBenjamin Thery <benjamin.thery@bull.net>
Acked-by: NDaniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: NDenis V. Lunev <den@openvz.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 41a76906
...@@ -101,8 +101,8 @@ static inline u32 frh_get_table(struct fib_rule_hdr *frh, struct nlattr **nla) ...@@ -101,8 +101,8 @@ static inline u32 frh_get_table(struct fib_rule_hdr *frh, struct nlattr **nla)
return frh->table; return frh->table;
} }
extern int fib_rules_register(struct fib_rules_ops *); extern int fib_rules_register(struct net *, struct fib_rules_ops *);
extern int fib_rules_unregister(struct fib_rules_ops *); extern int fib_rules_unregister(struct net *, struct fib_rules_ops *);
extern void fib_rules_cleanup_ops(struct fib_rules_ops *); extern void fib_rules_cleanup_ops(struct fib_rules_ops *);
extern int fib_rules_lookup(struct fib_rules_ops *, extern int fib_rules_lookup(struct fib_rules_ops *,
......
...@@ -74,7 +74,7 @@ static void flush_route_cache(struct fib_rules_ops *ops) ...@@ -74,7 +74,7 @@ static void flush_route_cache(struct fib_rules_ops *ops)
ops->flush_cache(); ops->flush_cache();
} }
int fib_rules_register(struct fib_rules_ops *ops) int fib_rules_register(struct net *net, struct fib_rules_ops *ops)
{ {
int err = -EEXIST; int err = -EEXIST;
struct fib_rules_ops *o; struct fib_rules_ops *o;
...@@ -113,7 +113,7 @@ void fib_rules_cleanup_ops(struct fib_rules_ops *ops) ...@@ -113,7 +113,7 @@ void fib_rules_cleanup_ops(struct fib_rules_ops *ops)
} }
EXPORT_SYMBOL_GPL(fib_rules_cleanup_ops); EXPORT_SYMBOL_GPL(fib_rules_cleanup_ops);
int fib_rules_unregister(struct fib_rules_ops *ops) int fib_rules_unregister(struct net *net, struct fib_rules_ops *ops)
{ {
int err = 0; int err = 0;
struct fib_rules_ops *o; struct fib_rules_ops *o;
......
...@@ -255,12 +255,12 @@ void __init dn_fib_rules_init(void) ...@@ -255,12 +255,12 @@ void __init dn_fib_rules_init(void)
{ {
BUG_ON(fib_default_rule_add(&dn_fib_rules_ops, 0x7fff, BUG_ON(fib_default_rule_add(&dn_fib_rules_ops, 0x7fff,
RT_TABLE_MAIN, 0)); RT_TABLE_MAIN, 0));
fib_rules_register(&dn_fib_rules_ops); fib_rules_register(&init_net, &dn_fib_rules_ops);
} }
void __exit dn_fib_rules_cleanup(void) void __exit dn_fib_rules_cleanup(void)
{ {
fib_rules_unregister(&dn_fib_rules_ops); fib_rules_unregister(&init_net, &dn_fib_rules_ops);
} }
...@@ -314,5 +314,5 @@ static int __init fib_default_rules_init(void) ...@@ -314,5 +314,5 @@ static int __init fib_default_rules_init(void)
void __init fib4_rules_init(void) void __init fib4_rules_init(void)
{ {
BUG_ON(fib_default_rules_init()); BUG_ON(fib_default_rules_init());
fib_rules_register(&fib4_rules_ops); fib_rules_register(&init_net, &fib4_rules_ops);
} }
...@@ -273,7 +273,7 @@ int __init fib6_rules_init(void) ...@@ -273,7 +273,7 @@ int __init fib6_rules_init(void)
if (ret) if (ret)
goto out; goto out;
ret = fib_rules_register(&fib6_rules_ops); ret = fib_rules_register(&init_net, &fib6_rules_ops);
if (ret) if (ret)
goto out_default_rules_init; goto out_default_rules_init;
out: out:
...@@ -286,5 +286,5 @@ int __init fib6_rules_init(void) ...@@ -286,5 +286,5 @@ int __init fib6_rules_init(void)
void fib6_rules_cleanup(void) void fib6_rules_cleanup(void)
{ {
fib_rules_unregister(&fib6_rules_ops); fib_rules_unregister(&init_net, &fib6_rules_ops);
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册