diff options
author | Denis V. Lunev <den@openvz.org> | 2008-01-10 06:22:17 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:01:25 -0500 |
commit | 7b1a74fdbb9ec38a9780620fae25519fde4b21ee (patch) | |
tree | a8405f9a3e30cf6750d60aff16e555d4901ce57f /net/ipv4/fib_rules.c | |
parent | dbb50165b512f6c9b7aae10af73ae5b6d811f4d0 (diff) |
[NETNS]: Refactor fib initialization so it can handle multiple namespaces.
This patch makes the fib to be initialized as a subsystem for the
network namespaces. The code does not handle several namespaces yet,
so in case of a creation of a network namespace, the
creation/initialization will not occur.
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>
Diffstat (limited to 'net/ipv4/fib_rules.c')
-rw-r--r-- | net/ipv4/fib_rules.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c index 0751734ecf41..1aae61c8ea6a 100644 --- a/net/ipv4/fib_rules.c +++ b/net/ipv4/fib_rules.c | |||
@@ -311,11 +311,11 @@ static int __init fib_default_rules_init(void) | |||
311 | return 0; | 311 | return 0; |
312 | } | 312 | } |
313 | 313 | ||
314 | int __init fib4_rules_init() | 314 | int __net_init fib4_rules_init(struct net *net) |
315 | { | 315 | { |
316 | int err; | 316 | int err; |
317 | 317 | ||
318 | fib_rules_register(&init_net, &fib4_rules_ops); | 318 | fib_rules_register(net, &fib4_rules_ops); |
319 | err = fib_default_rules_init(); | 319 | err = fib_default_rules_init(); |
320 | if (err < 0) | 320 | if (err < 0) |
321 | goto fail; | 321 | goto fail; |
@@ -323,6 +323,11 @@ int __init fib4_rules_init() | |||
323 | 323 | ||
324 | fail: | 324 | fail: |
325 | /* also cleans all rules already added */ | 325 | /* also cleans all rules already added */ |
326 | fib_rules_unregister(&init_net, &fib4_rules_ops); | 326 | fib_rules_unregister(net, &fib4_rules_ops); |
327 | return err; | 327 | return err; |
328 | } | 328 | } |
329 | |||
330 | void __net_exit fib4_rules_exit(struct net *net) | ||
331 | { | ||
332 | fib_rules_unregister(net, &fib4_rules_ops); | ||
333 | } | ||