aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/route.c2
-rw-r--r--net/ipv4/xfrm4_policy.c13
2 files changed, 13 insertions, 2 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 278f46f5011b..fafbe163e2b5 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -3442,7 +3442,7 @@ int __init ip_rt_init(void)
3442 printk(KERN_ERR "Unable to create route proc files\n"); 3442 printk(KERN_ERR "Unable to create route proc files\n");
3443#ifdef CONFIG_XFRM 3443#ifdef CONFIG_XFRM
3444 xfrm_init(); 3444 xfrm_init();
3445 xfrm4_init(); 3445 xfrm4_init(ip_rt_max_size);
3446#endif 3446#endif
3447 rtnl_register(PF_INET, RTM_GETROUTE, inet_rtm_getroute, NULL); 3447 rtnl_register(PF_INET, RTM_GETROUTE, inet_rtm_getroute, NULL);
3448 3448
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index 26496babdf3a..1ba44742ebbf 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -290,10 +290,21 @@ static void __exit xfrm4_policy_fini(void)
290 xfrm_policy_unregister_afinfo(&xfrm4_policy_afinfo); 290 xfrm_policy_unregister_afinfo(&xfrm4_policy_afinfo);
291} 291}
292 292
293void __init xfrm4_init(void) 293void __init xfrm4_init(int rt_max_size)
294{ 294{
295 xfrm4_state_init(); 295 xfrm4_state_init();
296 xfrm4_policy_init(); 296 xfrm4_policy_init();
297 /*
298 * Select a default value for the gc_thresh based on the main route
299 * table hash size. It seems to me the worst case scenario is when
300 * we have ipsec operating in transport mode, in which we create a
301 * dst_entry per socket. The xfrm gc algorithm starts trying to remove
302 * entries at gc_thresh, and prevents new allocations as 2*gc_thresh
303 * so lets set an initial xfrm gc_thresh value at the rt_max_size/2.
304 * That will let us store an ipsec connection per route table entry,
305 * and start cleaning when were 1/2 full
306 */
307 xfrm4_dst_ops.gc_thresh = rt_max_size/2;
297 sysctl_hdr = register_net_sysctl_table(&init_net, net_ipv4_ctl_path, 308 sysctl_hdr = register_net_sysctl_table(&init_net, net_ipv4_ctl_path,
298 xfrm4_policy_table); 309 xfrm4_policy_table);
299} 310}