From 7b1a74fdbb9ec38a9780620fae25519fde4b21ee Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Thu, 10 Jan 2008 03:22:17 -0800 Subject: [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 Acked-by: Daniel Lezcano Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- net/ipv4/fib_rules.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'net/ipv4/fib_rules.c') diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c index 0751734ecf4..1aae61c8ea6 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) return 0; } -int __init fib4_rules_init() +int __net_init fib4_rules_init(struct net *net) { int err; - fib_rules_register(&init_net, &fib4_rules_ops); + fib_rules_register(net, &fib4_rules_ops); err = fib_default_rules_init(); if (err < 0) goto fail; @@ -323,6 +323,11 @@ int __init fib4_rules_init() fail: /* also cleans all rules already added */ - fib_rules_unregister(&init_net, &fib4_rules_ops); + fib_rules_unregister(net, &fib4_rules_ops); return err; } + +void __net_exit fib4_rules_exit(struct net *net) +{ + fib_rules_unregister(net, &fib4_rules_ops); +} -- cgit v1.2.3-18-g5258