aboutsummaryrefslogtreecommitdiffstats
path: root/net/xfrm/xfrm_user.c
diff options
context:
space:
mode:
authorJamal Hadi Salim <hadi@cyberus.ca>2007-05-04 15:55:13 -0400
committerDavid S. Miller <davem@davemloft.net>2007-05-04 15:55:13 -0400
commitaf11e31609d93765c1b22611592543e028f7aa54 (patch)
treef8a915dc7d98844667308f7c234d00f59113ff3f /net/xfrm/xfrm_user.c
parent224711df5c00f7540b89f32a8225866031977f17 (diff)
[XFRM] SAD info TLV aggregationx
Aggregate the SAD info TLVs. Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm/xfrm_user.c')
-rw-r--r--net/xfrm/xfrm_user.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 4210d91624c..c35b9ea3b62 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -749,7 +749,8 @@ static int xfrm_get_spdinfo(struct sk_buff *skb, struct nlmsghdr *nlh,
749 749
750static int build_sadinfo(struct sk_buff *skb, u32 pid, u32 seq, u32 flags) 750static int build_sadinfo(struct sk_buff *skb, u32 pid, u32 seq, u32 flags)
751{ 751{
752 struct xfrm_sadinfo si; 752 struct xfrmk_sadinfo si;
753 struct xfrmu_sadhinfo sh;
753 struct nlmsghdr *nlh; 754 struct nlmsghdr *nlh;
754 u32 *f; 755 u32 *f;
755 756
@@ -761,12 +762,11 @@ static int build_sadinfo(struct sk_buff *skb, u32 pid, u32 seq, u32 flags)
761 *f = flags; 762 *f = flags;
762 xfrm_sad_getinfo(&si); 763 xfrm_sad_getinfo(&si);
763 764
764 if (flags & XFRM_SAD_HMASK) 765 sh.sadhmcnt = si.sadhmcnt;
765 NLA_PUT_U32(skb, XFRMA_SADHMASK, si.sadhcnt); 766 sh.sadhcnt = si.sadhcnt;
766 if (flags & XFRM_SAD_HMAX) 767
767 NLA_PUT_U32(skb, XFRMA_SADHMAX, si.sadhmcnt); 768 NLA_PUT_U32(skb, XFRMA_SAD_CNT, si.sadcnt);
768 if (flags & XFRM_SAD_CNT) 769 NLA_PUT(skb, XFRMA_SAD_HINFO, sizeof(sh), &sh);
769 NLA_PUT_U32(skb, XFRMA_SADCNT, si.sadcnt);
770 770
771 return nlmsg_end(skb, nlh); 771 return nlmsg_end(skb, nlh);
772 772
@@ -784,12 +784,8 @@ static int xfrm_get_sadinfo(struct sk_buff *skb, struct nlmsghdr *nlh,
784 u32 seq = nlh->nlmsg_seq; 784 u32 seq = nlh->nlmsg_seq;
785 int len = NLMSG_LENGTH(sizeof(u32)); 785 int len = NLMSG_LENGTH(sizeof(u32));
786 786
787 if (*flags & XFRM_SAD_HMASK) 787 len += RTA_SPACE(sizeof(struct xfrmu_sadhinfo));
788 len += RTA_SPACE(sizeof(u32)); 788 len += RTA_SPACE(sizeof(u32));
789 if (*flags & XFRM_SAD_HMAX)
790 len += RTA_SPACE(sizeof(u32));
791 if (*flags & XFRM_SAD_CNT)
792 len += RTA_SPACE(sizeof(u32));
793 789
794 r_skb = alloc_skb(len, GFP_ATOMIC); 790 r_skb = alloc_skb(len, GFP_ATOMIC);
795 791