diff options
author | David S. Miller <davem@davemloft.net> | 2012-06-09 19:27:05 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-09 19:27:05 -0400 |
commit | c3426b47190d7c6785230c91a706fd42208b4120 (patch) | |
tree | 5444acfb2ef8a59c46e580cda8101c32fd3c2973 /net/ipv4/route.c | |
parent | 2397849baa7c44c242e5d5142d5d16d1e7ed53d0 (diff) |
inet: Initialize per-netns inetpeer roots in net/ipv{4,6}/route.c
Instead of net/ipv4/inetpeer.c
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r-- | net/ipv4/route.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 7a4d724765e6..4cd35c3904d4 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -3385,6 +3385,30 @@ static __net_initdata struct pernet_operations rt_genid_ops = { | |||
3385 | .init = rt_genid_init, | 3385 | .init = rt_genid_init, |
3386 | }; | 3386 | }; |
3387 | 3387 | ||
3388 | static int __net_init ipv4_inetpeer_init(struct net *net) | ||
3389 | { | ||
3390 | struct inet_peer_base *bp = kmalloc(sizeof(*bp), GFP_KERNEL); | ||
3391 | |||
3392 | if (!bp) | ||
3393 | return -ENOMEM; | ||
3394 | inet_peer_base_init(bp); | ||
3395 | net->ipv4.peers = bp; | ||
3396 | return 0; | ||
3397 | } | ||
3398 | |||
3399 | static void __net_exit ipv4_inetpeer_exit(struct net *net) | ||
3400 | { | ||
3401 | struct inet_peer_base *bp = net->ipv4.peers; | ||
3402 | |||
3403 | net->ipv4.peers = NULL; | ||
3404 | __inetpeer_invalidate_tree(bp); | ||
3405 | kfree(bp); | ||
3406 | } | ||
3407 | |||
3408 | static __net_initdata struct pernet_operations ipv4_inetpeer_ops = { | ||
3409 | .init = ipv4_inetpeer_init, | ||
3410 | .exit = ipv4_inetpeer_exit, | ||
3411 | }; | ||
3388 | 3412 | ||
3389 | #ifdef CONFIG_IP_ROUTE_CLASSID | 3413 | #ifdef CONFIG_IP_ROUTE_CLASSID |
3390 | struct ip_rt_acct __percpu *ip_rt_acct __read_mostly; | 3414 | struct ip_rt_acct __percpu *ip_rt_acct __read_mostly; |
@@ -3465,6 +3489,7 @@ int __init ip_rt_init(void) | |||
3465 | register_pernet_subsys(&sysctl_route_ops); | 3489 | register_pernet_subsys(&sysctl_route_ops); |
3466 | #endif | 3490 | #endif |
3467 | register_pernet_subsys(&rt_genid_ops); | 3491 | register_pernet_subsys(&rt_genid_ops); |
3492 | register_pernet_subsys(&ipv4_inetpeer_ops); | ||
3468 | return rc; | 3493 | return rc; |
3469 | } | 3494 | } |
3470 | 3495 | ||