xfrm: Assign esn pointers when cloning a state
When we clone a xfrm state we have to assign the replay_esn and the preplay_esn pointers to the state if we use the new replay detection method. To this end, we add a xfrm_replay_clone() function that allocates memory for the replay detection and takes over the necessary values from the original state. Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Acked-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
36ae0148db
commit
af2f464e32
2 changed files with 28 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue