Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 78591
b: refs/heads/master
c: 9473e1f
h: refs/heads/master
i:
  78589: bcd55a4
  78587: 2477568
  78583: 99f7f4a
  78575: b3d4844
  78559: 98585fe
  78527: 01a2c58
  78463: 41cb137
  78335: f6319d2
v: v3
  • Loading branch information
Masahide NAKAMURA authored and David S. Miller committed Jan 28, 2008
1 parent 43dd73e commit af2227e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 26 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a1b051405bc16222d92c73b0c26d65b333a154ee
refs/heads/master: 9473e1f631de339c50bde1e3bd09e1045fe90fd5
54 changes: 29 additions & 25 deletions trunk/net/ipv6/xfrm6_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,26 @@ int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
struct xfrm_state *x = NULL;
int wildcard = 0;
xfrm_address_t *xany;
struct xfrm_state *xfrm_vec_one = NULL;
int nh = 0;
int i = 0;

/* Allocate new secpath or COW existing one. */
if (!skb->sp || atomic_read(&skb->sp->refcnt) != 1) {
struct sec_path *sp;

sp = secpath_dup(skb->sp);
if (!sp) {
goto drop;
}
if (skb->sp)
secpath_put(skb->sp);
skb->sp = sp;
}

if (1 + skb->sp->len == XFRM_MAX_DEPTH) {
goto drop;
}

xany = (xfrm_address_t *)&in6addr_any;

for (i = 0; i < 3; i++) {
Expand Down Expand Up @@ -119,47 +135,35 @@ int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
continue;
}

spin_unlock(&x->lock);

nh = x->type->input(x, skb);
if (nh <= 0) {
spin_unlock(&x->lock);
xfrm_state_put(x);
x = NULL;
continue;
}

x->curlft.bytes += skb->len;
x->curlft.packets++;

spin_unlock(&x->lock);

xfrm_vec_one = x;
/* Found a state */
break;
}

if (!xfrm_vec_one)
if (!x) {
goto drop;

/* Allocate new secpath or COW existing one. */
if (!skb->sp || atomic_read(&skb->sp->refcnt) != 1) {
struct sec_path *sp;
sp = secpath_dup(skb->sp);
if (!sp)
goto drop;
if (skb->sp)
secpath_put(skb->sp);
skb->sp = sp;
}

if (1 + skb->sp->len > XFRM_MAX_DEPTH)
goto drop;
skb->sp->xvec[skb->sp->len++] = x;

spin_lock(&x->lock);

skb->sp->xvec[skb->sp->len] = xfrm_vec_one;
skb->sp->len ++;
x->curlft.bytes += skb->len;
x->curlft.packets++;

spin_unlock(&x->lock);

return 1;

drop:
if (xfrm_vec_one)
xfrm_state_put(xfrm_vec_one);
return -1;
}

Expand Down

0 comments on commit af2227e

Please sign in to comment.