xfrm_output.c (1bfcb10f670f5ff5e1d9f53e59680573524cb142) xfrm_output.c (13996378e6585fb25e582afe7489bf52dde78deb)
1/*
2 * xfrm_output.c - Common IPsec encapsulation code.
3 *
4 * Copyright (c) 2007 Herbert Xu <herbert@gondor.apana.org.au>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version

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

58 goto error;
59
60 if (x->type->flags & XFRM_TYPE_REPLAY_PROT) {
61 XFRM_SKB_CB(skb)->seq = ++x->replay.oseq;
62 if (xfrm_aevent_is_on())
63 xfrm_replay_notify(x, XFRM_REPLAY_UPDATE);
64 }
65
1/*
2 * xfrm_output.c - Common IPsec encapsulation code.
3 *
4 * Copyright (c) 2007 Herbert Xu <herbert@gondor.apana.org.au>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version

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

58 goto error;
59
60 if (x->type->flags & XFRM_TYPE_REPLAY_PROT) {
61 XFRM_SKB_CB(skb)->seq = ++x->replay.oseq;
62 if (xfrm_aevent_is_on())
63 xfrm_replay_notify(x, XFRM_REPLAY_UPDATE);
64 }
65
66 err = x->mode->output(x, skb);
66 err = x->outer_mode->output(x, skb);
67 if (err)
68 goto error;
69
70 x->curlft.bytes += skb->len;
71 x->curlft.packets++;
72
73 spin_unlock_bh(&x->lock);
74
75 err = x->type->output(x, skb);
76 if (err)
77 goto error_nolock;
78
79 if (!(skb->dst = dst_pop(dst))) {
80 err = -EHOSTUNREACH;
81 goto error_nolock;
82 }
83 dst = skb->dst;
84 x = dst->xfrm;
67 if (err)
68 goto error;
69
70 x->curlft.bytes += skb->len;
71 x->curlft.packets++;
72
73 spin_unlock_bh(&x->lock);
74
75 err = x->type->output(x, skb);
76 if (err)
77 goto error_nolock;
78
79 if (!(skb->dst = dst_pop(dst))) {
80 err = -EHOSTUNREACH;
81 goto error_nolock;
82 }
83 dst = skb->dst;
84 x = dst->xfrm;
85 } while (x && !(x->mode->flags & XFRM_MODE_FLAG_TUNNEL));
85 } while (x && !(x->outer_mode->flags & XFRM_MODE_FLAG_TUNNEL));
86
87 err = 0;
88
89error_nolock:
90 return err;
91error:
92 spin_unlock_bh(&x->lock);
93 goto error_nolock;
94}
95EXPORT_SYMBOL_GPL(xfrm_output);
86
87 err = 0;
88
89error_nolock:
90 return err;
91error:
92 spin_unlock_bh(&x->lock);
93 goto error_nolock;
94}
95EXPORT_SYMBOL_GPL(xfrm_output);