Commit f8c26b8d589867aed8251db2935f8aa03aa68717
Committed by
David S. Miller
1 parent
41a76906b3
Exists in
master
and in
7 other branches
[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: Benjamin Thery <benjamin.thery@bull.net> Acked-by: Daniel Lezcano <dlezcano@fr.ibm.com> Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 5 changed files with 9 additions and 9 deletions Side-by-side Diff
include/net/fib_rules.h
... | ... | @@ -101,8 +101,8 @@ |
101 | 101 | return frh->table; |
102 | 102 | } |
103 | 103 | |
104 | -extern int fib_rules_register(struct fib_rules_ops *); | |
105 | -extern int fib_rules_unregister(struct fib_rules_ops *); | |
104 | +extern int fib_rules_register(struct net *, struct fib_rules_ops *); | |
105 | +extern int fib_rules_unregister(struct net *, struct fib_rules_ops *); | |
106 | 106 | extern void fib_rules_cleanup_ops(struct fib_rules_ops *); |
107 | 107 | |
108 | 108 | extern int fib_rules_lookup(struct fib_rules_ops *, |
net/core/fib_rules.c
... | ... | @@ -74,7 +74,7 @@ |
74 | 74 | ops->flush_cache(); |
75 | 75 | } |
76 | 76 | |
77 | -int fib_rules_register(struct fib_rules_ops *ops) | |
77 | +int fib_rules_register(struct net *net, struct fib_rules_ops *ops) | |
78 | 78 | { |
79 | 79 | int err = -EEXIST; |
80 | 80 | struct fib_rules_ops *o; |
... | ... | @@ -113,7 +113,7 @@ |
113 | 113 | } |
114 | 114 | EXPORT_SYMBOL_GPL(fib_rules_cleanup_ops); |
115 | 115 | |
116 | -int fib_rules_unregister(struct fib_rules_ops *ops) | |
116 | +int fib_rules_unregister(struct net *net, struct fib_rules_ops *ops) | |
117 | 117 | { |
118 | 118 | int err = 0; |
119 | 119 | struct fib_rules_ops *o; |
net/decnet/dn_rules.c
... | ... | @@ -255,11 +255,11 @@ |
255 | 255 | { |
256 | 256 | BUG_ON(fib_default_rule_add(&dn_fib_rules_ops, 0x7fff, |
257 | 257 | RT_TABLE_MAIN, 0)); |
258 | - fib_rules_register(&dn_fib_rules_ops); | |
258 | + fib_rules_register(&init_net, &dn_fib_rules_ops); | |
259 | 259 | } |
260 | 260 | |
261 | 261 | void __exit dn_fib_rules_cleanup(void) |
262 | 262 | { |
263 | - fib_rules_unregister(&dn_fib_rules_ops); | |
263 | + fib_rules_unregister(&init_net, &dn_fib_rules_ops); | |
264 | 264 | } |
net/ipv4/fib_rules.c
net/ipv6/fib6_rules.c
... | ... | @@ -273,7 +273,7 @@ |
273 | 273 | if (ret) |
274 | 274 | goto out; |
275 | 275 | |
276 | - ret = fib_rules_register(&fib6_rules_ops); | |
276 | + ret = fib_rules_register(&init_net, &fib6_rules_ops); | |
277 | 277 | if (ret) |
278 | 278 | goto out_default_rules_init; |
279 | 279 | out: |
... | ... | @@ -286,6 +286,6 @@ |
286 | 286 | |
287 | 287 | void fib6_rules_cleanup(void) |
288 | 288 | { |
289 | - fib_rules_unregister(&fib6_rules_ops); | |
289 | + fib_rules_unregister(&init_net, &fib6_rules_ops); | |
290 | 290 | } |