diff options
author | dingzhi <zhi.ding@6wind.com> | 2014-10-30 04:39:36 -0400 |
---|---|---|
committer | Steffen Klassert <steffen.klassert@secunet.com> | 2014-11-03 02:54:52 -0500 |
commit | f293a5e33e084ef84b802e3002e5fe3eef086171 (patch) | |
tree | f5d114479686c77b160774b348454513871c16f1 /net/xfrm | |
parent | 5c1e9f2c1ff7ed91c03906e0bf1d7fbbddae3970 (diff) |
xfrm: add XFRMA_REPLAY_VAL attribute to SA messages
After this commit, the attribute XFRMA_REPLAY_VAL is added when no ESN replay
value is defined. Thus sequence number values are always notified to userspace.
Signed-off-by: dingzhi <zhi.ding@6wind.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/xfrm')
-rw-r--r-- | net/xfrm/xfrm_user.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index e812e988c111..8128594ab379 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -824,13 +824,15 @@ static int copy_to_user_state_extra(struct xfrm_state *x, | |||
824 | ret = xfrm_mark_put(skb, &x->mark); | 824 | ret = xfrm_mark_put(skb, &x->mark); |
825 | if (ret) | 825 | if (ret) |
826 | goto out; | 826 | goto out; |
827 | if (x->replay_esn) { | 827 | if (x->replay_esn) |
828 | ret = nla_put(skb, XFRMA_REPLAY_ESN_VAL, | 828 | ret = nla_put(skb, XFRMA_REPLAY_ESN_VAL, |
829 | xfrm_replay_state_esn_len(x->replay_esn), | 829 | xfrm_replay_state_esn_len(x->replay_esn), |
830 | x->replay_esn); | 830 | x->replay_esn); |
831 | if (ret) | 831 | else |
832 | goto out; | 832 | ret = nla_put(skb, XFRMA_REPLAY_VAL, sizeof(x->replay), |
833 | } | 833 | &x->replay); |
834 | if (ret) | ||
835 | goto out; | ||
834 | if (x->security) | 836 | if (x->security) |
835 | ret = copy_sec_ctx(x->security, skb); | 837 | ret = copy_sec_ctx(x->security, skb); |
836 | out: | 838 | out: |
@@ -2569,6 +2571,8 @@ static inline size_t xfrm_sa_len(struct xfrm_state *x) | |||
2569 | l += nla_total_size(sizeof(x->tfcpad)); | 2571 | l += nla_total_size(sizeof(x->tfcpad)); |
2570 | if (x->replay_esn) | 2572 | if (x->replay_esn) |
2571 | l += nla_total_size(xfrm_replay_state_esn_len(x->replay_esn)); | 2573 | l += nla_total_size(xfrm_replay_state_esn_len(x->replay_esn)); |
2574 | else | ||
2575 | l += nla_total_size(sizeof(struct xfrm_replay_state)); | ||
2572 | if (x->security) | 2576 | if (x->security) |
2573 | l += nla_total_size(sizeof(struct xfrm_user_sec_ctx) + | 2577 | l += nla_total_size(sizeof(struct xfrm_user_sec_ctx) + |
2574 | x->security->ctx_len); | 2578 | x->security->ctx_len); |