aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/net/xfrm/xfrm_state.c
diff options
context:
space:
mode:
authorSteffen Klassert <steffen.klassert@secunet.com>2014-02-19 13:33:24 +0100
committerSteffen Klassert <steffen.klassert@secunet.com>2014-02-20 14:30:10 +0100
commitee5c23176fcc820f7a56d3e86001532af0d59b1e (patch)
tree120858d4c5c3f9ab0cff9cbea237f3a80109c28c /net/xfrm/xfrm_state.c
parentxfrm: Take xfrm_state_lock in xfrm_migrate_state_find (diff)
downloadwireguard-linux-ee5c23176fcc820f7a56d3e86001532af0d59b1e.tar.xz
wireguard-linux-ee5c23176fcc820f7a56d3e86001532af0d59b1e.zip
xfrm: Clone states properly on migration
We loose a lot of information of the original state if we clone it with xfrm_state_clone(). In particular, there is no crypto algorithm attached if the original state uses an aead algorithm. This patch add the missing information to the clone state. Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/xfrm/xfrm_state.c')
-rw-r--r--net/xfrm/xfrm_state.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index c101023be3d2..40f1b3e92e78 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -1159,6 +1159,11 @@ static struct xfrm_state *xfrm_state_clone(struct xfrm_state *orig, int *errp)
}
x->props.aalgo = orig->props.aalgo;
+ if (orig->aead) {
+ x->aead = xfrm_algo_aead_clone(orig->aead);
+ if (!x->aead)
+ goto error;
+ }
if (orig->ealg) {
x->ealg = xfrm_algo_clone(orig->ealg);
if (!x->ealg)
@@ -1201,6 +1206,9 @@ static struct xfrm_state *xfrm_state_clone(struct xfrm_state *orig, int *errp)
x->props.flags = orig->props.flags;
x->props.extra_flags = orig->props.extra_flags;
+ x->tfcpad = orig->tfcpad;
+ x->replay_maxdiff = orig->replay_maxdiff;
+ x->replay_maxage = orig->replay_maxage;
x->curlft.add_time = orig->curlft.add_time;
x->km.state = orig->km.state;
x->km.seq = orig->km.seq;