diff options
Diffstat (limited to 'include')
| -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 cffa5dc66449..6ae4bc5ce8a7 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 | |||
| 1601 | } | 1601 | } |
| 1602 | 1602 | ||
| 1603 | #ifdef CONFIG_XFRM_MIGRATE | 1603 | #ifdef CONFIG_XFRM_MIGRATE |
| 1604 | static inline int xfrm_replay_clone(struct xfrm_state *x, | ||
| 1605 | struct xfrm_state *orig) | ||
| 1606 | { | ||
| 1607 | x->replay_esn = kzalloc(xfrm_replay_state_esn_len(orig->replay_esn), | ||
| 1608 | GFP_KERNEL); | ||
| 1609 | if (!x->replay_esn) | ||
| 1610 | return -ENOMEM; | ||
| 1611 | |||
| 1612 | x->replay_esn->bmp_len = orig->replay_esn->bmp_len; | ||
| 1613 | x->replay_esn->replay_window = orig->replay_esn->replay_window; | ||
| 1614 | |||
| 1615 | x->preplay_esn = kmemdup(x->replay_esn, | ||
| 1616 | xfrm_replay_state_esn_len(x->replay_esn), | ||
| 1617 | GFP_KERNEL); | ||
| 1618 | if (!x->preplay_esn) { | ||
| 1619 | kfree(x->replay_esn); | ||
| 1620 | return -ENOMEM; | ||
| 1621 | } | ||
| 1622 | |||
| 1623 | return 0; | ||
| 1624 | } | ||
| 1625 | |||
| 1604 | static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig) | 1626 | static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig) |
| 1605 | { | 1627 | { |
| 1606 | return kmemdup(orig, xfrm_alg_len(orig), GFP_KERNEL); | 1628 | return kmemdup(orig, xfrm_alg_len(orig), GFP_KERNEL); |
