xfrm_state.c (61420e147a706ee7c7a902008045547fb2a2a330) xfrm_state.c (df71837d5024e2524cd51c93621e558aa7dd9f3f)
1/*
2 * xfrm_state.c
3 *
4 * Changes:
5 * Mitsuru KANDA @USAGI
6 * Kazunori MIYAZAWA @USAGI
7 * Kunihiro Ishiguro <kunihiro@ipinfusion.com>
8 * IPv6 support
9 * YOSHIFUJI Hideaki @USAGI
10 * Split up af-specific functions
11 * Derek Atkins <derek@ihtfp.com>
12 * Add UDP Encapsulation
1/*
2 * xfrm_state.c
3 *
4 * Changes:
5 * Mitsuru KANDA @USAGI
6 * Kazunori MIYAZAWA @USAGI
7 * Kunihiro Ishiguro <kunihiro@ipinfusion.com>
8 * IPv6 support
9 * YOSHIFUJI Hideaki @USAGI
10 * Split up af-specific functions
11 * Derek Atkins <derek@ihtfp.com>
12 * Add UDP Encapsulation
13 *
13 *
14 */
15
16#include <linux/workqueue.h>
17#include <net/xfrm.h>
18#include <linux/pfkeyv2.h>
19#include <linux/ipsec.h>
20#include <linux/module.h>
21#include <asm/uaccess.h>

--- 43 unchanged lines hidden (view full) ---

65 kfree(x->aalg);
66 kfree(x->ealg);
67 kfree(x->calg);
68 kfree(x->encap);
69 if (x->type) {
70 x->type->destructor(x);
71 xfrm_put_type(x->type);
72 }
14 */
15
16#include <linux/workqueue.h>
17#include <net/xfrm.h>
18#include <linux/pfkeyv2.h>
19#include <linux/ipsec.h>
20#include <linux/module.h>
21#include <asm/uaccess.h>

--- 43 unchanged lines hidden (view full) ---

65 kfree(x->aalg);
66 kfree(x->ealg);
67 kfree(x->calg);
68 kfree(x->encap);
69 if (x->type) {
70 x->type->destructor(x);
71 xfrm_put_type(x->type);
72 }
73 security_xfrm_state_free(x);
73 kfree(x);
74}
75
76static void xfrm_state_gc_task(void *data)
77{
78 struct xfrm_state *x;
79 struct list_head *entry, *tmp;
80 struct list_head gc_list = LIST_HEAD_INIT(gc_list);

--- 257 unchanged lines hidden (view full) ---

338
339 3. If state is not valid, selector is temporary,
340 it selects only session which triggered
341 previous resolution. Key manager will do
342 something to install a state with proper
343 selector.
344 */
345 if (x->km.state == XFRM_STATE_VALID) {
74 kfree(x);
75}
76
77static void xfrm_state_gc_task(void *data)
78{
79 struct xfrm_state *x;
80 struct list_head *entry, *tmp;
81 struct list_head gc_list = LIST_HEAD_INIT(gc_list);

--- 257 unchanged lines hidden (view full) ---

339
340 3. If state is not valid, selector is temporary,
341 it selects only session which triggered
342 previous resolution. Key manager will do
343 something to install a state with proper
344 selector.
345 */
346 if (x->km.state == XFRM_STATE_VALID) {
346 if (!xfrm_selector_match(&x->sel, fl, family))
347 if (!xfrm_selector_match(&x->sel, fl, family) ||
348 !xfrm_sec_ctx_match(pol->security, x->security))
347 continue;
348 if (!best ||
349 best->km.dying > x->km.dying ||
350 (best->km.dying == x->km.dying &&
351 best->curlft.add_time < x->curlft.add_time))
352 best = x;
353 } else if (x->km.state == XFRM_STATE_ACQ) {
354 acquire_in_progress = 1;
355 } else if (x->km.state == XFRM_STATE_ERROR ||
356 x->km.state == XFRM_STATE_EXPIRED) {
349 continue;
350 if (!best ||
351 best->km.dying > x->km.dying ||
352 (best->km.dying == x->km.dying &&
353 best->curlft.add_time < x->curlft.add_time))
354 best = x;
355 } else if (x->km.state == XFRM_STATE_ACQ) {
356 acquire_in_progress = 1;
357 } else if (x->km.state == XFRM_STATE_ERROR ||
358 x->km.state == XFRM_STATE_EXPIRED) {
357 if (xfrm_selector_match(&x->sel, fl, family))
359 if (xfrm_selector_match(&x->sel, fl, family) &&
360 xfrm_sec_ctx_match(pol->security, x->security))
358 error = -ESRCH;
359 }
360 }
361 }
362
363 x = best;
364 if (!x && !error && !acquire_in_progress) {
365 if (tmpl->id.spi &&

--- 748 unchanged lines hidden ---
361 error = -ESRCH;
362 }
363 }
364 }
365
366 x = best;
367 if (!x && !error && !acquire_in_progress) {
368 if (tmpl->id.spi &&

--- 748 unchanged lines hidden ---