diff options
Diffstat (limited to 'net/ipv6/xfrm6_policy.c')
-rw-r--r-- | net/ipv6/xfrm6_policy.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index 8ec3d45cd1d9..00bf7c962b7e 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <net/mip6.h> | 24 | #include <net/mip6.h> |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | static struct dst_ops xfrm6_dst_ops; | ||
28 | static struct xfrm_policy_afinfo xfrm6_policy_afinfo; | 27 | static struct xfrm_policy_afinfo xfrm6_policy_afinfo; |
29 | 28 | ||
30 | static struct dst_entry *xfrm6_dst_lookup(struct net *net, int tos, | 29 | static struct dst_entry *xfrm6_dst_lookup(struct net *net, int tos, |
@@ -117,14 +116,15 @@ static int xfrm6_init_path(struct xfrm_dst *path, struct dst_entry *dst, | |||
117 | return 0; | 116 | return 0; |
118 | } | 117 | } |
119 | 118 | ||
120 | static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev) | 119 | static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, |
120 | struct flowi *fl) | ||
121 | { | 121 | { |
122 | struct rt6_info *rt = (struct rt6_info*)xdst->route; | 122 | struct rt6_info *rt = (struct rt6_info*)xdst->route; |
123 | 123 | ||
124 | xdst->u.dst.dev = dev; | 124 | xdst->u.dst.dev = dev; |
125 | dev_hold(dev); | 125 | dev_hold(dev); |
126 | 126 | ||
127 | xdst->u.rt6.rt6i_idev = in6_dev_get(rt->u.dst.dev); | 127 | xdst->u.rt6.rt6i_idev = in6_dev_get(dev); |
128 | if (!xdst->u.rt6.rt6i_idev) | 128 | if (!xdst->u.rt6.rt6i_idev) |
129 | return -ENODEV; | 129 | return -ENODEV; |
130 | 130 | ||
@@ -224,8 +224,10 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
224 | 224 | ||
225 | static inline int xfrm6_garbage_collect(struct dst_ops *ops) | 225 | static inline int xfrm6_garbage_collect(struct dst_ops *ops) |
226 | { | 226 | { |
227 | xfrm6_policy_afinfo.garbage_collect(&init_net); | 227 | struct net *net = container_of(ops, struct net, xfrm.xfrm6_dst_ops); |
228 | return (atomic_read(&xfrm6_dst_ops.entries) > xfrm6_dst_ops.gc_thresh*2); | 228 | |
229 | xfrm6_policy_afinfo.garbage_collect(net); | ||
230 | return (atomic_read(&ops->entries) > ops->gc_thresh * 2); | ||
229 | } | 231 | } |
230 | 232 | ||
231 | static void xfrm6_update_pmtu(struct dst_entry *dst, u32 mtu) | 233 | static void xfrm6_update_pmtu(struct dst_entry *dst, u32 mtu) |
@@ -309,9 +311,8 @@ static void xfrm6_policy_fini(void) | |||
309 | #ifdef CONFIG_SYSCTL | 311 | #ifdef CONFIG_SYSCTL |
310 | static struct ctl_table xfrm6_policy_table[] = { | 312 | static struct ctl_table xfrm6_policy_table[] = { |
311 | { | 313 | { |
312 | .ctl_name = CTL_UNNUMBERED, | ||
313 | .procname = "xfrm6_gc_thresh", | 314 | .procname = "xfrm6_gc_thresh", |
314 | .data = &xfrm6_dst_ops.gc_thresh, | 315 | .data = &init_net.xfrm.xfrm6_dst_ops.gc_thresh, |
315 | .maxlen = sizeof(int), | 316 | .maxlen = sizeof(int), |
316 | .mode = 0644, | 317 | .mode = 0644, |
317 | .proc_handler = proc_dointvec, | 318 | .proc_handler = proc_dointvec, |
@@ -327,13 +328,6 @@ int __init xfrm6_init(void) | |||
327 | int ret; | 328 | int ret; |
328 | unsigned int gc_thresh; | 329 | unsigned int gc_thresh; |
329 | 330 | ||
330 | ret = xfrm6_policy_init(); | ||
331 | if (ret) | ||
332 | goto out; | ||
333 | |||
334 | ret = xfrm6_state_init(); | ||
335 | if (ret) | ||
336 | goto out_policy; | ||
337 | /* | 331 | /* |
338 | * We need a good default value for the xfrm6 gc threshold. | 332 | * We need a good default value for the xfrm6 gc threshold. |
339 | * In ipv4 we set it to the route hash table size * 8, which | 333 | * In ipv4 we set it to the route hash table size * 8, which |
@@ -347,6 +341,15 @@ int __init xfrm6_init(void) | |||
347 | */ | 341 | */ |
348 | gc_thresh = FIB6_TABLE_HASHSZ * 8; | 342 | gc_thresh = FIB6_TABLE_HASHSZ * 8; |
349 | xfrm6_dst_ops.gc_thresh = (gc_thresh < 1024) ? 1024 : gc_thresh; | 343 | xfrm6_dst_ops.gc_thresh = (gc_thresh < 1024) ? 1024 : gc_thresh; |
344 | |||
345 | ret = xfrm6_policy_init(); | ||
346 | if (ret) | ||
347 | goto out; | ||
348 | |||
349 | ret = xfrm6_state_init(); | ||
350 | if (ret) | ||
351 | goto out_policy; | ||
352 | |||
350 | #ifdef CONFIG_SYSCTL | 353 | #ifdef CONFIG_SYSCTL |
351 | sysctl_hdr = register_net_sysctl_table(&init_net, net_ipv6_ctl_path, | 354 | sysctl_hdr = register_net_sysctl_table(&init_net, net_ipv6_ctl_path, |
352 | xfrm6_policy_table); | 355 | xfrm6_policy_table); |