diff options
author | Paul Mundt <lethal@linux-sh.org> | 2011-03-31 15:39:47 +0900 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2011-03-31 15:39:47 +0900 |
commit | 7ea5db8efeac8627500e012aa6829ca612c5a700 (patch) | |
tree | 90e4de22f60b989dcf0f0d7436978c0b463d5827 /include/net/xfrm.h | |
parent | eee7631fdf8ae63c4f24daf66981ac1a7b55d7fd (diff) | |
parent | 6aba74f2791287ec407e0f92487a725a25908067 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into sh-latest
Diffstat (limited to 'include/net/xfrm.h')
-rw-r--r-- | include/net/xfrm.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index cffa5dc6644..6ae4bc5ce8a 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -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); |