10 #include <linux/slab.h>
11 #include <linux/module.h>
12 #include <linux/netdevice.h>
22 for (i = 0; i < sp->
len; i++)
23 xfrm_state_put(sp->
xvec[i]);
40 memcpy(sp, src,
sizeof(*sp));
41 for (i = 0; i < sp->
len; i++)
42 xfrm_state_hold(sp->
xvec[i]);
68 if (!pskb_may_pull(skb,
sizeof(
struct ip_comp_hdr)))
77 if (!pskb_may_pull(skb, hlen))
81 *seq = *(
__be32*)(skb_transport_header(skb) + offset_seq);
90 err = x->
outer_mode->afinfo->extract_input(x, skb);
96 if (inner_mode ==
NULL)
101 return inner_mode->
input2(x, skb);
119 if (encap_type < 0) {
121 x = xfrm_input_state(skb);
127 if (!skb->sp ||
atomic_read(&skb->sp->refcnt) != 1) {
136 secpath_put(skb->sp);
145 if (!spi && (err =
xfrm_parse_spi(skb, nexthdr, &spi, &seq)) != 0) {
159 xfrm_audit_state_notfound(skb, family, spi, seq);
163 skb->sp->xvec[skb->sp->
len++] =
x;
171 if ((x->
encap ? x->
encap->encap_type : 0) != encap_type) {
176 if (x->
repl->check(x, skb, seq)) {
186 spin_unlock(&x->
lock);
195 nexthdr = x->
type->input(x, skb);
204 xfrm_audit_state_icvfail(x, skb,
206 x->
stats.integrity_failed++;
215 if (async && x->
repl->recheck(x, skb, seq)) {
220 x->
repl->advance(x, seq);
225 spin_unlock(&x->
lock);
233 if (inner_mode ==
NULL)
237 if (inner_mode->
input(x, skb)) {
251 daddr = &x->
id.daddr;
268 return x->
inner_mode->afinfo->transport_finish(skb, async);
272 spin_unlock(&x->
lock);