diff options
Diffstat (limited to 'net/ipv4/xfrm4_policy.c')
| -rw-r--r-- | net/ipv4/xfrm4_policy.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index 74fb2eb833ec..e4a1483fba77 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c | |||
| @@ -15,7 +15,6 @@ | |||
| 15 | #include <net/xfrm.h> | 15 | #include <net/xfrm.h> |
| 16 | #include <net/ip.h> | 16 | #include <net/ip.h> |
| 17 | 17 | ||
| 18 | static struct dst_ops xfrm4_dst_ops; | ||
| 19 | static struct xfrm_policy_afinfo xfrm4_policy_afinfo; | 18 | static struct xfrm_policy_afinfo xfrm4_policy_afinfo; |
| 20 | 19 | ||
| 21 | static struct dst_entry *xfrm4_dst_lookup(struct net *net, int tos, | 20 | static struct dst_entry *xfrm4_dst_lookup(struct net *net, int tos, |
| @@ -92,11 +91,12 @@ static int xfrm4_init_path(struct xfrm_dst *path, struct dst_entry *dst, | |||
| 92 | return 0; | 91 | return 0; |
| 93 | } | 92 | } |
| 94 | 93 | ||
| 95 | static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev) | 94 | static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, |
| 95 | struct flowi *fl) | ||
| 96 | { | 96 | { |
| 97 | struct rtable *rt = (struct rtable *)xdst->route; | 97 | struct rtable *rt = (struct rtable *)xdst->route; |
| 98 | 98 | ||
| 99 | xdst->u.rt.fl = rt->fl; | 99 | xdst->u.rt.fl = *fl; |
| 100 | 100 | ||
| 101 | xdst->u.dst.dev = dev; | 101 | xdst->u.dst.dev = dev; |
| 102 | dev_hold(dev); | 102 | dev_hold(dev); |
| @@ -190,8 +190,10 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
| 190 | 190 | ||
| 191 | static inline int xfrm4_garbage_collect(struct dst_ops *ops) | 191 | static inline int xfrm4_garbage_collect(struct dst_ops *ops) |
| 192 | { | 192 | { |
| 193 | xfrm4_policy_afinfo.garbage_collect(&init_net); | 193 | struct net *net = container_of(ops, struct net, xfrm.xfrm4_dst_ops); |
| 194 | return (atomic_read(&xfrm4_dst_ops.entries) > xfrm4_dst_ops.gc_thresh*2); | 194 | |
| 195 | xfrm4_policy_afinfo.garbage_collect(net); | ||
| 196 | return (atomic_read(&ops->entries) > ops->gc_thresh * 2); | ||
| 195 | } | 197 | } |
| 196 | 198 | ||
| 197 | static void xfrm4_update_pmtu(struct dst_entry *dst, u32 mtu) | 199 | static void xfrm4_update_pmtu(struct dst_entry *dst, u32 mtu) |
| @@ -267,9 +269,8 @@ static struct xfrm_policy_afinfo xfrm4_policy_afinfo = { | |||
| 267 | #ifdef CONFIG_SYSCTL | 269 | #ifdef CONFIG_SYSCTL |
| 268 | static struct ctl_table xfrm4_policy_table[] = { | 270 | static struct ctl_table xfrm4_policy_table[] = { |
| 269 | { | 271 | { |
| 270 | .ctl_name = CTL_UNNUMBERED, | ||
| 271 | .procname = "xfrm4_gc_thresh", | 272 | .procname = "xfrm4_gc_thresh", |
| 272 | .data = &xfrm4_dst_ops.gc_thresh, | 273 | .data = &init_net.xfrm.xfrm4_dst_ops.gc_thresh, |
| 273 | .maxlen = sizeof(int), | 274 | .maxlen = sizeof(int), |
| 274 | .mode = 0644, | 275 | .mode = 0644, |
| 275 | .proc_handler = proc_dointvec, | 276 | .proc_handler = proc_dointvec, |
| @@ -296,8 +297,6 @@ static void __exit xfrm4_policy_fini(void) | |||
| 296 | 297 | ||
| 297 | void __init xfrm4_init(int rt_max_size) | 298 | void __init xfrm4_init(int rt_max_size) |
| 298 | { | 299 | { |
| 299 | xfrm4_state_init(); | ||
| 300 | xfrm4_policy_init(); | ||
| 301 | /* | 300 | /* |
| 302 | * Select a default value for the gc_thresh based on the main route | 301 | * Select a default value for the gc_thresh based on the main route |
| 303 | * table hash size. It seems to me the worst case scenario is when | 302 | * table hash size. It seems to me the worst case scenario is when |
| @@ -309,6 +308,9 @@ void __init xfrm4_init(int rt_max_size) | |||
| 309 | * and start cleaning when were 1/2 full | 308 | * and start cleaning when were 1/2 full |
| 310 | */ | 309 | */ |
| 311 | xfrm4_dst_ops.gc_thresh = rt_max_size/2; | 310 | xfrm4_dst_ops.gc_thresh = rt_max_size/2; |
| 311 | |||
| 312 | xfrm4_state_init(); | ||
| 313 | xfrm4_policy_init(); | ||
| 312 | #ifdef CONFIG_SYSCTL | 314 | #ifdef CONFIG_SYSCTL |
| 313 | sysctl_hdr = register_net_sysctl_table(&init_net, net_ipv4_ctl_path, | 315 | sysctl_hdr = register_net_sysctl_table(&init_net, net_ipv4_ctl_path, |
| 314 | xfrm4_policy_table); | 316 | xfrm4_policy_table); |
