Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 243258
b: refs/heads/master
c: af2f464
h: refs/heads/master
v: v3
  • Loading branch information
Steffen Klassert authored and David S. Miller committed Mar 29, 2011
1 parent 995dd21 commit 40a49c2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 36ae0148dbb6b9e15d8f067bb7523fd2b765a6af
refs/heads/master: af2f464e326ebad57284cfdecb03f1606e89bbc7
22 changes: 22 additions & 0 deletions trunk/include/net/xfrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -1601,6 +1601,28 @@ static inline int xfrm_replay_state_esn_len(struct xfrm_replay_state_esn *replay
}

#ifdef CONFIG_XFRM_MIGRATE
static inline int xfrm_replay_clone(struct xfrm_state *x,
struct xfrm_state *orig)
{
x->replay_esn = kzalloc(xfrm_replay_state_esn_len(orig->replay_esn),
GFP_KERNEL);
if (!x->replay_esn)
return -ENOMEM;

x->replay_esn->bmp_len = orig->replay_esn->bmp_len;
x->replay_esn->replay_window = orig->replay_esn->replay_window;

x->preplay_esn = kmemdup(x->replay_esn,
xfrm_replay_state_esn_len(x->replay_esn),
GFP_KERNEL);
if (!x->preplay_esn) {
kfree(x->replay_esn);
return -ENOMEM;
}

return 0;
}

static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig)
{
return kmemdup(orig, xfrm_alg_len(orig), GFP_KERNEL);
Expand Down
6 changes: 6 additions & 0 deletions trunk/net/xfrm/xfrm_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,12 @@ static struct xfrm_state *xfrm_state_clone(struct xfrm_state *orig, int *errp)
goto error;
}

if (orig->replay_esn) {
err = xfrm_replay_clone(x, orig);
if (err)
goto error;
}

memcpy(&x->mark, &orig->mark, sizeof(x->mark));

err = xfrm_init_state(x);
Expand Down

0 comments on commit 40a49c2

Please sign in to comment.